...
Code Block |
---|
ifeq ($(CONFIG_DEBUG_TRACE),y) EXCLUDEFILENAME = trace_exclude_files.txt EXCLUDEFUNCNAME = trace_exclude_functions.txt EXCLUDEFILES := $(shell for file in `cat $(EXCLUDEFILENAME)`; do echo -n $$file, ; done) EXCLUDEFUNCS := $(shell for func in `cat $(EXCLUDEFUNCNAME)`; do echo -n $$func, ; done) CFLAGS += -finstrument-functions ifneq ($(EXCLUDEFILES), ) CFLAGS += -finstrument-functions-exclude-file-list='$(EXCLUDEFILES)' endif ifneq ($(EXCLUDEFUNCS), ) CFLAGS += -finstrument-functions-exclude-function-list='$(EXCLUDEFUNCS)' endif endif |
The functions defined in the files this Makefile will compile will be instrumented.
You can add the file names list that are excluded from trace instrumentation to trace_exclude_files.txt like below.
tal/src/tal_buffer.c
tal_semaphore.c
And function names list that are excluded from tracing to trace_exclude_functions.txt like below.
...
TAL_get_instance() and the functions beginning with “IFD_“ will not be tracedinstrumented.
3. Add syslog to profiling functions in your APP.
Because syslog mask is 2 in config, the priority of syslog shoule be LOG_CRIT
here. The priority value should <= logmask. Add below code in your application. For example, we add once below code is added in k81start.c, above gcc option in is added to idtapps/neo3/idt_apps/k81_reader/Makefile and idtapps/neo3/idt_apps/k81_system/Makefile, trace log will be output with all user functions defined in the path idtapps/neo3/idt_apps/k81_reader and k81_system if trace_exclude_files.txt or trace_exclude_functions.txt is not created or empty.
Code Block |
---|
#ifdef CONFIG_DEBUG_TRACE void __attribute__((__no_instrument_function__)) __cyg_profile_func_enter(void *this_func, void *call_site) { syslog(LOG_CRIT, "[Start].%p\n", this_func); } void __attribute__((__no_instrument_function__)) __cyg_profile_func_exit(void *this_func, void *call_site) { syslog(LOG_CRIT, "[End].%p\n", this_func); } #endif |
...