lkml.org 
[lkml]   [2013]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 02/21] perf trace: Fix summary percentage when processing files
    Date
    From: David Ahern <dsahern@gmail.com>

    Getting a divide by 0 when events are processed from a file:

    perf trace -i perf.data -s
    ...
    dnsmasq (1684), 10 events, inf%, 0.000 msec

    The problem is that the event count is not incremented as events are
    processed. With this patch:

    perf trace -i perf.data -s
    ...
    dnsmasq (1684), 10 events, 8.9%, 0.000 msec

    Signed-off-by: David Ahern <dsahern@gmail.com>
    Link: http://lkml.kernel.org/r/1386211302-31303-4-git-send-email-dsahern@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    ---
    tools/perf/builtin-trace.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
    index a7aa771a98e6..56bbca5bc2dc 100644
    --- a/tools/perf/builtin-trace.c
    +++ b/tools/perf/builtin-trace.c
    @@ -1770,8 +1770,10 @@ static int trace__process_sample(struct perf_tool *tool,
    if (!trace->full_time && trace->base_time == 0)
    trace->base_time = sample->time;

    - if (handler)
    + if (handler) {
    + ++trace->nr_events;
    handler(trace, evsel, sample);
    + }

    return err;
    }
    --
    1.8.1.4


    \
     
     \ /
      Last update: 2013-12-09 21:01    [W:4.171 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site