Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib traceevent: Man page for tep_read_number_field()

Create man page for libtraceevent API tep_read_number_field().

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/linux-trace-devel/20190503091119.23399-21-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190510200109.219394901@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
95ec2822 6dfe6849

+81
+81
tools/lib/traceevent/Documentation/libtraceevent-field_read.txt
··· 1 + libtraceevent(3) 2 + ================ 3 + 4 + NAME 5 + ---- 6 + tep_read_number_field - Reads a number from raw data. 7 + 8 + SYNOPSIS 9 + -------- 10 + [verse] 11 + -- 12 + *#include <event-parse.h>* 13 + 14 + int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_); 15 + -- 16 + 17 + DESCRIPTION 18 + ----------- 19 + The _tep_read_number_field()_ function reads the value of the _field_ from the 20 + raw _data_ and stores it in the _value_. The function sets the _value_ according 21 + to the endianness of the raw data and the current machine and stores it in 22 + _value_. 23 + 24 + RETURN VALUE 25 + ------------ 26 + The _tep_read_number_field()_ function retunrs 0 in case of success, or -1 in 27 + case of an error. 28 + 29 + EXAMPLE 30 + ------- 31 + [source,c] 32 + -- 33 + #include <event-parse.h> 34 + ... 35 + struct tep_handle *tep = tep_alloc(); 36 + ... 37 + struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start"); 38 + ... 39 + void process_record(struct tep_record *record) 40 + { 41 + unsigned long long pid; 42 + struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid"); 43 + 44 + if (tep_read_number_field(field_pid, record->data, &pid) != 0) { 45 + /* Failed to get "common_pid" value */ 46 + } 47 + } 48 + ... 49 + -- 50 + FILES 51 + ----- 52 + [verse] 53 + -- 54 + *event-parse.h* 55 + Header file to include in order to have access to the library APIs. 56 + *-ltraceevent* 57 + Linker switch to add when building a program that uses the library. 58 + -- 59 + 60 + SEE ALSO 61 + -------- 62 + _libtraceevent(3)_, _trace-cmd(1)_ 63 + 64 + AUTHOR 65 + ------ 66 + [verse] 67 + -- 68 + *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 69 + *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 70 + -- 71 + REPORTING BUGS 72 + -------------- 73 + Report bugs to <linux-trace-devel@vger.kernel.org> 74 + 75 + LICENSE 76 + ------- 77 + libtraceevent is Free Software licensed under the GNU LGPL 2.1 78 + 79 + RESOURCES 80 + --------- 81 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git