summaryrefslogtreecommitdiff
path: root/tools/perf/util/top.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-11-05 13:24:55 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-12-17 14:57:52 -0300
commit16c66bc167cc52992f66748aed7ac21396189457 (patch)
tree3df75ce71a4087525888d764a68fb81bdc61360b /tools/perf/util/top.h
parent254de74cd14a2e64323caeffe653de0f390a4e65 (diff)
perf top: Add processing thread
Add a new thread that takes care of the hist creating to alleviate the main reader thread so it can keep perf mmaps served in time so that we reduce the possibility of losing events. The 'perf top' command now spawns 2 extra threads, the data processing is the following: 1) The main thread reads the data from mmaps and queues them to ordered events object; 2) The processing threads takes the data from the ordered events object and create initial histogram; 3) The GUI thread periodically sorts the initial histogram and presents it. Passing the data between threads 1 and 2 is done by having 2 ordered events queues. One is always being stored by thread 1 while the other is flushed out in thread 2. Passing the data between threads 2 and 3 stays the same as was initially for threads 1 and 3. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-hhf4hllgkmle9wl1aly1jli0@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/top.h')
-rw-r--r--tools/perf/util/top.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 1fbcbd79720a..5f503293cfd8 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -40,6 +40,12 @@ struct perf_top {
const char *sym_filter;
float min_percent;
unsigned int nr_threads_synthesize;
+
+ struct {
+ struct ordered_events *in;
+ struct ordered_events data[2];
+ pthread_mutex_t lock;
+ } qe;
};
#define CONSOLE_CLEAR ""