Skip to content

Commit 38847db

Browse files
tzstoyanovacmel
authored andcommitted
libtraceevent, perf tools: Changes in tep_print_event_* APIs
Libtraceevent APIs for printing various trace events information are complicated, there are complex extra parameters. To control the way event information is printed, the user should call a set of functions in a specific sequence. These APIs are reimplemented to provide a more simple interface for printing event information. Removed APIs: tep_print_event_task() tep_print_event_time() tep_print_event_data() tep_event_info() tep_is_latency_format() tep_set_latency_format() tep_data_latency_format() tep_set_print_raw() A new API for printing event information is introduced: void tep_print_event(struct tep_handle *tep, struct trace_seq *s, struct tep_record *record, const char *fmt, ...); where "fmt" is a printf-like format string, followed by the event fields to be printed. Supported fields: TEP_PRINT_PID, "%d" - event PID TEP_PRINT_CPU, "%d" - event CPU TEP_PRINT_COMM, "%s" - event command string TEP_PRINT_NAME, "%s" - event name TEP_PRINT_LATENCY, "%s" - event latency TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be specified as part of this format string: "%precision.divisord". Example: "%3.1000d" - divide the time by 1000 and print the first 3 digits before the dot. Thus, the time stamp "123456000" will be printed as "123.456" TEP_PRINT_INFO, "%s" - event information. TEP_PRINT_INFO_RAW, "%s" - event information, in raw format. Example: tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s", TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU, TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME, TEP_PRINT_INFO); Output: ls-11314 [005] d.h. 185207.366383 function __wake_up 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 Cc: Patrick McLean <chutzpah@gentoo.org> Link: http://lore.kernel.org/linux-trace-devel/20190801074959.22023-2-tz.stoyanov@gmail.com Link: http://lore.kernel.org/lkml/20190805204355.041132030@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4cb3c6d commit 38847db

7 files changed

Lines changed: 203 additions & 200 deletions

File tree

‎tools/lib/traceevent/event-parse-api.c‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -302,33 +302,6 @@ void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian)
302302
tep->host_bigendian = endian;
303303
}
304304

305-
/**
306-
* tep_is_latency_format - get if the latency output format is configured
307-
* @tep: a handle to the tep_handle
308-
*
309-
* This returns true if the latency output format is configured
310-
* If @tep is NULL, false is returned.
311-
*/
312-
bool tep_is_latency_format(struct tep_handle *tep)
313-
{
314-
if (tep)
315-
return (tep->latency_format);
316-
return false;
317-
}
318-
319-
/**
320-
* tep_set_latency_format - set the latency output format
321-
* @tep: a handle to the tep_handle
322-
* @lat: non zero for latency output format
323-
*
324-
* This sets the latency output format
325-
*/
326-
void tep_set_latency_format(struct tep_handle *tep, int lat)
327-
{
328-
if (tep)
329-
tep->latency_format = lat;
330-
}
331-
332305
/**
333306
* tep_is_old_format - get if an old kernel is used
334307
* @tep: a handle to the tep_handle
@@ -344,19 +317,6 @@ bool tep_is_old_format(struct tep_handle *tep)
344317
return false;
345318
}
346319

347-
/**
348-
* tep_set_print_raw - set a flag to force print in raw format
349-
* @tep: a handle to the tep_handle
350-
* @print_raw: the new value of the print_raw flag
351-
*
352-
* This sets a flag to force print in raw format
353-
*/
354-
void tep_set_print_raw(struct tep_handle *tep, int print_raw)
355-
{
356-
if (tep)
357-
tep->print_raw = print_raw;
358-
}
359-
360320
/**
361321
* tep_set_test_filters - set a flag to test a filter string
362322
* @tep: a handle to the tep_handle

‎tools/lib/traceevent/event-parse-local.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ struct tep_handle {
2828
enum tep_endian file_bigendian;
2929
enum tep_endian host_bigendian;
3030

31-
int latency_format;
32-
3331
int old_format;
3432

3533
int cpus;
@@ -70,8 +68,6 @@ struct tep_handle {
7068
int ld_offset;
7169
int ld_size;
7270

73-
int print_raw;
74-
7571
int test_filters;
7672

7773
int flags;

0 commit comments

Comments
 (0)