linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tstoyanov@vmware.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 4/5] libtraceevent, perf tools: Changes in tep_print_event_* APIs
Date: Fri, 20 Sep 2019 16:06:23 +0000	[thread overview]
Message-ID: <CACqStococL=0ty5OGwAx9Xs7mHhXUpoGdN8qXQTKMJbZnBq3Yw@mail.gmail.com> (raw)
In-Reply-To: <20190919185036.6fde0c6b@gandalf.local.home>

On Fri, Sep 20, 2019 at 1:50 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Tue, 17 Sep 2019 22:03:38 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> >
> > 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: https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Flore.kernel.org%2Flinux-trace-devel%2F20190801074959.22023-2-tz.stoyanov%40gmail.com&amp;data=02%7C01%7Ctstoyanov%40vmware.com%7Cb43e28f618db4d1ccc4908d73d53caeb%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637045302420525409&amp;sdata=XVy%2FprqSVkHVUJ0Vi1gSeQwnHmc82kipnkMbN%2BaWmiA%3D&amp;reserved=0
> > Link: https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Flore.kernel.org%2Flkml%2F20190805204355.041132030%40goodmis.org&amp;data=02%7C01%7Ctstoyanov%40vmware.com%7Cb43e28f618db4d1ccc4908d73d53caeb%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637045302420535406&amp;sdata=LbuU7Ef2Slbl6%2BVCtw7DRzV5TRp5GrceD6E%2FZ8LbGKM%3D&amp;reserved=0
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > [ Added support for trace-cmd trace-read.c ]
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>
>
> I needed to modify this with the following changes:
>
> diff --git a/kernel-shark/src/libkshark.c b/kernel-shark/src/libkshark.c
> index 47ec9c21..4207ae6f 100644
> --- a/kernel-shark/src/libkshark.c
> +++ b/kernel-shark/src/libkshark.c
> @@ -1103,7 +1103,7 @@ static const char *kshark_get_latency(struct tep_handle *pe,
>                 return NULL;
>
>         trace_seq_reset(&seq);
> -       tep_data_latency_format(pe, &seq, record);
> +       tep_print_event(pe, &seq, record, "%s", TEP_PRINT_LATENCY);
>         return seq.buffer;
>  }
>
> @@ -1117,7 +1117,7 @@ static const char *kshark_get_info(struct tep_handle *pe,
>                 return NULL;
>
>         trace_seq_reset(&seq);
> -       tep_event_info(&seq, event, record);
> +       tep_print_event(pe, &seq, record, "%s", TEP_PRINT_INFO);
>
>         /*
>          * The event info string contains a trailing newline.
>
>
> -- Steve

Changes looks OK, thanks Steven.
Reviewed-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

  parent reply	other threads:[~2019-09-20 16:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  2:03 [PATCH 0/5] trace-cmd: Update for the new trace_print_event() logic Steven Rostedt
2019-09-18  2:03 ` [PATCH 1/5] trace-cmd: Move extract trace_clock into trace-input.c Steven Rostedt
2019-09-20 14:55   ` Tzvetomir Stoyanov
2019-09-20 15:02     ` Steven Rostedt
2019-09-20 15:10     ` [PATCH 1/5 v2] " Steven Rostedt
2019-09-20 16:08       ` Tzvetomir Stoyanov
2019-09-20 16:11         ` Steven Rostedt
2019-09-18  2:03 ` [PATCH 2/5] trace-cmd: Separate out time diff code in trace_show_data() Steven Rostedt
2019-09-20 15:08   ` Tzvetomir Stoyanov
2019-09-18  2:03 ` [PATCH 3/5] trace-cmd: Add check for trace_clock using usecs into tracecmd_parse_trace_clock() Steven Rostedt
2019-09-20 15:10   ` Tzvetomir Stoyanov
2019-09-18  2:03 ` [PATCH 4/5] libtraceevent, perf tools: Changes in tep_print_event_* APIs Steven Rostedt
2019-09-19 22:50   ` Steven Rostedt
2019-09-19 22:53     ` [PATCH 4/5 v2] " Steven Rostedt
2019-09-20 16:06     ` Tzvetomir Stoyanov [this message]
2019-09-19 22:52   ` [PATCH 4/5] " Steven Rostedt
2019-09-18  2:03 ` [PATCH 5/5] tools/lib/traceevent: Round up in tep_print_event() time precision Steven Rostedt
2019-09-20 15:18   ` Tzvetomir Stoyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACqStococL=0ty5OGwAx9Xs7mHhXUpoGdN8qXQTKMJbZnBq3Yw@mail.gmail.com' \
    --to=tstoyanov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).