2011-11-28 10:30:20 +00:00
|
|
|
#ifndef __PERF_TOOL_H
|
|
|
|
#define __PERF_TOOL_H
|
|
|
|
|
perf tools: Save some loops using perf_evlist__id2evsel
Since we already ask for PERF_SAMPLE_ID and use it to quickly find the
associated evsel, add handler func + data to struct perf_evsel to avoid
using chains of if(strcmp(event_name)) and also to avoid all the linear
list searches via trace_event_find.
To demonstrate the technique convert 'perf sched' to it:
# perf sched record sleep 5m
And then:
Performance counter stats for '/tmp/oldperf sched lat':
646.929438 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,901 page-faults # 0.032 M/sec
1,290,144,450 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,606,158,439 instructions # 1.24 insns per cycle
339,088,395 branches # 524.151 M/sec
4,550,735 branch-misses # 1.34% of all branches
0.647524759 seconds time elapsed
Versus:
Performance counter stats for 'perf sched lat':
473.564691 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,903 page-faults # 0.044 M/sec
944,367,984 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,442,385,571 instructions # 1.53 insns per cycle
308,383,106 branches # 651.195 M/sec
4,481,784 branch-misses # 1.45% of all branches
0.474215751 seconds time elapsed
[root@emilia ~]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1kbzpl74lwi6lavpqke2u2p3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-28 19:57:40 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2015-04-09 15:53:43 +00:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
2011-11-28 10:30:20 +00:00
|
|
|
struct perf_session;
|
perf tools: Save some loops using perf_evlist__id2evsel
Since we already ask for PERF_SAMPLE_ID and use it to quickly find the
associated evsel, add handler func + data to struct perf_evsel to avoid
using chains of if(strcmp(event_name)) and also to avoid all the linear
list searches via trace_event_find.
To demonstrate the technique convert 'perf sched' to it:
# perf sched record sleep 5m
And then:
Performance counter stats for '/tmp/oldperf sched lat':
646.929438 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,901 page-faults # 0.032 M/sec
1,290,144,450 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,606,158,439 instructions # 1.24 insns per cycle
339,088,395 branches # 524.151 M/sec
4,550,735 branch-misses # 1.34% of all branches
0.647524759 seconds time elapsed
Versus:
Performance counter stats for 'perf sched lat':
473.564691 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,903 page-faults # 0.044 M/sec
944,367,984 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,442,385,571 instructions # 1.53 insns per cycle
308,383,106 branches # 651.195 M/sec
4,481,784 branch-misses # 1.45% of all branches
0.474215751 seconds time elapsed
[root@emilia ~]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1kbzpl74lwi6lavpqke2u2p3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-28 19:57:40 +00:00
|
|
|
union perf_event;
|
|
|
|
struct perf_evlist;
|
2011-11-28 10:30:20 +00:00
|
|
|
struct perf_evsel;
|
perf tools: Save some loops using perf_evlist__id2evsel
Since we already ask for PERF_SAMPLE_ID and use it to quickly find the
associated evsel, add handler func + data to struct perf_evsel to avoid
using chains of if(strcmp(event_name)) and also to avoid all the linear
list searches via trace_event_find.
To demonstrate the technique convert 'perf sched' to it:
# perf sched record sleep 5m
And then:
Performance counter stats for '/tmp/oldperf sched lat':
646.929438 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,901 page-faults # 0.032 M/sec
1,290,144,450 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,606,158,439 instructions # 1.24 insns per cycle
339,088,395 branches # 524.151 M/sec
4,550,735 branch-misses # 1.34% of all branches
0.647524759 seconds time elapsed
Versus:
Performance counter stats for 'perf sched lat':
473.564691 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,903 page-faults # 0.044 M/sec
944,367,984 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,442,385,571 instructions # 1.53 insns per cycle
308,383,106 branches # 651.195 M/sec
4,481,784 branch-misses # 1.45% of all branches
0.474215751 seconds time elapsed
[root@emilia ~]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1kbzpl74lwi6lavpqke2u2p3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-28 19:57:40 +00:00
|
|
|
struct perf_sample;
|
2011-11-28 10:30:20 +00:00
|
|
|
struct perf_tool;
|
|
|
|
struct machine;
|
2015-03-03 15:37:54 +00:00
|
|
|
struct ordered_events;
|
2011-11-28 10:30:20 +00:00
|
|
|
|
|
|
|
typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct perf_evsel *evsel, struct machine *machine);
|
|
|
|
|
|
|
|
typedef int (*event_op)(struct perf_tool *tool, union perf_event *event,
|
|
|
|
struct perf_sample *sample, struct machine *machine);
|
|
|
|
|
2013-07-04 13:20:21 +00:00
|
|
|
typedef int (*event_attr_op)(struct perf_tool *tool,
|
|
|
|
union perf_event *event,
|
2011-11-28 10:30:20 +00:00
|
|
|
struct perf_evlist **pevlist);
|
|
|
|
|
|
|
|
typedef int (*event_op2)(struct perf_tool *tool, union perf_event *event,
|
|
|
|
struct perf_session *session);
|
|
|
|
|
2015-03-03 15:37:54 +00:00
|
|
|
typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event,
|
|
|
|
struct ordered_events *oe);
|
|
|
|
|
2015-04-09 15:53:43 +00:00
|
|
|
typedef s64 (*event_op3)(struct perf_tool *tool, union perf_event *event,
|
|
|
|
struct perf_session *session);
|
|
|
|
|
2011-11-28 10:30:20 +00:00
|
|
|
struct perf_tool {
|
|
|
|
event_sample sample,
|
|
|
|
read;
|
|
|
|
event_op mmap,
|
2013-08-21 10:10:25 +00:00
|
|
|
mmap2,
|
2011-11-28 10:30:20 +00:00
|
|
|
comm,
|
|
|
|
fork,
|
|
|
|
exit,
|
|
|
|
lost,
|
2015-05-10 19:13:15 +00:00
|
|
|
lost_samples,
|
2015-04-30 14:37:29 +00:00
|
|
|
aux,
|
2015-04-30 14:37:30 +00:00
|
|
|
itrace_start,
|
2015-07-21 09:44:03 +00:00
|
|
|
context_switch,
|
2011-11-28 10:30:20 +00:00
|
|
|
throttle,
|
|
|
|
unthrottle;
|
|
|
|
event_attr_op attr;
|
2015-10-25 14:51:36 +00:00
|
|
|
event_attr_op event_update;
|
2013-07-04 13:20:21 +00:00
|
|
|
event_op2 tracing_data;
|
2015-03-03 15:37:54 +00:00
|
|
|
event_oe finished_round;
|
|
|
|
event_op2 build_id,
|
2015-04-09 15:53:43 +00:00
|
|
|
id_index,
|
2015-04-09 15:53:47 +00:00
|
|
|
auxtrace_info,
|
2015-10-25 14:51:19 +00:00
|
|
|
auxtrace_error,
|
2015-10-25 14:51:23 +00:00
|
|
|
thread_map,
|
2015-10-25 14:51:27 +00:00
|
|
|
cpu_map,
|
2015-10-25 14:51:30 +00:00
|
|
|
stat_config,
|
2015-10-25 14:51:33 +00:00
|
|
|
stat,
|
|
|
|
stat_round;
|
2015-04-09 15:53:43 +00:00
|
|
|
event_op3 auxtrace;
|
2014-07-06 12:18:21 +00:00
|
|
|
bool ordered_events;
|
2011-11-28 10:30:20 +00:00
|
|
|
bool ordering_requires_timestamps;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __PERF_TOOL_H */
|