Commit dd96c46b authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools: Adding throttle event data struct support

Moving 'struct throttle_event' out of python code and making it global
as any other event.

There's no usage of throttling events in any perf commands so far
(besides python support), but we'll need this event data backup for
upcoming test.
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1378031796-17892-5-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b22d54b0
...@@ -61,6 +61,12 @@ struct read_event { ...@@ -61,6 +61,12 @@ struct read_event {
u64 id; u64 id;
}; };
struct throttle_event {
struct perf_event_header header;
u64 time;
u64 id;
u64 stream_id;
};
#define PERF_SAMPLE_MASK \ #define PERF_SAMPLE_MASK \
(PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
...@@ -178,6 +184,7 @@ union perf_event { ...@@ -178,6 +184,7 @@ union perf_event {
struct fork_event fork; struct fork_event fork;
struct lost_event lost; struct lost_event lost;
struct read_event read; struct read_event read;
struct throttle_event throttle;
struct sample_event sample; struct sample_event sample;
struct attr_event attr; struct attr_event attr;
struct event_type_event event_type; struct event_type_event event_type;
......
...@@ -33,13 +33,6 @@ int eprintf(int level, const char *fmt, ...) ...@@ -33,13 +33,6 @@ int eprintf(int level, const char *fmt, ...)
# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
#endif #endif
struct throttle_event {
struct perf_event_header header;
u64 time;
u64 id;
u64 stream_id;
};
PyMODINIT_FUNC initperf(void); PyMODINIT_FUNC initperf(void);
#define member_def(type, member, ptype, help) \ #define member_def(type, member, ptype, help) \
......
...@@ -397,6 +397,17 @@ static void perf_event__read_swap(union perf_event *event, bool sample_id_all) ...@@ -397,6 +397,17 @@ static void perf_event__read_swap(union perf_event *event, bool sample_id_all)
swap_sample_id_all(event, &event->read + 1); swap_sample_id_all(event, &event->read + 1);
} }
static void perf_event__throttle_swap(union perf_event *event,
bool sample_id_all)
{
event->throttle.time = bswap_64(event->throttle.time);
event->throttle.id = bswap_64(event->throttle.id);
event->throttle.stream_id = bswap_64(event->throttle.stream_id);
if (sample_id_all)
swap_sample_id_all(event, &event->throttle + 1);
}
static u8 revbyte(u8 b) static u8 revbyte(u8 b)
{ {
int rev = (b >> 4) | ((b & 0xf) << 4); int rev = (b >> 4) | ((b & 0xf) << 4);
...@@ -482,6 +493,8 @@ static perf_event__swap_op perf_event__swap_ops[] = { ...@@ -482,6 +493,8 @@ static perf_event__swap_op perf_event__swap_ops[] = {
[PERF_RECORD_EXIT] = perf_event__task_swap, [PERF_RECORD_EXIT] = perf_event__task_swap,
[PERF_RECORD_LOST] = perf_event__all64_swap, [PERF_RECORD_LOST] = perf_event__all64_swap,
[PERF_RECORD_READ] = perf_event__read_swap, [PERF_RECORD_READ] = perf_event__read_swap,
[PERF_RECORD_THROTTLE] = perf_event__throttle_swap,
[PERF_RECORD_UNTHROTTLE] = perf_event__throttle_swap,
[PERF_RECORD_SAMPLE] = perf_event__all64_swap, [PERF_RECORD_SAMPLE] = perf_event__all64_swap,
[PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
[PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment