lkml.org 
[lkml]   [2019]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf trace: Fix events draining
Date
The event handler has currently events->disable check,
that prevents processing in case we disable the event.

It was used to bypass event display when we reach the
configured maximum via --max-events or 'nr' term. But
it collides with draining, which disables events and
processes whatever left in the buffer.

# cat ex.c
int main(void)
{
return 0;
}

# perf probe -x ./ex main
Added new event:
probe_ex:main (on main in /home/jolsa/kernel/linux-perf/tools/perf/ex)

You can now use it in all perf tools, such as:

perf record -e probe_ex:main -aR sleep 1

Before:
# perf trace -e probe_ex:main ./ex
#

After:
# perf trace -e probe_ex:main ./ex
0.000 ex/16341 probe_ex:main:(401106)
#

Checking on nr_events_printed value instead.

Fixes: a9c5e6c1e9bf ("perf trace: Introduce per-event maximum number of events property")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f5b3a1e9c1dd..729d3b82558b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2251,7 +2251,7 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
* from the ring buffer that we should discard, since the max events
* have already been considered/printed.
*/
- if (evsel->disabled)
+ if (evsel->nr_events_printed == evsel->max_events)
return 0;

thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
--
2.20.1
\
 
 \ /
  Last update: 2019-04-18 16:06    [W:0.018 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site