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