Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_print_field, tep_print_fields, tep_print_num_field, tep_print_func_field -
0007 Print the field content.
0008 
0009 SYNOPSIS
0010 --------
0011 [verse]
0012 --
0013 *#include <event-parse.h>*
0014 *#include <trace-seq.h>*
0015 
0016 void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_);
0017 void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_);
0018 int *tep_print_num_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
0019 int *tep_print_func_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
0020 --
0021 
0022 DESCRIPTION
0023 -----------
0024 These functions print recorded field's data, according to the field's type.
0025 
0026 The _tep_print_field()_ function extracts from the recorded raw _data_ value of
0027 the _field_ and prints it into _s_, according to the field type.
0028 
0029 The _tep_print_fields()_ prints each field name followed by the record's field
0030 value according to the field's type:
0031 [verse]
0032 --
0033 "field1_name=field1_value field2_name=field2_value ..."
0034 --
0035 It iterates all fields of the _event_, and calls _tep_print_field()_ for each of
0036 them.
0037 
0038 The _tep_print_num_field()_ function prints a numeric field with given format
0039 string. A search is performed in the _event_ for a field with _name_. If such
0040 field is found, its value is extracted from the _record_ and is printed in the
0041 _s_, according to the given format string _fmt_. If the argument _err_ is
0042 non-zero, and an error occures - it is printed in the _s_.
0043 
0044 The _tep_print_func_field()_ function prints a function field with given format
0045 string.  A search is performed in the _event_ for a field with _name_. If such
0046 field is found, its value is extracted from the _record_. The value is assumed
0047 to be a function address, and a search is perform to find the name of this
0048 function. The function name (if found) and its address are printed in the _s_,
0049 according to the given format string _fmt_. If the argument _err_ is non-zero,
0050 and an error occures - it is printed in _s_.
0051 
0052 RETURN VALUE
0053 ------------
0054 The _tep_print_num_field()_ and _tep_print_func_field()_ functions return 1
0055 on success, -1 in case of an error or 0 if the print buffer _s_ is full.
0056 
0057 EXAMPLE
0058 -------
0059 [source,c]
0060 --
0061 #include <event-parse.h>
0062 #include <trace-seq.h>
0063 ...
0064 struct tep_handle *tep = tep_alloc();
0065 ...
0066 struct trace_seq seq;
0067 trace_seq_init(&seq);
0068 struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
0069 ...
0070 void process_record(struct tep_record *record)
0071 {
0072         struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
0073 
0074         trace_seq_reset(&seq);
0075 
0076         /* Print the value of "common_pid" */
0077         tep_print_field(&seq, record->data, field_pid);
0078 
0079         /* Print all fields of the "hrtimer_start" event */
0080         tep_print_fields(&seq, record->data, record->size, event);
0081 
0082         /* Print the value of "expires" field with custom format string */
0083         tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0);
0084 
0085         /* Print the address and the name of "function" field with custom format string */
0086         tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0);
0087  }
0088  ...
0089 --
0090 
0091 FILES
0092 -----
0093 [verse]
0094 --
0095 *event-parse.h*
0096         Header file to include in order to have access to the library APIs.
0097 *trace-seq.h*
0098         Header file to include in order to have access to trace sequences related APIs.
0099         Trace sequences are used to allow a function to call several other functions
0100         to create a string of data to use.
0101 *-ltraceevent*
0102         Linker switch to add when building a program that uses the library.
0103 --
0104 
0105 SEE ALSO
0106 --------
0107 _libtraceevent(3)_, _trace-cmd(1)_
0108 
0109 AUTHOR
0110 ------
0111 [verse]
0112 --
0113 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0114 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0115 --
0116 REPORTING BUGS
0117 --------------
0118 Report bugs to  <linux-trace-devel@vger.kernel.org>
0119 
0120 LICENSE
0121 -------
0122 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0123 
0124 RESOURCES
0125 ---------
0126 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git