perf tools: Remove event types data
v2 cover perf tools: Remove event types data
hi,
following up on the 'perf timechart' FIXME note and changing its tracepoint match not to use event types data.
Original RFC sent here:
http://marc.info/?l=linux-kernel&m=137344263513417&w=2
v2 changes:
- using tracepoints haler callbacks to get power data in timechart command (patch 2)
- separating enum removal of 'enum trace_flag_type'
(patch 1)
Again, timechart (and perf.data) tests look ok, but would appreciate another tester ;-).
It's reachable here:git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/et2
thanks,
jirka
--- tools/perf/builtin-inject.c | 7 ---- tools/perf/builtin-record.c | 13 -------- tools/perf/builtin-report.c | 1 - tools/perf/builtin-script.c | 1 - tools/perf/builtin-timechart.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- tools/perf/util/event.h | 2 +- tools/perf/util/header.c | 118 +------------------------------------------------------------------ tools/perf/util/header.h | 16 +--------- tools/perf/util/session.c | 11 ------- tools/perf/util/tool.h | 3 -- 10 files changed, 102 insertions(+), 246 deletions(-)
PATCH v2 1/5 perf tools: Add traceevent lib event-parse.h include to timechart
Adding traceevent lib event-parse.h include to timechart command and removing duplicated local 'enum trace_flag_type' definition.
--- tools/perf/builtin-timechart.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
tools/perf/builtin-timechart.c +2 -19
@@ -12,6 +12,8 @@* of the License. */ +#include <traceevent/event-parse.h> +#include "builtin.h" #include "util/util.h"
@@ -328,25 +330,6 @@ struct wakeup_entry {int success; }; -/* -* trace_flag_type is an enumeration that holds different -* states when a trace occurs. These are: -* IRQS_OFF - interrupts were disabled -* IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested -* HARDIRQ - inside an interrupt handler -* SOFTIRQ - inside a softirq handler -*/ -enum trace_flag_type { -TRACE_FLAG_IRQS_OFF =0x01 , -TRACE_FLAG_IRQS_NOSUPPORT =0x02 , -TRACE_FLAG_NEED_RESCHED =0x04 , -TRACE_FLAG_HARDIRQ =0x08 , -TRACE_FLAG_SOFTIRQ =0x10 , -}; - - -struct sched_switch {struct trace_entry te;char prev_comm[TASK_COMM_LEN ];
Signature · 1 line
1.7.11.7
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf timechart: Use traceevent lib event-parse.h include
perf timechart: Use traceevent lib event-parse.h include
Commit-ID: c85cffa5894fad8ad7c8051ccf7dd73a3a3f92b6 Gitweb: http://git.kernel.org/tip/c85cffa5894fad8ad7c8051ccf7dd73a3a3f92b6 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 11 Jul 2013 17:28:29 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 15 Jul 2013 16:09:07 -0300
perf timechart: Use traceevent lib event-parse.h include
Adding traceevent lib event-parse.h include to timechart command and removing duplicated local 'enum trace_flag_type' definition.
--- tools/perf/builtin-timechart.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
tools/perf/builtin-timechart.c +2 -19
@@ -12,6 +12,8 @@* of the License. */ +#include <traceevent/event-parse.h> +#include "builtin.h" #include "util/util.h"
@@ -328,25 +330,6 @@ struct wakeup_entry {int success; }; -/* -* trace_flag_type is an enumeration that holds different -* states when a trace occurs. These are: -* IRQS_OFF - interrupts were disabled -* IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested -* HARDIRQ - inside an interrupt handler -* SOFTIRQ - inside a softirq handler -*/ -enum trace_flag_type { -TRACE_FLAG_IRQS_OFF =0x01 , -TRACE_FLAG_IRQS_NOSUPPORT =0x02 , -TRACE_FLAG_NEED_RESCHED =0x04 , -TRACE_FLAG_HARDIRQ =0x08 , -TRACE_FLAG_SOFTIRQ =0x10 , -}; - - -struct sched_switch {struct trace_entry te;char prev_comm[TASK_COMM_LEN ];
PATCH v2 2/5 perf tools: Remove event types framework only user
In reply to Jiri OlsaThe only user of the event types data is 'perf timechart' command and uses this info to identify proper tracepoints based on its name.
Switching this code to use tracepoint callbacks handlers same as another commands like builtin-{kmem,lock,sched}.c using the perf_session__set_tracepoints_handlers function.
This way we get rid of the only event types user and can remove them completely in next patches.
--- tools/perf/builtin-timechart.c | 155 ++++++++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 58 deletions(-)
tools/perf/builtin-timechart.c +97 -58
@@ -21,6 +21,7 @@#include "util/color.h" #include <linux/list.h> #include "util/cache.h" +#include "util/evlist.h" #include "util/evsel.h" #include <linux/rbtree.h> #include "util/symbol.h"
@@ -462,6 +463,8 @@ static void sched_switch(int cpu, u64 timestamp, struct trace_entry *te) } } +typedef int (*tracepoint_handler )(struct perf_evsel *evsel, +struct perf_sample *sample); static int process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused,
@@ -469,8 +472,6 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, struct perf_evsel *evsel, struct machine *machine __maybe_unused) { - struct trace_entry *te; -if (evsel->attr.sample_type &PERF_SAMPLE_TIME ) {if (!first_time || first_time > sample->time) first_time = sample->time;
@@ -478,69 +479,90 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, last_time = sample->time; } - te = (void *)sample->raw_data; -if ((evsel->attr.sample_type &PERF_SAMPLE_RAW ) && sample->raw_size >0 ) { -char *event_str; -#ifdef SUPPORT_OLD_POWER_EVENTS -struct power_entry_old *peo; - peo = (void *)te; -#endif -/* -* FIXME: use evsel, its already mapped from id to perf_evsel, -* remove perf_header__find_event infrastructure bits. -* Mapping all these "power:cpu_idle" strings to the tracepoint -* ID and then just comparing against evsel->attr.config. -* -* e.g.: -* -* if (evsel->attr.config == power_cpu_idle_id) -*/ - event_str =perf_header__find_event (te->type); - -if (!event_str) -return 0 ; - -if (sample->cpu > numcpus) - numcpus = sample->cpu; - -if (strcmp (event_str,"power:cpu_idle" ) ==0 ) { -struct power_processor_entry *ppe = (void *)te; -if (ppe->state == (u32 )PWR_EVENT_EXIT ) -c_state_end (ppe->cpu_id, sample->time); -else -c_state_start (ppe->cpu_id, sample->time, - ppe->state); - } -else if (strcmp (event_str,"power:cpu_frequency" ) ==0 ) { -struct power_processor_entry *ppe = (void *)te; -p_state_change (ppe->cpu_id, sample->time, ppe->state); - } +if (sample->cpu > numcpus) + numcpus = sample->cpu; + +if (evsel->handler.func !=NULL ) { +tracepoint_handler f = evsel->handler.func; +return f (evsel, sample); + } + +return 0 ; +} + +static int +process_sample_cpu_idle (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_processor_entry *ppe = sample->raw_data; + +if (ppe->state == (u32 )PWR_EVENT_EXIT ) +c_state_end (ppe->cpu_id, sample->time); +else +c_state_start (ppe->cpu_id, sample->time, ppe->state); +return 0 ; +} + +static int +process_sample_cpu_frequency (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_processor_entry *ppe = sample->raw_data; + +p_state_change (ppe->cpu_id, sample->time, ppe->state); +return 0 ; +} -else if (strcmp (event_str,"sched:sched_wakeup" ) ==0 ) -sched_wakeup (sample->cpu, sample->time, sample->pid, te); +static int +process_sample_sched_wakeup (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct trace_entry *te = sample->raw_data; -else if (strcmp (event_str,"sched:sched_switch" ) ==0 ) -sched_switch (sample->cpu, sample->time, te); +sched_wakeup (sample->cpu, sample->time, sample->pid, te); +return 0 ; +} + +static int +process_sample_sched_switch (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct trace_entry *te = sample->raw_data; + +sched_switch (sample->cpu, sample->time, te); +return 0 ; +}#ifdef SUPPORT_OLD_POWER_EVENTS -if (use_old_power_events) { -if (strcmp (event_str,"power:power_start" ) ==0 ) -c_state_start (peo->cpu_id, sample->time, - peo->value); - -else if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (sample->cpu, sample->time); - -else if (strcmp (event_str, -"power:power_frequency" ) ==0 ) -p_state_change (peo->cpu_id, sample->time, - peo->value); - } -#endif - } +static int +process_sample_power_start (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_entry_old *peo = sample->raw_data; + +c_state_start (peo->cpu_id, sample->time, peo->value);return 0 ; } +static int +process_sample_power_end (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +c_state_end (sample->cpu, sample->time); +return 0 ; +} + +static int +process_sample_power_frequency (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_entry_old *peo = sample->raw_data; + +p_state_change (peo->cpu_id, sample->time, peo->value); +return 0 ; +} +#endif /* SUPPORT_OLD_POWER_EVENTS */ +/* * After the last sample we need to wrap up the current C/P state * and close out each CPU for these.
@@ -957,6 +979,17 @@ static int __cmd_timechart(const char *output_name) .sample = process_sample_event, .ordered_samples = true, }; +const struct perf_evsel_str_handler power_tracepoints[] = { + {"power:cpu_idle" , process_sample_cpu_idle }, + {"power:cpu_frequency" , process_sample_cpu_frequency }, + {"sched:sched_wakeup" , process_sample_sched_wakeup }, + {"sched:sched_switch" , process_sample_sched_switch }, +#ifdef SUPPORT_OLD_POWER_EVENTS + {"power:power_start" , process_sample_power_start }, + {"power:power_end" , process_sample_power_end }, + {"power:power_frequency" , process_sample_power_frequency }, +#endif + };struct perf_session *session =perf_session__new (input_name,O_RDONLY ,0 , false, &perf_timechart);int ret = -EINVAL ;
@@ -967,6 +1000,12 @@ static int __cmd_timechart(const char *output_name)if (!perf_session__has_traces (session,"timechart record" )) goto out_delete; +if (perf_session__set_tracepoints_handlers (session, + power_tracepoints)) { +pr_err ("Initializing session tracepoint handlers failed\n" ); + goto out_delete; + } + ret =perf_session__process_events (session, &perf_timechart);if (ret) goto out_delete;
Signature · 1 line
1.7.11.7
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf timechart: Remove event types framework only user
perf timechart: Remove event types framework only user
Commit-ID: 5936678e7da5f8d2944a2ad45d66c88b4a7ccb67 Gitweb: http://git.kernel.org/tip/5936678e7da5f8d2944a2ad45d66c88b4a7ccb67 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 11 Jul 2013 17:28:30 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 15 Jul 2013 16:14:47 -0300
perf timechart: Remove event types framework only user
The only user of the event types data is 'perf timechart' command and uses this info to identify proper tracepoints based on its name.
Switching this code to use tracepoint callbacks handlers same as another commands like builtin-{kmem,lock,sched}.c using the perf_session__set_tracepoints_handlers function.
This way we get rid of the only event types user and can remove them completely in next patches.
--- tools/perf/builtin-timechart.c | 155 ++++++++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 58 deletions(-)
tools/perf/builtin-timechart.c +97 -58
@@ -21,6 +21,7 @@#include "util/color.h" #include <linux/list.h> #include "util/cache.h" +#include "util/evlist.h" #include "util/evsel.h" #include <linux/rbtree.h> #include "util/symbol.h"
@@ -462,6 +463,8 @@ static void sched_switch(int cpu, u64 timestamp, struct trace_entry *te) } } +typedef int (*tracepoint_handler )(struct perf_evsel *evsel, +struct perf_sample *sample); static int process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused,
@@ -469,8 +472,6 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, struct perf_evsel *evsel, struct machine *machine __maybe_unused) { - struct trace_entry *te; -if (evsel->attr.sample_type &PERF_SAMPLE_TIME ) {if (!first_time || first_time > sample->time) first_time = sample->time;
@@ -478,69 +479,90 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, last_time = sample->time; } - te = (void *)sample->raw_data; -if ((evsel->attr.sample_type &PERF_SAMPLE_RAW ) && sample->raw_size >0 ) { -char *event_str; -#ifdef SUPPORT_OLD_POWER_EVENTS -struct power_entry_old *peo; - peo = (void *)te; -#endif -/* -* FIXME: use evsel, its already mapped from id to perf_evsel, -* remove perf_header__find_event infrastructure bits. -* Mapping all these "power:cpu_idle" strings to the tracepoint -* ID and then just comparing against evsel->attr.config. -* -* e.g.: -* -* if (evsel->attr.config == power_cpu_idle_id) -*/ - event_str =perf_header__find_event (te->type); - -if (!event_str) -return 0 ; - -if (sample->cpu > numcpus) - numcpus = sample->cpu; - -if (strcmp (event_str,"power:cpu_idle" ) ==0 ) { -struct power_processor_entry *ppe = (void *)te; -if (ppe->state == (u32 )PWR_EVENT_EXIT ) -c_state_end (ppe->cpu_id, sample->time); -else -c_state_start (ppe->cpu_id, sample->time, - ppe->state); - } -else if (strcmp (event_str,"power:cpu_frequency" ) ==0 ) { -struct power_processor_entry *ppe = (void *)te; -p_state_change (ppe->cpu_id, sample->time, ppe->state); - } +if (sample->cpu > numcpus) + numcpus = sample->cpu; + +if (evsel->handler.func !=NULL ) { +tracepoint_handler f = evsel->handler.func; +return f (evsel, sample); + } + +return 0 ; +} + +static int +process_sample_cpu_idle (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_processor_entry *ppe = sample->raw_data; + +if (ppe->state == (u32 )PWR_EVENT_EXIT ) +c_state_end (ppe->cpu_id, sample->time); +else +c_state_start (ppe->cpu_id, sample->time, ppe->state); +return 0 ; +} + +static int +process_sample_cpu_frequency (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_processor_entry *ppe = sample->raw_data; + +p_state_change (ppe->cpu_id, sample->time, ppe->state); +return 0 ; +} -else if (strcmp (event_str,"sched:sched_wakeup" ) ==0 ) -sched_wakeup (sample->cpu, sample->time, sample->pid, te); +static int +process_sample_sched_wakeup (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct trace_entry *te = sample->raw_data; -else if (strcmp (event_str,"sched:sched_switch" ) ==0 ) -sched_switch (sample->cpu, sample->time, te); +sched_wakeup (sample->cpu, sample->time, sample->pid, te); +return 0 ; +} + +static int +process_sample_sched_switch (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct trace_entry *te = sample->raw_data; + +sched_switch (sample->cpu, sample->time, te); +return 0 ; +}#ifdef SUPPORT_OLD_POWER_EVENTS -if (use_old_power_events) { -if (strcmp (event_str,"power:power_start" ) ==0 ) -c_state_start (peo->cpu_id, sample->time, - peo->value); - -else if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (sample->cpu, sample->time); - -else if (strcmp (event_str, -"power:power_frequency" ) ==0 ) -p_state_change (peo->cpu_id, sample->time, - peo->value); - } -#endif - } +static int +process_sample_power_start (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_entry_old *peo = sample->raw_data; + +c_state_start (peo->cpu_id, sample->time, peo->value);return 0 ; } +static int +process_sample_power_end (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +c_state_end (sample->cpu, sample->time); +return 0 ; +} + +static int +process_sample_power_frequency (struct perf_evsel *evsel__maybe_unused , +struct perf_sample *sample) +{ +struct power_entry_old *peo = sample->raw_data; + +p_state_change (peo->cpu_id, sample->time, peo->value); +return 0 ; +} +#endif /* SUPPORT_OLD_POWER_EVENTS */ +/* * After the last sample we need to wrap up the current C/P state * and close out each CPU for these.
@@ -957,6 +979,17 @@ static int __cmd_timechart(const char *output_name) .sample = process_sample_event, .ordered_samples = true, }; +const struct perf_evsel_str_handler power_tracepoints[] = { + {"power:cpu_idle" , process_sample_cpu_idle }, + {"power:cpu_frequency" , process_sample_cpu_frequency }, + {"sched:sched_wakeup" , process_sample_sched_wakeup }, + {"sched:sched_switch" , process_sample_sched_switch }, +#ifdef SUPPORT_OLD_POWER_EVENTS + {"power:power_start" , process_sample_power_start }, + {"power:power_end" , process_sample_power_end }, + {"power:power_frequency" , process_sample_power_frequency }, +#endif + };struct perf_session *session =perf_session__new (input_name,O_RDONLY ,0 , false, &perf_timechart);int ret = -EINVAL ;
@@ -967,6 +1000,12 @@ static int __cmd_timechart(const char *output_name)if (!perf_session__has_traces (session,"timechart record" )) goto out_delete; +if (perf_session__set_tracepoints_handlers (session, + power_tracepoints)) { +pr_err ("Initializing session tracepoint handlers failed\n" ); + goto out_delete; + } + ret =perf_session__process_events (session, &perf_timechart);if (ret) goto out_delete;
PATCH v2 3/5 perf tools: Remove event types from perf data file
In reply to Jiri OlsaRemoving event types data storing/reading to/from perf data file as it's no longer needed. The only user of this data 'perf timechart' was switched to use tracepoints handler callbacks.
The event_types offset and size stay in the perf data file header but are ignored from now on.
--- tools/perf/util/header.c | 28 +--------------------------- tools/perf/util/header.h | 3 +-- 2 files changed, 2 insertions(+), 29 deletions(-)
tools/perf/util/header.c +1 -27
@@ -2334,16 +2334,6 @@ int perf_session__write_header(struct perf_session *session, } } - header->event_offset =lseek (fd,0 ,SEEK_CUR ); - header->event_size = trace_event_count *sizeof (struct perf_trace_event_type ); -if (trace_events) { - err =do_write (fd, trace_events, header->event_size); -if (err <0 ) { -pr_debug ("failed to write perf header events\n" ); -return err; - } - } - header->data_offset =lseek (fd,0 ,SEEK_CUR );if (at_exit) {
@@ -2364,10 +2354,7 @@ int perf_session__write_header(struct perf_session *session, .offset = header->data_offset, .size = header->data_size, }, - .event_types = { - .offset = header->event_offset, - .size = header->event_size, - }, +/* event_types is ignored, store zeros */ };memcpy (&f_header.adds_features, &header->adds_features,sizeof (header->adds_features));
@@ -2614,8 +2601,6 @@ int perf_file_header__read(struct perf_file_header *header,memcpy (&ph->adds_features, &header->adds_features,sizeof (ph->adds_features)); - ph->event_offset = header->event_types.offset; - ph->event_size = header->event_types.size; ph->data_offset = header->data.offset; ph->data_size = header->data.size;return 0 ;
@@ -2839,17 +2824,6 @@ int perf_session__read_header(struct perf_session *session, int fd) symbol_conf.nr_events = nr_attrs; -if (f_header.event_types.size) { -lseek (fd, f_header.event_types.offset,SEEK_SET ); - trace_events =malloc (f_header.event_types.size); -if (trace_events ==NULL ) -return -ENOMEM ; -if (perf_header__getbuffer64 (header, fd, trace_events, - f_header.event_types.size)) - goto out_errno; - trace_event_count = f_header.event_types.size /sizeof (struct perf_trace_event_type ); - } -perf_header__process_sections (header, fd, &session->pevent, perf_file_section__process);
tools/perf/util/header.h +1 -2
@@ -45,6 +45,7 @@ struct perf_file_header {u64 attr_size;struct perf_file_section attrs;struct perf_file_section data; +/* event_types is ignored */ struct perf_file_section event_types;DECLARE_BITMAP (adds_features,HEADER_FEAT_BITS ); };
@@ -88,8 +89,6 @@ struct perf_header {s64 attr_offset;u64 data_offset;u64 data_size; -u64 event_offset; -u64 event_size;DECLARE_BITMAP (adds_features,HEADER_FEAT_BITS );struct perf_session_env env; };
Signature · 1 line
1.7.11.7
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Remove event types from perf data file
perf tools: Remove event types from perf data file
Commit-ID: 44b3c57802b7557d0e2d8c3bd39bce942e9324cc Gitweb: http://git.kernel.org/tip/44b3c57802b7557d0e2d8c3bd39bce942e9324cc Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 11 Jul 2013 17:28:31 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 15 Jul 2013 16:28:10 -0300
perf tools: Remove event types from perf data file
Removing event types data storing/reading to/from perf data file as it's no longer needed. The only user of this data 'perf timechart' was switched to use tracepoints handler callbacks.
The event_types offset and size stay in the perf data file header but are ignored from now on.
--- tools/perf/util/header.c | 28 +--------------------------- tools/perf/util/header.h | 3 +-- 2 files changed, 2 insertions(+), 29 deletions(-)
tools/perf/util/header.c +1 -27
@@ -2334,16 +2334,6 @@ int perf_session__write_header(struct perf_session *session, } } - header->event_offset =lseek (fd,0 ,SEEK_CUR ); - header->event_size = trace_event_count *sizeof (struct perf_trace_event_type ); -if (trace_events) { - err =do_write (fd, trace_events, header->event_size); -if (err <0 ) { -pr_debug ("failed to write perf header events\n" ); -return err; - } - } - header->data_offset =lseek (fd,0 ,SEEK_CUR );if (at_exit) {
@@ -2364,10 +2354,7 @@ int perf_session__write_header(struct perf_session *session, .offset = header->data_offset, .size = header->data_size, }, - .event_types = { - .offset = header->event_offset, - .size = header->event_size, - }, +/* event_types is ignored, store zeros */ };memcpy (&f_header.adds_features, &header->adds_features,sizeof (header->adds_features));
@@ -2614,8 +2601,6 @@ int perf_file_header__read(struct perf_file_header *header,memcpy (&ph->adds_features, &header->adds_features,sizeof (ph->adds_features)); - ph->event_offset = header->event_types.offset; - ph->event_size = header->event_types.size; ph->data_offset = header->data.offset; ph->data_size = header->data.size;return 0 ;
@@ -2839,17 +2824,6 @@ int perf_session__read_header(struct perf_session *session, int fd) symbol_conf.nr_events = nr_attrs; -if (f_header.event_types.size) { -lseek (fd, f_header.event_types.offset,SEEK_SET ); - trace_events =malloc (f_header.event_types.size); -if (trace_events ==NULL ) -return -ENOMEM ; -if (perf_header__getbuffer64 (header, fd, trace_events, - f_header.event_types.size)) - goto out_errno; - trace_event_count = f_header.event_types.size /sizeof (struct perf_trace_event_type ); - } -perf_header__process_sections (header, fd, &session->pevent, perf_file_section__process);
tools/perf/util/header.h +1 -2
@@ -45,6 +45,7 @@ struct perf_file_header {u64 attr_size;struct perf_file_section attrs;struct perf_file_section data; +/* event_types is ignored */ struct perf_file_section event_types;DECLARE_BITMAP (adds_features,HEADER_FEAT_BITS ); };
@@ -88,8 +89,6 @@ struct perf_header {s64 attr_offset;u64 data_offset;u64 data_size; -u64 event_offset; -u64 event_size;DECLARE_BITMAP (adds_features,HEADER_FEAT_BITS );struct perf_session_env env; };
PATCH v2 4/5 perf tools: Remove event types pushing from record command
In reply to Jiri OlsaRemoving event types data pushing from record command. It's no longer needed, because this data is ignored.
--- tools/perf/builtin-record.c | 6 ------ 1 file changed, 6 deletions(-)
tools/perf/builtin-record.c +0 -6
@@ -904,7 +904,6 @@ const struct option record_options[] = {int cmd_record (int argc,const char **argv,const char *prefix__maybe_unused ) {int err = -ENOMEM ; -struct perf_evsel *pos;struct perf_evlist *evsel_list;struct perf_record *rec = &record;char errbuf[BUFSIZ ];
@@ -968,11 +967,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (perf_evlist__create_maps (evsel_list, &rec->opts.target) <0 )usage_with_options (record_usage, record_options); -list_for_each_entry (pos, &evsel_list->entries, node) { -if (perf_header__push_event (pos->attr.config,perf_evsel__name (pos))) - goto out_free_fd; - } -if (rec->opts.user_interval !=ULLONG_MAX ) rec->opts.default_interval = rec->opts.user_interval;if (rec->opts.user_freq !=UINT_MAX )
Signature · 1 line
1.7.11.7
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf record: Remove event types pushing
perf record: Remove event types pushing
Commit-ID: 30d350795e8e57c17eabaab454932889f1ae8159 Gitweb: http://git.kernel.org/tip/30d350795e8e57c17eabaab454932889f1ae8159 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 11 Jul 2013 17:28:32 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 15 Jul 2013 16:28:17 -0300
perf record: Remove event types pushing
Removing event types data pushing from record command. It's no longer needed, because this data is ignored.
--- tools/perf/builtin-record.c | 6 ------ 1 file changed, 6 deletions(-)
tools/perf/builtin-record.c +0 -6
@@ -904,7 +904,6 @@ const struct option record_options[] = {int cmd_record (int argc,const char **argv,const char *prefix__maybe_unused ) {int err = -ENOMEM ; -struct perf_evsel *pos;struct perf_evlist *evsel_list;struct perf_record *rec = &record;char errbuf[BUFSIZ ];
@@ -968,11 +967,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (perf_evlist__create_maps (evsel_list, &rec->opts.target) <0 )usage_with_options (record_usage, record_options); -list_for_each_entry (pos, &evsel_list->entries, node) { -if (perf_header__push_event (pos->attr.config,perf_evsel__name (pos))) - goto out_free_fd; - } -if (rec->opts.user_interval !=ULLONG_MAX ) rec->opts.default_interval = rec->opts.user_interval;if (rec->opts.user_freq !=UINT_MAX )
PATCH v2 5/5 perf tools: Remove event types framework completely
In reply to Jiri OlsaRemoving event types framework completely. The only remainder (apart from few comments) is following enum:
enum perf_user_event_type {
...
PERF_RECORD_HEADER_EVENT_TYPE = 65, /* depreceated */
...
}It's kept as depreciated, resulting in error when processed in perf_session__process_user_event function.
--- tools/perf/builtin-inject.c | 7 ---- tools/perf/builtin-record.c | 7 ---- tools/perf/builtin-report.c | 1 - tools/perf/builtin-script.c | 1 - tools/perf/util/event.h | 2 +- tools/perf/util/header.c | 90 --------------------------------------------- tools/perf/util/header.h | 13 ------- tools/perf/util/session.c | 11 ------ tools/perf/util/tool.h | 3 -- 9 files changed, 1 insertion(+), 134 deletions(-)
tools/perf/builtin-inject.c +0 -7
@@ -67,12 +67,6 @@ static int perf_event__repipe_op2_synth(struct perf_tool *tool,return perf_event__repipe_synth (tool, event); } -static int perf_event__repipe_event_type_synth (struct perf_tool *tool, -union perf_event *event) -{ -return perf_event__repipe_synth (tool, event); -} -static int perf_event__repipe_attr (struct perf_tool *tool,union perf_event *event,struct perf_evlist **pevlist)
@@ -402,7 +396,6 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) .throttle = perf_event__repipe, .unthrottle = perf_event__repipe, .attr = perf_event__repipe_attr, - .event_type = perf_event__repipe_event_type_synth, .tracing_data = perf_event__repipe_op2_synth, .finished_round = perf_event__repipe_op2_synth, .build_id = perf_event__repipe_op2_synth,
tools/perf/builtin-record.c +0 -7
@@ -474,13 +474,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) goto out_delete_session; } - err =perf_event__synthesize_event_types (tool, process_synthesized_event, - machine); -if (err <0 ) { -pr_err ("Couldn't synthesize event_types.\n" ); - goto out_delete_session; - } -if (have_tracepoints (&evsel_list->entries)) {/* * FIXME err <= 0 here actually means that
tools/perf/builtin-report.c +0 -1
@@ -741,7 +741,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) .lost = perf_event__process_lost, .read = process_read_event, .attr = perf_event__process_attr, - .event_type = perf_event__process_event_type, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
tools/perf/builtin-script.c +0 -1
@@ -524,7 +524,6 @@ static struct perf_tool perf_script = { .exit = perf_event__process_exit, .fork = perf_event__process_fork, .attr = perf_event__process_attr, - .event_type = perf_event__process_event_type, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
tools/perf/util/event.h +1 -1
@@ -116,7 +116,7 @@ struct build_id_event {enum perf_user_event_type {/* above any possible kernel type */ PERF_RECORD_USER_TYPE_START =64 ,PERF_RECORD_HEADER_ATTR =64 , -PERF_RECORD_HEADER_EVENT_TYPE =65 , +PERF_RECORD_HEADER_EVENT_TYPE =65 ,/* depreceated */ PERF_RECORD_HEADER_TRACING_DATA =66 ,PERF_RECORD_HEADER_BUILD_ID =67 ,PERF_RECORD_FINISHED_ROUND =68 ,
tools/perf/util/header.c +0 -90
105 lines not on this page · raw message
tools/perf/util/header.h +0 -13
@@ -102,9 +102,6 @@ int perf_session__write_header(struct perf_session *session, int fd, bool at_exit);int perf_header__write_pipe (int fd); -int perf_header__push_event (u64 id,const char *name); -char *perf_header__find_event (u64 id); -void perf_header__set_feat (struct perf_header *header,int feat);void perf_header__clear_feat (struct perf_header *header,int feat);bool perf_header__has_feat (const struct perf_header *header,int feat);
@@ -132,16 +129,6 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,int perf_event__process_attr (struct perf_tool *tool,union perf_event *event,struct perf_evlist **pevlist); -int perf_event__synthesize_event_type (struct perf_tool *tool, -u64 event_id,char *name, -perf_event__handler_t process, -struct machine *machine); -int perf_event__synthesize_event_types (struct perf_tool *tool, -perf_event__handler_t process, -struct machine *machine); -int perf_event__process_event_type (struct perf_tool *tool, -union perf_event *event); -int perf_event__synthesize_tracing_data (struct perf_tool *tool,int fd,struct perf_evlist *evlist,perf_event__handler_t process);
tools/perf/util/session.c +0 -11
@@ -241,13 +241,6 @@ static int process_finished_round_stub(struct perf_tool *tool __maybe_unused,return 0 ; } -static int process_event_type_stub (struct perf_tool *tool__maybe_unused , -union perf_event *event__maybe_unused ) -{ -dump_printf (": unhandled!\n" ); -return 0 ; -} -static int process_finished_round (struct perf_tool *tool,union perf_event *event,struct perf_session *session);
@@ -274,8 +267,6 @@ static void perf_tool__fill_defaults(struct perf_tool *tool) tool->unthrottle = process_event_stub;if (tool->attr ==NULL ) tool->attr = process_event_synth_attr_stub; -if (tool->event_type ==NULL ) - tool->event_type = process_event_type_stub;if (tool->tracing_data ==NULL ) tool->tracing_data = process_event_synth_tracing_data_stub;if (tool->build_id ==NULL )
@@ -928,8 +919,6 @@ static int perf_session__process_user_event(struct perf_session *session, unionif (err ==0 )perf_session__set_id_hdr_size (session);return err; -case PERF_RECORD_HEADER_EVENT_TYPE : -return tool->event_type (tool, event);case PERF_RECORD_HEADER_TRACING_DATA :/* setup for reading amidst mmap */ lseek (session->fd, file_offset,SEEK_SET );
tools/perf/util/tool.h +0 -3
@@ -22,8 +22,6 @@ typedef int (*event_attr_op)(struct perf_tool *tool,union perf_event *event, struct perf_evlist **pevlist); -typedef int (*event_simple_op )(struct perf_tool *tool,union perf_event *event); -typedef int (*event_op2 )(struct perf_tool *tool,union perf_event *event,struct perf_session *session);
@@ -39,7 +37,6 @@ struct perf_tool { unthrottle;event_attr_op attr;event_op2 tracing_data; -event_simple_op event_type;event_op2 finished_round, build_id;bool ordered_samples;
Signature · 1 line
1.7.11.7
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Remove event types framework completely
perf tools: Remove event types framework completely
Commit-ID: 6065210db932fd183cbc8bc77558fee275360e71 Gitweb: http://git.kernel.org/tip/6065210db932fd183cbc8bc77558fee275360e71 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 11 Jul 2013 17:28:33 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 15 Jul 2013 16:28:22 -0300
perf tools: Remove event types framework completely
Removing event types framework completely. The only remainder (apart from few comments) is following enum:
enum perf_user_event_type {
...
PERF_RECORD_HEADER_EVENT_TYPE = 65, /* deprecated */
...
}It's kept as deprecated, resulting in error when processed in perf_session__process_user_event function.
--- tools/perf/builtin-inject.c | 7 ---- tools/perf/builtin-record.c | 7 ---- tools/perf/builtin-report.c | 1 - tools/perf/builtin-script.c | 1 - tools/perf/util/event.h | 2 +- tools/perf/util/header.c | 90 --------------------------------------------- tools/perf/util/header.h | 13 ------- tools/perf/util/session.c | 11 ------ tools/perf/util/tool.h | 3 -- 9 files changed, 1 insertion(+), 134 deletions(-)
tools/perf/builtin-inject.c +0 -7
@@ -67,12 +67,6 @@ static int perf_event__repipe_op2_synth(struct perf_tool *tool,return perf_event__repipe_synth (tool, event); } -static int perf_event__repipe_event_type_synth (struct perf_tool *tool, -union perf_event *event) -{ -return perf_event__repipe_synth (tool, event); -} -static int perf_event__repipe_attr (struct perf_tool *tool,union perf_event *event,struct perf_evlist **pevlist)
@@ -402,7 +396,6 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) .throttle = perf_event__repipe, .unthrottle = perf_event__repipe, .attr = perf_event__repipe_attr, - .event_type = perf_event__repipe_event_type_synth, .tracing_data = perf_event__repipe_op2_synth, .finished_round = perf_event__repipe_op2_synth, .build_id = perf_event__repipe_op2_synth,
tools/perf/builtin-record.c +0 -7
@@ -474,13 +474,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) goto out_delete_session; } - err =perf_event__synthesize_event_types (tool, process_synthesized_event, - machine); -if (err <0 ) { -pr_err ("Couldn't synthesize event_types.\n" ); - goto out_delete_session; - } -if (have_tracepoints (&evsel_list->entries)) {/* * FIXME err <= 0 here actually means that
tools/perf/builtin-report.c +0 -1
@@ -741,7 +741,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) .lost = perf_event__process_lost, .read = process_read_event, .attr = perf_event__process_attr, - .event_type = perf_event__process_event_type, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
tools/perf/builtin-script.c +0 -1
@@ -524,7 +524,6 @@ static struct perf_tool perf_script = { .exit = perf_event__process_exit, .fork = perf_event__process_fork, .attr = perf_event__process_attr, - .event_type = perf_event__process_event_type, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
tools/perf/util/event.h +1 -1
@@ -116,7 +116,7 @@ struct build_id_event {enum perf_user_event_type {/* above any possible kernel type */ PERF_RECORD_USER_TYPE_START =64 ,PERF_RECORD_HEADER_ATTR =64 , -PERF_RECORD_HEADER_EVENT_TYPE =65 , +PERF_RECORD_HEADER_EVENT_TYPE =65 ,/* depreceated */ PERF_RECORD_HEADER_TRACING_DATA =66 ,PERF_RECORD_HEADER_BUILD_ID =67 ,PERF_RECORD_FINISHED_ROUND =68 ,
tools/perf/util/header.c +0 -90
105 lines not on this page · raw message
tools/perf/util/header.h +0 -13
@@ -102,9 +102,6 @@ int perf_session__write_header(struct perf_session *session, int fd, bool at_exit);int perf_header__write_pipe (int fd); -int perf_header__push_event (u64 id,const char *name); -char *perf_header__find_event (u64 id); -void perf_header__set_feat (struct perf_header *header,int feat);void perf_header__clear_feat (struct perf_header *header,int feat);bool perf_header__has_feat (const struct perf_header *header,int feat);
@@ -132,16 +129,6 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,int perf_event__process_attr (struct perf_tool *tool,union perf_event *event,struct perf_evlist **pevlist); -int perf_event__synthesize_event_type (struct perf_tool *tool, -u64 event_id,char *name, -perf_event__handler_t process, -struct machine *machine); -int perf_event__synthesize_event_types (struct perf_tool *tool, -perf_event__handler_t process, -struct machine *machine); -int perf_event__process_event_type (struct perf_tool *tool, -union perf_event *event); -int perf_event__synthesize_tracing_data (struct perf_tool *tool,int fd,struct perf_evlist *evlist,perf_event__handler_t process);
tools/perf/util/session.c +0 -11
@@ -241,13 +241,6 @@ static int process_finished_round_stub(struct perf_tool *tool __maybe_unused,return 0 ; } -static int process_event_type_stub (struct perf_tool *tool__maybe_unused , -union perf_event *event__maybe_unused ) -{ -dump_printf (": unhandled!\n" ); -return 0 ; -} -static int process_finished_round (struct perf_tool *tool,union perf_event *event,struct perf_session *session);
@@ -274,8 +267,6 @@ static void perf_tool__fill_defaults(struct perf_tool *tool) tool->unthrottle = process_event_stub;if (tool->attr ==NULL ) tool->attr = process_event_synth_attr_stub; -if (tool->event_type ==NULL ) - tool->event_type = process_event_type_stub;if (tool->tracing_data ==NULL ) tool->tracing_data = process_event_synth_tracing_data_stub;if (tool->build_id ==NULL )
@@ -928,8 +919,6 @@ static int perf_session__process_user_event(struct perf_session *session, unionif (err ==0 )perf_session__set_id_hdr_size (session);return err; -case PERF_RECORD_HEADER_EVENT_TYPE : -return tool->event_type (tool, event);case PERF_RECORD_HEADER_TRACING_DATA :/* setup for reading amidst mmap */ lseek (session->fd, file_offset,SEEK_SET );
tools/perf/util/tool.h +0 -3
@@ -22,8 +22,6 @@ typedef int (*event_attr_op)(struct perf_tool *tool,union perf_event *event, struct perf_evlist **pevlist); -typedef int (*event_simple_op )(struct perf_tool *tool,union perf_event *event); -typedef int (*event_op2 )(struct perf_tool *tool,union perf_event *event,struct perf_session *session);
@@ -39,7 +37,6 @@ struct perf_tool { unthrottle;event_attr_op attr;event_op2 tracing_data; -event_simple_op event_type;event_op2 finished_round, build_id;bool ordered_samples;
Hi Jiri,
Quoted 11 lines · Jiri Olsa
hi,
following up on the 'perf timechart' FIXME note and changing its tracepoint match not to use event types data.Original RFC sent here:
http://marc.info/?l=linux-kernel&m=137344263513417&w=2v2 changes:
- using tracepoints haler callbacks to get power data in timechart command (patch 2)
- separating enum removal of 'enumtrace_flag_type'
Quoted 8 lines
(patch 1)Again, timechart (and perf.data) tests look ok, but would appreciate another tester ;-).
It's reachable here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/et2
For the whole patchset:
Thanks,
Namhyung
Arnaldo Carvalho de Melo
AppliedEm Fri, Jul 12, 2013 at 05:53:35PM +0900, Namhyung Kim escreveu:
Quoted 3 lines
For the whole patchset:
Acked-by Namhyung Kim <[email protected]>
Thanks, applied.
- Arnaldo