Project

General

Profile

Trace

For a more in depth/general usage please see project TRACE.
The wiki bellow is designed for the ees-buildroot / ADinstBPM implementation only.

Usage

The ees-buildroot trace enviroment is defaulted to have memory tracing turned on for all trace levels and names.
All stdout tracing is disabled at startup. If one wishes to enable stdout tracing, see command tonS.

Assuming one built trace via the package and into the kernel,
The trace buffer file (TRACE_FILE) is defaulted to /proc/trace/buffer.

One can examine this file via the tshow command. (This is a convenience function which wraps trace_cntl show)
tshow can except options which controls output.

Helpful commands at startup include tinfo and tenv which show how trace is currently configured.

At any time one can type trace_cntl for the full set up control options as well as view all convenience functions sourced at login at /etc/profile.d/trace.functions.sh

API

The trace header file trace.h has been copied to the staging directory such that one should only have to add #include <trace.h> to any file being built in order to have access to trace.

The fastest method of tracing is the delayed formatting method similar to printf.
15 is the level in which this trace will respond. The 15 bit must be enabled in order for this trace to make it to the buffer.
See tonM , tonS

TRACE ( 15, "number of bytes is %d from " + driver_name, bytes ) ;

One could change the name associated with the trace via the env variable TARCE_NAME. This is defaulted to KERNEL or $USER at login.
From within a program: setenv("TRACE_NAME","Name of subsystem",0);

Commands (Convenience Functions )

tcntl() { trace_cntl "$"; }
tshow() { test -n "${PAGER-}" && trace_cntl show "$
" | $PAGER || trace_cntl show "$"; }
tinfo() { trace_cntl info "$
"; }
ttids() { trace_cntl tids "$"; }
tlvls() { trace_cntl tids "$
"; }
tlvlM() { trace_cntl lvlmskM "$"; }
tlvlS() { trace_cntl lvlmskS "$
"; }
tlvlT() { trace_cntl lvlmskT "$"; }
tlvlMg() { trace_cntl lvlmskMg "$
"; }
tlvlSg() { trace_cntl lvlmskSg "$"; }
tlvlTg() { trace_cntl lvlmskTg "$
"; }
tmode() { trace_cntl mode "$"; }
tmodeM() { trace_cntl modeM "$
"; }
tmodeS() { trace_cntl modeS "$@"; }
tfreeze() { trace_cntl modeM 0; }
treset() { trace_cntl reset; }

(Commands bellow require a package patch which is being worked on )

tonM() { trace_cntl lvlset `bitN_to_mask $*` 0 0; trace_cntl modeM 1; }
tonS() { trace_cntl lvlset 0 `bitN_to_mask $*` 0; trace_cntl modeS 1; }
tonT() { trace_cntl lvlset 0 0 `bitN_to_mask $*`; }
toffM() { trace_cntl lvlclr `bitN_to_mask $*` 0 0; }
toffS() { trace_cntl lvlclr 0 `bitN_to_mask $*` 0; }
toffT() { trace_cntl lvlclr 0 0 `bitN_to_mask $*`; }
tonMg() { trace_cntl lvlsetg `bitN_to_mask $*` 0 0; trace_cntl modeM 1; }
tonSg() { trace_cntl lvlsetg 0 `bitN_to_mask $*` 0; trace_cntl modeS 1; }
tonTg() { trace_cntl lvlsetg 0 0 `bitN_to_mask $*`; }
toffMg() { trace_cntl lvlclrg `bitN_to_mask $*` 0 0; }
toffSg() { trace_cntl lvlclrg 0 `bitN_to_mask $*` 0; }
toffTg() { trace_cntl lvlclrg 0 0 `bitN_to_mask $*`; }

Commands (trace_cntl)

trace_cntl [opts] <cmd> [command opt/args]
commands:
info, tids, reset
show [count [startSlotIndex]]
mode <mode>
modeM <mode>
modeS <mode>
lvlmsk[M|S|T][g] <lvlmsk> # M=memory, S=slow/console, T=trig
lvlmsk[g] <mskM> <mskS> <mskT>
lvlset[g] <mskM> <mskS> <mskT>
lvlclr[g] <mskM> <mskS> <mskT>
trig <postEntries> [lvlmskTM+] [quiet] # opt 2nd arg is for specified/dflt TID
reset
limit_ms <cnt> <on_ms> <off_ms>
opts:
-?, -h show this help
-f<file>
-n<name> name. For all commands - not wildcard, created if non-existent
-N<name> name. For lvl*, could be wildcard match spec.
-V print version and exit
-a for tids, show all
show opts:
-H no header
-L<LC_NUMERIC val> i.e. -Len_US
-q silence format errors
-F show forward, poll for new entries. "count" avoids older entries
other options encoded in TRACE_SHOW env.var.
tests: (use trace_cntl show after test)
-x<thread_options_mask> b0=TRACE_CNTL"file", b1=TRACE_CNTL"name", b2=count mappings
-l<loops>

test1 [-lloops] a single TRACE lvl 2 [or more if loops != 0]
test various
test-ro test first page of mmap read-only (for kernel module)
test-compare [-lloops] compare TRACE fmt+args vs. format+args converted (via sprintf). dflt loops=1000000
test-threads [-x<thread_opts>] [-lloops] [-ddly_ms] [num_threads] Tests threading. loops
of TRACEs: 2 lvl2's, lvl3, lvl4, lvl5 dflts: -x0 -l2 num_threads=4
TRACE <lvl> <fmt> [ulong]... (just ulong args are supported)

Channel Descriptions

Enumeration Value Sub-system Description
TRACE_CH_ERROR 0 Error Error messages - i.e. conditions that will halt operation
TRACE_CH_WARNING 1 Warning Warning messages - i.e. conditions that cause a measurement to fail but do not halt operation
TRACE_CH_ACNET ?? ACNET Informational messages from the ACNET interfaces
TRACE_CH_CONTROL ?? Control Informational messages from the controller
TRACE_CH_DAQ ?? DAQ Informational messages from the data acquisition system
TRACE_CH_DAQ_READOUT ?? DAQ Informational messages related to DAQ readout
TRACE_CH_STATE ?? State Machine Informational messages from the state machine
TRACE_CH_STATE_CLOCK ?? State Machine Clock decoder event notifications
TRACE_CH_GENERAL ?? General General information and notifications
TRACE_CH_SYS_CALL_ENTER 25 KERNEL system call enter
TRACE_CH_SYS_CALL_EXIT 26 KERNEL system call exit
TRACE_CH_SOFT_IRQ_ENTER 27 KERNEL software irq enter
TRACE_CH_SOFT_IRQ_RTN 28 KERNEL software irq return
TRACE_CH_HDW_IRQ_ENTER 29 KERNEL hardware irq return
TRACE_CH_HDW_IRQ_RTN 30 KERNEL hardware irq return
TRACE_CH_SCHED_HOOK 31 KERNEL schedule switch hook
TRACE_CH_DAQ_MODULE 32 DAQ Kernel Module Any messages from DAQ board kernel module
TRACE_CH_TIMING_MODULE 33 Timing Kernel Module Any messages from Timing board kernel module