SYNOPSIS
#include <event-parse.h> struct tep_format_field *tep_find_common_field(struct tep_event *event, const char *name); struct tep_format_field *tep_find_field(struct tep_event_ormat *event, const char *name); struct tep_format_field *tep_find_any_field(struct tep_event *event, const char *name);
DESCRIPTION
These functions search for a field with given name in an event. The field returned can be used to find the field content from within a data record.
The tep_find_common_field() function searches for a common field with name in the event.
The tep_find_field() function searches for an event specific field with name in the event.
The tep_find_any_field() function searches for any field with name in the event.
RETURN VALUE
The tep_find_common_field(), tep_find_field() and _tep_find_any_field() functions return a pointer to the found field, or NULL in case there is no field with the requested name.
EXAMPLE
#include <event-parse.h>\n...\nvoid get_htimer_info(struct tep_handle *tep, struct tep_record *record)\n{\n struct tep_format_field *field;\n struct tep_event *event;\n long long softexpires;\n int mode;\n int pid;\n\n event = tep_find_event_by_name(tep, "timer", "hrtimer_start");\n\n field = tep_find_common_field(event, "common_pid");\n if (field == NULL) {\n /* Cannot find "common_pid" field in the event */\n } else {\n /* Get pid from the data record */\n pid = tep_read_number(tep, record->data + field->offset,\n field->size);\n }\n\n field = tep_find_field(event, "softexpires");\n if (field == NULL) {\n /* Cannot find "softexpires" event specific field in the event */\n } else {\n /* Get softexpires parameter from the data record */\n softexpires = tep_read_number(tep, record->data + field->offset,\n field->size);\n }\n\n field = tep_find_any_field(event, "mode");\n if (field == NULL) {\n /* Cannot find "mode" field in the event */\n } else\n {\n /* Get mode parameter from the data record */\n mode = tep_read_number(tep, record->data + field->offset,\n field->size);\n }\n}\n...\n'
FILES
event-parse.h Header file to include in order to have access to the library APIs. -ltraceevent Linker switch to add when building a program that uses the library.
SEE ALSO
libtraceevent(3), trace-cmd(1)
AUTHOR
Steven Rostedt <rostedt@goodmis.org>, author of libtraceevent. Tzvetomir Stoyanov <tz.stoyanov@gmail.com>, author of this man page.
REPORTING BUGS
Report bugs to <linux-trace-devel@vger.kernel.org>
LICENSE
libtraceevent is Free Software licensed under the GNU LGPL 2.1