1*436bf2bcSAndroid Build Coastguard Workerlibtraceevent(3) 2*436bf2bcSAndroid Build Coastguard Worker================ 3*436bf2bcSAndroid Build Coastguard Worker 4*436bf2bcSAndroid Build Coastguard WorkerNAME 5*436bf2bcSAndroid Build Coastguard Worker---- 6*436bf2bcSAndroid Build Coastguard Workertep_print_event - Writes event information into a trace sequence. 7*436bf2bcSAndroid Build Coastguard Worker 8*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS 9*436bf2bcSAndroid Build Coastguard Worker-------- 10*436bf2bcSAndroid Build Coastguard Worker[verse] 11*436bf2bcSAndroid Build Coastguard Worker-- 12*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>* 13*436bf2bcSAndroid Build Coastguard Worker*#include <trace-seq.h>* 14*436bf2bcSAndroid Build Coastguard Worker 15*436bf2bcSAndroid Build Coastguard Workervoid *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seqpass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._) 16*436bf2bcSAndroid Build Coastguard Worker-- 17*436bf2bcSAndroid Build Coastguard Worker 18*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION 19*436bf2bcSAndroid Build Coastguard Worker----------- 20*436bf2bcSAndroid Build Coastguard Worker 21*436bf2bcSAndroid Build Coastguard WorkerThe *tep_print_event()* function parses the event information of the given 22*436bf2bcSAndroid Build Coastguard Worker_record_ and writes it into the trace sequence _s_, according to the format 23*436bf2bcSAndroid Build Coastguard Workerstring _fmt_. The desired information is specified after the format string. 24*436bf2bcSAndroid Build Coastguard WorkerThe _fmt_ is printf-like format string, following arguments are supported: 25*436bf2bcSAndroid Build Coastguard Worker[verse] 26*436bf2bcSAndroid Build Coastguard Worker-- 27*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_PID, "%d" - PID of the event. 28*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_CPU, "%d" - Event CPU. 29*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_COMM, "%s" - Event command string. 30*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_NAME, "%s" - Event name. 31*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_LATENCY, "%s" - Latency of the event. It prints 4 or more 32*436bf2bcSAndroid Build Coastguard Worker fields - interrupt state, scheduling state, 33*436bf2bcSAndroid Build Coastguard Worker current context, and preemption count. 34*436bf2bcSAndroid Build Coastguard Worker Field 1 is the interrupt enabled state: 35*436bf2bcSAndroid Build Coastguard Worker d : Interrupts are disabled 36*436bf2bcSAndroid Build Coastguard Worker . : Interrupts are enabled 37*436bf2bcSAndroid Build Coastguard Worker X : The architecture does not support this 38*436bf2bcSAndroid Build Coastguard Worker information 39*436bf2bcSAndroid Build Coastguard Worker Field 2 is the "need resched" state. 40*436bf2bcSAndroid Build Coastguard Worker N : The task is set to call the scheduler when 41*436bf2bcSAndroid Build Coastguard Worker possible, as another higher priority task 42*436bf2bcSAndroid Build Coastguard Worker may need to be scheduled in. 43*436bf2bcSAndroid Build Coastguard Worker . : The task is not set to call the scheduler. 44*436bf2bcSAndroid Build Coastguard Worker Field 3 is the context state. 45*436bf2bcSAndroid Build Coastguard Worker . : Normal context 46*436bf2bcSAndroid Build Coastguard Worker s : Soft interrupt context 47*436bf2bcSAndroid Build Coastguard Worker h : Hard interrupt context 48*436bf2bcSAndroid Build Coastguard Worker H : Hard interrupt context which triggered 49*436bf2bcSAndroid Build Coastguard Worker during soft interrupt context. 50*436bf2bcSAndroid Build Coastguard Worker z : NMI context 51*436bf2bcSAndroid Build Coastguard Worker Z : NMI context which triggered during hard 52*436bf2bcSAndroid Build Coastguard Worker interrupt context 53*436bf2bcSAndroid Build Coastguard Worker Field 4 is the preemption count. 54*436bf2bcSAndroid Build Coastguard Worker . : The preempt count is zero. 55*436bf2bcSAndroid Build Coastguard Worker On preemptible kernels (where the task can be scheduled 56*436bf2bcSAndroid Build Coastguard Worker out in arbitrary locations while in kernel context), the 57*436bf2bcSAndroid Build Coastguard Worker preempt count, when non zero, will prevent the kernel 58*436bf2bcSAndroid Build Coastguard Worker from scheduling out the current task. The preempt count 59*436bf2bcSAndroid Build Coastguard Worker number is displayed when it is not zero. 60*436bf2bcSAndroid Build Coastguard Worker Depending on the kernel, it may show other fields 61*436bf2bcSAndroid Build Coastguard Worker (lock depth, or migration disabled, which are unique to 62*436bf2bcSAndroid Build Coastguard Worker specialized kernels). 63*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be 64*436bf2bcSAndroid Build Coastguard Worker specified as part of this format string: 65*436bf2bcSAndroid Build Coastguard Worker "%precision.divisord". Example: 66*436bf2bcSAndroid Build Coastguard Worker "%3.1000d" - divide the time by 1000 and print the first 67*436bf2bcSAndroid Build Coastguard Worker 3 digits before the dot. Thus, the time stamp 68*436bf2bcSAndroid Build Coastguard Worker "123456000" will be printed as "123.456" 69*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_INFO, "%s" - event information. 70*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_INFO_RAW, "%s" - event information, in raw format. 71*436bf2bcSAndroid Build Coastguard Worker 72*436bf2bcSAndroid Build Coastguard Worker-- 73*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE 74*436bf2bcSAndroid Build Coastguard Worker------- 75*436bf2bcSAndroid Build Coastguard Worker[source,c] 76*436bf2bcSAndroid Build Coastguard Worker-- 77*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h> 78*436bf2bcSAndroid Build Coastguard Worker#include <trace-seq.h> 79*436bf2bcSAndroid Build Coastguard Worker... 80*436bf2bcSAndroid Build Coastguard Workerstruct trace_seq seq; 81*436bf2bcSAndroid Build Coastguard Workertrace_seq_init(&seq); 82*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc(); 83*436bf2bcSAndroid Build Coastguard Worker... 84*436bf2bcSAndroid Build Coastguard Workervoid print_my_event(struct tep_record *record) 85*436bf2bcSAndroid Build Coastguard Worker{ 86*436bf2bcSAndroid Build Coastguard Worker trace_seq_reset(&seq); 87*436bf2bcSAndroid Build Coastguard Worker tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s", 88*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU, 89*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME, 90*436bf2bcSAndroid Build Coastguard Worker TEP_PRINT_INFO); 91*436bf2bcSAndroid Build Coastguard Worker} 92*436bf2bcSAndroid Build Coastguard Worker... 93*436bf2bcSAndroid Build Coastguard Worker-- 94*436bf2bcSAndroid Build Coastguard Worker 95*436bf2bcSAndroid Build Coastguard WorkerFILES 96*436bf2bcSAndroid Build Coastguard Worker----- 97*436bf2bcSAndroid Build Coastguard Worker[verse] 98*436bf2bcSAndroid Build Coastguard Worker-- 99*436bf2bcSAndroid Build Coastguard Worker*event-parse.h* 100*436bf2bcSAndroid Build Coastguard Worker Header file to include in order to have access to the library APIs. 101*436bf2bcSAndroid Build Coastguard Worker*trace-seq.h* 102*436bf2bcSAndroid Build Coastguard Worker Header file to include in order to have access to trace sequences related APIs. 103*436bf2bcSAndroid Build Coastguard Worker Trace sequences are used to allow a function to call several other functions 104*436bf2bcSAndroid Build Coastguard Worker to create a string of data to use. 105*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent* 106*436bf2bcSAndroid Build Coastguard Worker Linker switch to add when building a program that uses the library. 107*436bf2bcSAndroid Build Coastguard Worker-- 108*436bf2bcSAndroid Build Coastguard Worker 109*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO 110*436bf2bcSAndroid Build Coastguard Worker-------- 111*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1) 112*436bf2bcSAndroid Build Coastguard Worker 113*436bf2bcSAndroid Build Coastguard WorkerAUTHOR 114*436bf2bcSAndroid Build Coastguard Worker------ 115*436bf2bcSAndroid Build Coastguard Worker[verse] 116*436bf2bcSAndroid Build Coastguard Worker-- 117*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*. 118*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page. 119*436bf2bcSAndroid Build Coastguard Worker-- 120*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS 121*436bf2bcSAndroid Build Coastguard Worker-------------- 122*436bf2bcSAndroid Build Coastguard WorkerReport bugs to <[email protected]> 123*436bf2bcSAndroid Build Coastguard Worker 124*436bf2bcSAndroid Build Coastguard WorkerLICENSE 125*436bf2bcSAndroid Build Coastguard Worker------- 126*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1 127*436bf2bcSAndroid Build Coastguard Worker 128*436bf2bcSAndroid Build Coastguard WorkerRESOURCES 129*436bf2bcSAndroid Build Coastguard Worker--------- 130*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ 131