TPEBS counting mode support
v4 cover TPEBS counting mode support
From: Weilin Wang <[email protected]>
Changes in v4:
- Remove uncessary debug print and update code and comments for better readability and quality [Namhyung]
- Update mtl metric json file with consistent TmaL1 and TopdownL1 metricgroup
v3: https://lore.kernel.org/all/[email protected]/
Weilin Wang (6):
perf stat: Parse and find tpebs events when parsing metrics to prepare
for perf record sampling
perf stat: Fork and launch perf record when perf stat needs to get
retire latency value for a metric.
perf stat: Add retire latency values into the expr_parse_ctx to
prepare for final metric calculation
perf stat: Create another thread for sample data processing perf stat: Add retire latency print functions to print out at the very
end of print out
perf vendor events intel: Add MTL metric json files
tools/perf/builtin-stat.c | 211 +- .../arch/x86/meteorlake/metricgroups.json | 127 + .../arch/x86/meteorlake/mtl-metrics.json | 2551 +++++++++++++++++ tools/perf/util/data.c | 4 + tools/perf/util/data.h | 1 + tools/perf/util/metricgroup.c | 88 +- tools/perf/util/metricgroup.h | 23 +- tools/perf/util/stat-display.c | 65 + tools/perf/util/stat-shadow.c | 19 + tools/perf/util/stat.h | 4 + 10 files changed, 3074 insertions(+), 19 deletions(-) create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/metricgroups.json create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/mtl-metrics.json
--
2.43.0
RFC PATCH v4 1/6 perf stat: Parse and find tpebs events when parsing metrics to prepare for perf record sampling
From: Weilin Wang <[email protected]>
Metrics that use tpebs values would use the :retire_latency keyword in formulas. We put all these events into a list and pass the list to perf record to collect their retire latency value.
--- tools/perf/builtin-stat.c | 38 +++++++++++++-- tools/perf/util/metricgroup.c | 88 +++++++++++++++++++++++++++++------ tools/perf/util/metricgroup.h | 10 +++- tools/perf/util/stat.h | 2 + 4 files changed, 119 insertions(+), 19 deletions(-)
tools/perf/builtin-stat.c +33 -5
@@ -162,6 +162,7 @@ static struct perf_stat_config stat_config = { .ctl_fd = -1, .ctl_fd_ack = -1, .iostat_run = false, + .tpebs_events = LIST_HEAD_INIT(stat_config.tpebs_events), };static bool cpus_map_matched (struct evsel *a,struct evsel *b)
@@ -686,6 +687,12 @@ static enum counter_recovery stat_handle_error(struct evsel *counter)return COUNTER_FATAL ; } +static int __run_perf_record (void ) +{ +pr_debug ("Prepare perf record for retire_latency\n" ); +return 0 ; +} +static int __run_perf_stat (int argc,const char **argv,int run_idx) {int interval = stat_config.interval;
@@ -703,6 +710,16 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)int err;bool second_pass = false; +/* Prepare perf record for sampling event retire_latency before fork and +* prepare workload */ +if (stat_config.tpebs_event_size >0 ) { +int ret; + + ret =__run_perf_record (); +if (ret) +return ret; + } +if (forks) {if (evlist__prepare_workload (evsel_list, &target, argv, is_pipe, workload_exec_failed_signal) <0 ) {perror ("failed to prepare workload" );
@@ -2106,7 +2123,9 @@ static int add_default_attributes(void) stat_config.metric_no_threshold, stat_config.user_requested_cpu_list, stat_config.system_wide, - &stat_config.metric_events); + &stat_config.metric_events, + &stat_config.tpebs_events, + &stat_config.tpebs_event_size); }if (smi_cost) {
@@ -2139,7 +2158,9 @@ static int add_default_attributes(void) stat_config.metric_no_threshold, stat_config.user_requested_cpu_list, stat_config.system_wide, - &stat_config.metric_events); + &stat_config.metric_events, + &stat_config.tpebs_events, + &stat_config.tpebs_event_size); }if (topdown_run) {
@@ -2173,7 +2194,9 @@ static int add_default_attributes(void)/*metric_no_threshold=*/ true, stat_config.user_requested_cpu_list, stat_config.system_wide, - &stat_config.metric_events) < 0) + &stat_config.metric_events, + &stat_config.tpebs_events, + &stat_config.tpebs_event_size) < 0) return -1; }
@@ -2214,7 +2237,9 @@ static int add_default_attributes(void)/*metric_no_threshold=*/ true, stat_config.user_requested_cpu_list, stat_config.system_wide, - &stat_config.metric_events) < 0) + &stat_config.metric_events, +/*&stat_config.tpebs_events=*/ NULL , + /*stat_config.tpebs_event_size=*/0) < 0) return -1;evlist__for_each_entry (metric_evlist, metric_evsel) {
@@ -2736,6 +2761,7 @@ int cmd_stat(int argc, const char **argv) } } +/* * Metric parsing needs to be delayed as metrics may optimize events * knowing the target is system-wide.
@@ -2748,7 +2774,9 @@ int cmd_stat(int argc, const char **argv) stat_config.metric_no_threshold, stat_config.user_requested_cpu_list, stat_config.system_wide, - &stat_config.metric_events); + &stat_config.metric_events, + &stat_config.tpebs_events, + &stat_config.tpebs_event_size);zfree (&metrics);if (ret) {
tools/perf/util/metricgroup.c +75 -13
173 lines not on this page · raw message
tools/perf/util/metricgroup.h +9 -1
@@ -66,6 +66,12 @@ struct metric_expr {int runtime; }; +struct tpebs_event { +struct list_head nd; +const char *name; +const char *tpebs_name; +}; +struct metric_event *metricgroup__lookup (struct rblist *metric_events,struct evsel *evsel,bool create);
@@ -77,7 +83,9 @@ int metricgroup__parse_groups(struct evlist *perf_evlist,bool metric_no_threshold, const char *user_requested_cpu_list, bool system_wide, - struct rblist *metric_events); + struct rblist *metric_events, + struct list_head *tpebs_events, + size_t *tpebs_event_size); int metricgroup__parse_groups_test(struct evlist *evlist, const struct pmu_metrics_table *table, const char *str,
tools/perf/util/stat.h +2 -0
@@ -109,6 +109,8 @@ struct perf_stat_config {struct cpu_aggr_map *cpus_aggr_map;u64 *walltime_run;struct rblist metric_events; +struct list_head tpebs_events; +size_t tpebs_event_size;int ctl_fd;int ctl_fd_ack;bool ctl_fd_close;
Signature · 1 line
2.43.0
Re: [RFC PATCH v4 1/6] perf stat: Parse and find tpebs events when parsing metrics to prepare for perf record sampling
Quoted 7 lines · [email protected] writes:
tools/perf/util/metricgroup.c +7
-0+ + new_event->tpebs_name =strdup (id); + *p ='\0' ; + name =malloc (strlen (id) +2 ); +if (!name) +return -ENOMEM ; +
tools/perf/util/metricgroup.c static int metricgroup__build_event_string(struct strbuf *events, · line 731
Quoted 10 lines
tools/perf/util/metricgroup.c +10
-0+ at =strchr (id,'@' ); +if (at !=NULL ) { + *at ='/' ; + at =strchr (id,'@' ); + *at ='/' ; +strcpy (name, id); +strcat (name,"p" ); + }else { +strcpy (name, id); +strcat (name,":p" );
This seems like a buffer overflow because :p is 3 bytes including 0, but you only allocate + 2.
You should really use safe string primitives, then you would have noticed the truncation.
-Andi
RE: [RFC PATCH v4 1/6] perf stat: Parse and find tpebs events when parsing metrics to prepare for perf record sampling
Quoted 33 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 4:58 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 1/6] perf stat: Parse and find tpebs events when parsing metrics to prepare for perf record samplingQuoted 15 lines · [email protected] writes:
tools/perf/util/metricgroup.c +15
-0+ + new_event->tpebs_name =strdup (id); + *p ='\0' ; + name =malloc (strlen (id) +2 ); +if (!name) +return -ENOMEM ; + + at =strchr (id,'@' ); +if (at !=NULL ) { + *at ='/' ; + at =strchr (id,'@' ); + *at ='/' ; +strcpy (name, id); +strcat (name,"p" ); + }else {
Quoted 9 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ strcpy(name, id); + strcat(name, ":p");This seems like a buffer overflow because :p is 3 bytes including 0, but you only allocate + 2.
You should really use safe string primitives, then you would have noticed the truncation.
I will double check and update this part.
Thanks,
Weilin
Quoted 1 line
-Andi
RFC PATCH v4 2/6 perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
In reply to [email protected]From: Weilin Wang <[email protected]>
When retire_latency value is used in a metric formula, perf stat would fork a perf record process with "-e" and "-W" options. Perf record will collect required retire_latency values in parallel while perf stat is collecting counting values.
At the point of time that perf stat stops counting, it would send sigterm signal to perf record process and receiving sampling data back from perf record from a pipe. Perf stat will then process the received data to get retire latency data and calculate metric result.
--- tools/perf/builtin-stat.c | 165 +++++++++++++++++++++++++++++++++- tools/perf/util/data.c | 4 + tools/perf/util/data.h | 1 + tools/perf/util/metricgroup.h | 12 +++ tools/perf/util/stat.h | 2 + 5 files changed, 182 insertions(+), 2 deletions(-)
tools/perf/builtin-stat.c +163 -2
@@ -94,8 +94,13 @@#include <perf/evlist.h> #include <internal/threadmap.h> +#include "util/sample.h" +#include <sys/param.h> +#include <subcmd/run-command.h> +#define DEFAULT_SEPARATOR " "#define FREEZE_ON_SMI_PATH "devices/cpu/freeze_on_smi" +#define PERF_DATA "-"static void print_counters (struct timespec *ts,int argc,const char **argv);
@@ -163,6 +168,8 @@ static struct perf_stat_config stat_config = { .ctl_fd_ack = -1, .iostat_run = false, .tpebs_events = LIST_HEAD_INIT(stat_config.tpebs_events), + .tpebs_results = LIST_HEAD_INIT(stat_config.tpebs_results), + .tpebs_pid = -1, };static bool cpus_map_matched (struct evsel *a,struct evsel *b)
@@ -687,12 +694,155 @@ static enum counter_recovery stat_handle_error(struct evsel *counter)return COUNTER_FATAL ; } -static int __run_perf_record (void ) +static int __run_perf_record (const char **record_argv) { +int i =0 ; +struct tpebs_event *e; +pr_debug ("Prepare perf record for retire_latency\n" ); + + record_argv[i++] ="perf" ; + record_argv[i++] ="record" ; + record_argv[i++] ="-W" ; + record_argv[i++] ="--synth=no" ; + +if (stat_config.user_requested_cpu_list) { + record_argv[i++] ="-C" ; + record_argv[i++] = stat_config.user_requested_cpu_list; + } + +if (stat_config.system_wide) + record_argv[i++] ="-a" ; + +list_for_each_entry (e, &stat_config.tpebs_events, nd) { + record_argv[i++] ="-e" ; + record_argv[i++] = e->name; + } + + record_argv[i++] ="-o" ; + record_argv[i++] =PERF_DATA ; +return 0 ; } +static void prepare_run_command (struct child_process *cmd, +const char **argv) +{ +memset (cmd,0 ,sizeof (*cmd)); + cmd->argv = argv; + cmd->out =-1 ; +} + +static int prepare_perf_record (struct child_process *cmd) +{ +const char **record_argv; + + record_argv =calloc (10 +2 * stat_config.tpebs_event_size,sizeof (char *)); +if (!record_argv) +return -1 ; +__run_perf_record (record_argv); + +prepare_run_command (cmd, record_argv); +return start_command (cmd); +} + +struct perf_script { +struct perf_tool tool; +struct perf_session *session; +}; + +static void tpebs_data__delete (void ) +{ +struct tpebs_retire_lat *r, *rtmp; +struct tpebs_event *e, *etmp; +list_for_each_entry_safe (r, rtmp, &stat_config.tpebs_results, nd) { +list_del_init (&r->nd); +free (r); + } +list_for_each_entry_safe (e, etmp, &stat_config.tpebs_events, nd) { +list_del_init (&e->nd); +free (e); + } +} + +static int process_sample_event (struct perf_tool *tool__maybe_unused , +union perf_event *event__maybe_unused , +struct perf_sample *sample, +struct evsel *evsel, +struct machine *machine__maybe_unused ) +{ +int ret =0 ; +const char *evname; +struct tpebs_retire_lat *t; + + evname =evsel__name (evsel); + +/* +* Need to handle per core results? We are assuming average retire +* latency value will be used. Save the number of samples and the sum of +* retire latency value for each event. +*/ +list_for_each_entry (t, &stat_config.tpebs_results, nd) { +if (!strcmp (evname, t->name)) { + t->count +=1 ; + t->sum += sample->retire_lat; +break ; + } + } + +return ret; +} + +static int process_feature_event (struct perf_session *session, +union perf_event *event) +{ +if (event->feat.feat_id <HEADER_LAST_FEATURE ) +return perf_event__process_feature (session, event); +return 0 ; +} + +static int __cmd_script (struct child_process *cmd__maybe_unused ) +{ +int err =0 ; +struct perf_session *session; +struct perf_data data = { + .mode =PERF_DATA_MODE_READ , + .path =PERF_DATA , + .fd = cmd->out, + }; +struct perf_script script = { + .tool = { + .sample = process_sample_event, + .ordering_requires_timestamps = true, + .feature = process_feature_event, + .attr = perf_event__process_attr, + }, + }; +struct tpebs_event *e; + +list_for_each_entry (e, &stat_config.tpebs_events, nd) { +struct tpebs_retire_lat *new =malloc (sizeof (struct tpebs_retire_lat )); + +if (!new) +return -1 ; + new->name =strdup (e->name); + new->tpebs_name =strdup (e->tpebs_name); + new->count =0 ; + new->sum =0 ; +list_add_tail (&new->nd, &stat_config.tpebs_results); + } + +kill (cmd->pid,SIGTERM ); + session =perf_session__new (&data, &script.tool); +if (IS_ERR (session)) +return PTR_ERR (session); + script.session = session; + err =perf_session__process_events (session); +perf_session__delete (session); + +return err; +} +static int __run_perf_stat (int argc,const char **argv,int run_idx) {int interval = stat_config.interval;
@@ -709,13 +859,15 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)struct affinity saved_affinity, *affinity =NULL ;int err;bool second_pass = false; +struct child_process cmd;/* Prepare perf record for sampling event retire_latency before fork and * prepare workload */ if (stat_config.tpebs_event_size >0 ) {int ret; - ret =__run_perf_record (); +pr_debug ("perf stat pid = %d\n" ,getpid ()); + ret =prepare_perf_record (&cmd);if (ret)return ret; }
@@ -925,6 +1077,13 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) t1 =rdclock (); +if (stat_config.tpebs_event_size >0 ) { +int ret; + + ret =__cmd_script (&cmd); +close (cmd.out); + } +if (stat_config.walltime_run_table) stat_config.walltime_run[run_idx] = t1 - t0;
@@ -2972,5 +3131,7 @@ int cmd_stat(int argc, const char **argv)metricgroup__rblist_exit (&stat_config.metric_events);evlist__close_control (stat_config.ctl_fd, stat_config.ctl_fd_ack, &stat_config.ctl_fd_close); +tpebs_data__delete (); +return status; }
tools/perf/util/data.c +4 -0
@@ -185,6 +185,10 @@ static bool check_pipe(struct perf_data *data)int fd =perf_data__is_read (data) ?STDIN_FILENO :STDOUT_FILENO ; +if (data->fd >0 ) { + fd = data->fd; + } +if (!data->path) {if (!fstat (fd, &st) &&S_ISFIFO (st.st_mode)) is_pipe = true;
tools/perf/util/data.h +1 -0
@@ -28,6 +28,7 @@ struct perf_data_file {struct perf_data {const char *path; +int fd;struct perf_data_file file;bool is_pipe;bool is_dir;
tools/perf/util/metricgroup.h +12 -0
@@ -68,10 +68,22 @@ struct metric_expr {struct tpebs_event {struct list_head nd; +/* Event name */ const char *name; +/* Event name with TPEBS modifier */ const char *tpebs_name; }; +struct tpebs_retire_lat { +struct list_head nd; +/* Event name */ +const char *name; +/* Event name with TPEBS modifier */ +const char *tpebs_name; +size_t count; +int sum; +}; +struct metric_event *metricgroup__lookup (struct rblist *metric_events,struct evsel *evsel,bool create);
tools/perf/util/stat.h +2 -0
@@ -111,6 +111,8 @@ struct perf_stat_config {struct rblist metric_events;struct list_head tpebs_events;size_t tpebs_event_size; +struct list_head tpebs_results; +pid_t tpebs_pid;int ctl_fd;int ctl_fd_ack;bool ctl_fd_close;
Signature · 1 line
2.43.0
Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 6 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would fork a perf record process with "-e" and "-W" options. Perf record will collect requiredretire_latencyvalues in parallel while perf stat is collecting counting values.
How does that work when the workload is specified on the command line? The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more efficient because often the calibration is only needed once. And it's all under user control so no nasty surprises.
-Andi
RE: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 33 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:03 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.Quoted 6 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would fork a perf record process with "-e" and "-W" options. Perf record will collect requiredretire_latencyvalues in parallel while perf stat is collecting counting values.How does that work when the workload is specified on the command line? The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Quoted 8 lines
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more efficient because often the calibration is only needed once. And it's all under user control so no nasty surprises.
Workload runs only once with perf stat. Perf record is forked by perf stat and run in parallel with perf stat. Perf stat will send perf record a signal to terminate after perf stat stops collecting count value.
The implementation uses a PIPE to pass the sampled data from perf record instead of writing the data into a file.
Thanks,
Weilin
Quoted 1 line
-Andi
Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 40 lines · Weilin
Quoted 31 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:03 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.Quoted 6 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would fork a perf record process with "-e" and "-W" options. Perf record will collect requiredretire_latencyvalues in parallel while perf stat is collecting counting values.How does that work when the workload is specified on the command line? The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Quoted 8 lines
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more efficient because often the calibration is only needed once. And it's all under user control so no nasty surprises.
Quoted 3 lines
Workload runs only once with perf stat. Perf record is forked by perf stat and run in parallel with perf stat. Perf stat will send perf record a signal to terminate after perf stat stops collecting count value.
I don't understand how the perf record filters on the workload created by the perf stat. At a minimum you would need -p to connect to the pid of the parent, but IIRC -p doesnt follow children, so if it forked it wouldn't work.
I think your approach may only work with -a, but perhaps I'm missing something (-a is often not usable due to restrictions)
Also if perf stat runs in interval mode and you only get the data at the end how would that work?
iirc i wrestled with all these questions for toplev (which has a similar feature) and in the end i concluded doing it automatically has far too many problems.
-Andi
RE: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 77 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:56 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.Quoted 6 lines · Weilin
Quoted 6 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:03 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>;Peter
Quoted 5 lines
Quoted 5 lines
Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt,
Samantha
Quoted 2 lines
Quoted 2 lines
<[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf recordwhen
Quoted 7 lines
Quoted 7 lines
perf stat needs to get retire latency value for a metric.
Quoted 3 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would forka
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
perf record process with "-e" and "-W" options. Perf record will collect required
retire_latencyvalues in parallel while perf stat is collecting counting values.How does that work when the workload is specified on the command line? The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
Quoted 7 lines
Quoted 5 lines
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more efficient because often the calibration is only needed once. And it's all under user control so no nasty surprises.
Workload runs only once with perf stat. Perf record is forked by perf stat and
run
Quoted 1 line
in parallel with perf stat. Perf stat will send perf record a signal to terminate
after
Quoted 1 line
perf stat stops collecting count value.
I don't understand how the perf record filters on the workload created by the perf stat. At a minimum you would need -p to connect to the pid of the parent, but IIRC -p doesnt follow children, so if it forked it wouldn't work.
I think your approach may only work with -a, but perhaps I'm missing something (-a is often not usable due to restrictions)
Quoted 7 lines
Also if perf stat runs in interval mode and you only get the data at the end how would that work?
iirc i wrestled with all these questions for toplev (which has a similar feature) and in the end i concluded doing it automatically has far too many problems.
Yes, you are completely right that there are limitation that we can only support -a, -C and not support on -I now. I'm wondering if we could support "-I" in next step by processing sampled data on the go.
Thanks,
Weilin
Quoted 1 line
-Andi
Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 80 lines · Weilin
Quoted 80 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:56 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.Quoted 6 lines · Weilin
Quoted 6 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:03 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>;Peter
Quoted 5 lines
Quoted 5 lines
Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt,
Samantha
Quoted 2 lines
Quoted 2 lines
<[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf recordwhen
Quoted 7 lines
Quoted 7 lines
perf stat needs to get retire latency value for a metric.
Quoted 3 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would forka
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
perf record process with "-e" and "-W" options. Perf record will collect required
retire_latencyvalues in parallel while perf stat is collecting counting values.How does that work when the workload is specified on the command line? The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
Quoted 7 lines
Quoted 5 lines
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more efficient because often the calibration is only needed once. And it's all under user control so no nasty surprises.
Workload runs only once with perf stat. Perf record is forked by perf stat and
run
Quoted 1 line
in parallel with perf stat. Perf stat will send perf record a signal to terminate
after
Quoted 1 line
perf stat stops collecting count value.
I don't understand how the perf record filters on the workload created by the perf stat. At a minimum you would need -p to connect to the pid of the parent, but IIRC -p doesnt follow children, so if it forked it wouldn't work.
I think your approach may only work with -a, but perhaps I'm missing something (-a is often not usable due to restrictions)
Also if perf stat runs in interval mode and you only get the data at the end how would that work?
Quoted 8 lines
Quoted 4 lines
iirc i wrestled with all these questions for toplev (which has a similar feature) and in the end i concluded doing it automatically has far too many problems.
Yes, you are completely right that there are limitation that we can only support -a, -C and not support on -I now. I'm wondering if we could support "-I" in next step by processing sampled data on the go.
-I is very tricky in a separate process. How do you align the two intervals on a long runs without drift. I don't know of a reliable way to do it in the general case only using time.
Also just the non support for forking workloads without -a is fatal imho. That's likely one of the most common cases.
Separate is a far better model imho:
- It is under full user control and no surprises
- No uncontrolled multiplexing
- Often it is fine to measure once and cache the data
It cannot deal with -I properly either (short of some form of phase detection), but at least it doesn't give false promises to that effect.
The way to do it is to have defaults in a json file and the user can override them with a calibration step. There is a JSON format that is used by some other tools.
This is my implementation:
https://github.com/andikleen/pmu-tools/blob/master/genretlat.py
https://github.com/andikleen/pmu-tools/blob/89861055b53e57ba0b7c6348745b2fbe6615c068/toplev.py#L1031
-Andi
RE: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 116 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Wednesday, March 13, 2024 8:55 AM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt, Samantha <[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.Quoted 8 lines · Weilin
Quoted 8 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:56 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>;Peter
Quoted 5 lines
Quoted 5 lines
Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan Liang <[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt,
Samantha
Quoted 2 lines
Quoted 2 lines
<[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf recordwhen
Quoted 10 lines
Quoted 10 lines
perf stat needs to get retire latency value for a metric.
Quoted 6 lines · Weilin
Quoted 6 lines
-----Original Message-----
From: Andi Kleen <[email protected]>
Sent: Tuesday, March 12, 2024 5:03 PM
To: Wang, Weilin <[email protected]>
Cc: Namhyung Kim <[email protected]>; Ian Rogers <[email protected]>; Arnaldo Carvalho de Melo <[email protected]>;Quoted 4 lines
Quoted 4 lines
Peter
Quoted 3 lines
Quoted 3 lines
Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Alexander Shishkin <[email protected]>; Jiri Olsa <[email protected]>; Hunter, Adrian <[email protected]>; Kan
Liang
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
<[email protected]>; [email protected]; linux- [email protected]; Taylor, Perry <[email protected]>; Alt,
Samantha
Quoted 2 lines
Quoted 2 lines
<[email protected]>; Biggers, Caleb <[email protected]>
Subject: Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf recordQuoted 8 lines
Quoted 8 lines
when
Quoted 7 lines
Quoted 7 lines
perf stat needs to get retire latency value for a metric.
Quoted 3 lines · [email protected] writes:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat wouldfork
Quoted 6 lines
Quoted 6 lines
a
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
perf record process with "-e" and "-W" options. Perf record will collect required
retire_latencyvalues in parallel while perf stat is collecting counting values.How does that work when the workload is specified on the command
line?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
The workload would run twice? That is very inefficient and may not work if it's a large workload.
The perf tool infrastructure is imho not up to the task of such parallel collection.
Also it won't work for very long collections because you will get a very large perf.data. Better to use a pipeline.
I think it would be better if you made it a separate operation that can generate a file that is then consumed by perf stat. This is also more
efficient
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
because often the calibration is only needed once. And it's all under user control so no nasty surprises.
Workload runs only once with perf stat. Perf record is forked by perf stat
and
Quoted 2 lines
Quoted 2 lines
run
Quoted 1 line
in parallel with perf stat. Perf stat will send perf record a signal to
terminate
Quoted 14 lines
Quoted 14 lines
after
Quoted 1 line
perf stat stops collecting count value.
I don't understand how the perf record filters on the workload created by the perf stat. At a minimum you would need -p to connect to the pid of the parent, but IIRC -p doesnt follow children, so if it forked it wouldn't work.
I think your approach may only work with -a, but perhaps I'm missing something (-a is often not usable due to restrictions)
Also if perf stat runs in interval mode and you only get the data at the end how would that work?
Quoted 6 lines
Quoted 4 lines
iirc i wrestled with all these questions for toplev (which has a similar feature) and in the end i concluded doing it automatically has far too many problems.
Yes, you are completely right that there are limitation that we can only
support -a, -C
Quoted 1 line
and not support on -I now. I'm wondering if we could support "-I" in next
step by
Quoted 9 lines
Quoted 1 line
processing sampled data on the go.
-I is very tricky in a separate process. How do you align the two intervals on a long runs without drift. I don't know of a reliable way to do it in the general case only using time.
Also just the non support for forking workloads without -a is fatal imho. That's likely one of the most common cases.
We could use -a -C and cgroup together. I think this could be a useful use case. There could be other improvement to the implementation in next step. But I believe current implementation could provide users the access to our new feature with accurate results and without adding too much overhead.
Thanks,
Weilin
Quoted 22 lines
Separate is a far better model imho:
- It is under full user control and no surprises
- No uncontrolled multiplexing
- Often it is fine to measure once and cache the dataIt cannot deal with -I properly either (short of some form of phase detection), but at least it doesn't give false promises to that effect.
The way to do it is to have defaults in a json file and the user can override them with a calibration step. There is a JSON format that is used by some other tools.
This is my implementation:
https://github.com/andikleen/pmu-tools/blob/master/genretlat.py
https://github.com/andikleen/pmu-
tools/blob/89861055b53e57ba0b7c6348745b2fbe6615c068/toplev.py#L10 31-Andi
Re: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
Quoted 2 lines
We could use -a -C and cgroup together. I think this could be a useful use case. There could be other improvement to the implementation in next step. But I believe
I don't know how you would improve it. A lot of the problems are fairly fundamental.
Quoted 3 lines
current implementation could provide users the access to our new feature with accurate results
and without adding too much overhead.
perf record increases the overhead a lot over a perf stat! Sampling is much more expensive than counting.
That should be at least a order of magnitude difference. Another advantage of doing it separately.
That will also make it inaccurate.
Please do a proper implementation. This one is no good.
You can likely reuse a lot of your code:
- Add a perf calibrate to run the profile step separately that generates the JSON
- Add a --metrics option to perf to read the resulting JSON
- Add some mechanism to read a default JSON as fallback. I guess this one could be compiled in to avoid a dependency on an installed file.
-Andi
Ian Rogers
reviewerRe: [RFC PATCH v4 2/6] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric.
In reply to [email protected]Quoted 250 lines · On Tue, Mar 12, 2024 at 4:49 PM <[email protected]> wrote:
From: Weilin Wang <[email protected]>
When
retire_latencyvalue is used in a metric formula, perf stat would fork a perf record process with "-e" and "-W" options. Perf record will collect requiredretire_latencyvalues in parallel while perf stat is collecting counting values.At the point of time that perf stat stops counting, it would send sigterm signal to perf record process and receiving sampling data back from perf record from a pipe. Perf stat will then process the received data to get retire latency data and calculate metric result.
Signed-off-by Weilin Wang <[email protected]>--- tools/perf/builtin-stat.c | 165 +++++++++++++++++++++++++++++++++- tools/perf/util/data.c | 4 + tools/perf/util/data.h | 1 + tools/perf/util/metricgroup.h | 12 +++ tools/perf/util/stat.h | 2 + 5 files changed, 182 insertions(+), 2 deletions(-)tools/perf/builtin-stat.c +163
-2@@ -94,8 +94,13 @@#include <perf/evlist.h> #include <internal/threadmap.h> +#include "util/sample.h" +#include <sys/param.h> +#include <subcmd/run-command.h> +#define DEFAULT_SEPARATOR " "#define FREEZE_ON_SMI_PATH "devices/cpu/freeze_on_smi" +#define PERF_DATA "-"static void print_counters (struct timespec *ts,int argc,const char **argv);@@ -163,6 +168,8 @@ static struct perf_stat_config stat_config = { .ctl_fd_ack = -1, .iostat_run = false, .tpebs_events = LIST_HEAD_INIT(stat_config.tpebs_events), + .tpebs_results = LIST_HEAD_INIT(stat_config.tpebs_results), + .tpebs_pid = -1, };static bool cpus_map_matched (struct evsel *a,struct evsel *b)@@ -687,12 +694,155 @@ static enum counter_recovery stat_handle_error(struct evsel *counter)return COUNTER_FATAL ; } -static int __run_perf_record (void ) +static int __run_perf_record (const char **record_argv) { +int i =0 ; +struct tpebs_event *e; +pr_debug ("Prepare perf record for retire_latency\n" ); + + record_argv[i++] ="perf" ; + record_argv[i++] ="record" ; + record_argv[i++] ="-W" ; + record_argv[i++] ="--synth=no" ; + +if (stat_config.user_requested_cpu_list) { + record_argv[i++] ="-C" ; + record_argv[i++] = stat_config.user_requested_cpu_list; + } + +if (stat_config.system_wide) + record_argv[i++] ="-a" ; + +list_for_each_entry (e, &stat_config.tpebs_events, nd) { + record_argv[i++] ="-e" ; + record_argv[i++] = e->name; + } + + record_argv[i++] ="-o" ; + record_argv[i++] =PERF_DATA ; +return 0 ; } +static void prepare_run_command (struct child_process *cmd, +const char **argv) +{ +memset (cmd,0 ,sizeof (*cmd)); + cmd->argv = argv; + cmd->out =-1 ; +} + +static int prepare_perf_record (struct child_process *cmd) +{ +const char **record_argv; + + record_argv =calloc (10 +2 * stat_config.tpebs_event_size,sizeof (char *)); +if (!record_argv) +return -1 ; +__run_perf_record (record_argv); + +prepare_run_command (cmd, record_argv); +return start_command (cmd); +} + +struct perf_script { +struct perf_tool tool; +struct perf_session *session; +}; + +static void tpebs_data__delete (void ) +{ +struct tpebs_retire_lat *r, *rtmp; +struct tpebs_event *e, *etmp; +list_for_each_entry_safe (r, rtmp, &stat_config.tpebs_results, nd) { +list_del_init (&r->nd); +free (r); + } +list_for_each_entry_safe (e, etmp, &stat_config.tpebs_events, nd) { +list_del_init (&e->nd); +free (e); + } +} + +static int process_sample_event (struct perf_tool *tool__maybe_unused , +union perf_event *event__maybe_unused , +struct perf_sample *sample, +struct evsel *evsel, +struct machine *machine__maybe_unused ) +{ +int ret =0 ; +const char *evname; +struct tpebs_retire_lat *t; + + evname =evsel__name (evsel); + +/* +* Need to handle per core results? We are assuming average retire +* latency value will be used. Save the number of samples and the sum of +* retire latency value for each event. +*/ +list_for_each_entry (t, &stat_config.tpebs_results, nd) { +if (!strcmp (evname, t->name)) { + t->count +=1 ; + t->sum += sample->retire_lat; +break ; + } + } + +return ret; +} + +static int process_feature_event (struct perf_session *session, +union perf_event *event) +{ +if (event->feat.feat_id <HEADER_LAST_FEATURE ) +return perf_event__process_feature (session, event); +return 0 ; +} + +static int __cmd_script (struct child_process *cmd__maybe_unused ) +{ +int err =0 ; +struct perf_session *session; +struct perf_data data = { + .mode =PERF_DATA_MODE_READ , + .path =PERF_DATA , + .fd = cmd->out, + }; +struct perf_script script = { + .tool = { + .sample = process_sample_event, + .ordering_requires_timestamps = true, + .feature = process_feature_event, + .attr = perf_event__process_attr, + }, + }; +struct tpebs_event *e; + +list_for_each_entry (e, &stat_config.tpebs_events, nd) { +struct tpebs_retire_lat *new =malloc (sizeof (struct tpebs_retire_lat )); + +if (!new) +return -1 ; + new->name =strdup (e->name); + new->tpebs_name =strdup (e->tpebs_name); + new->count =0 ; + new->sum =0 ; +list_add_tail (&new->nd, &stat_config.tpebs_results); + } + +kill (cmd->pid,SIGTERM ); + session =perf_session__new (&data, &script.tool); +if (IS_ERR (session)) +return PTR_ERR (session); + script.session = session; + err =perf_session__process_events (session); +perf_session__delete (session); + +return err; +} +static int __run_perf_stat (int argc,const char **argv,int run_idx) {int interval = stat_config.interval;@@ -709,13 +859,15 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)struct affinity saved_affinity, *affinity =NULL ;int err;bool second_pass = false; +struct child_process cmd;/* Prepare perf record for sampling event retire_latency before fork and * prepare workload */ if (stat_config.tpebs_event_size >0 ) {int ret; - ret =__run_perf_record (); +pr_debug ("perf stat pid = %d\n" ,getpid ()); + ret =prepare_perf_record (&cmd);if (ret)return ret; }@@ -925,6 +1077,13 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) t1 =rdclock (); +if (stat_config.tpebs_event_size >0 ) { +int ret; + + ret =__cmd_script (&cmd); +close (cmd.out); + } +if (stat_config.walltime_run_table) stat_config.walltime_run[run_idx] = t1 - t0;@@ -2972,5 +3131,7 @@ int cmd_stat(int argc, const char **argv)metricgroup__rblist_exit (&stat_config.metric_events);evlist__close_control (stat_config.ctl_fd, stat_config.ctl_fd_ack, &stat_config.ctl_fd_close); +tpebs_data__delete (); +return status; }tools/perf/util/data.c +0
-0
tools/perf/util/data.c static bool check_pipe(struct perf_data *data) · line 190
Quoted 6 lines
tools/perf/util/data.c +3
-0@@ -185,6 +185,10 @@ static bool check_pipe(struct perf_data *data)int fd =perf_data__is_read (data) ?STDIN_FILENO :STDOUT_FILENO ; +if (data->fd >0 ) { + fd = data->fd; + }
nit: no curlies needed here
Quoted 9 lines
tools/perf/util/data.c +1
-0+if (!data->path) {if (!fstat (fd, &st) &&S_ISFIFO (st.st_mode)) is_pipe = true;tools/perf/util/data.h +0
-0
tools/perf/util/data.h struct perf_data_file { · line 32
Quoted 5 lines
tools/perf/util/data.h +1
-0@@ -28,6 +28,7 @@ struct perf_data_file {struct perf_data {const char *path; +int fd;struct perf_data_file file;
Could fd and file be a union, so that its clear they are mutually exclusive? Perhaps just comment.
Quoted 15 lines
tools/perf/util/data.h +0
-0bool is_pipe;bool is_dir;tools/perf/util/metricgroup.h +2
-0@@ -68,10 +68,22 @@ struct metric_expr {struct tpebs_event {struct list_head nd; +/* Event name */ const char *name; +/* Event name with TPEBS modifier */ const char *tpebs_name; };
tools/perf/util/metricgroup.h struct metric_expr { · line 85
Quoted 10 lines
tools/perf/util/metricgroup.h +9
-0+struct tpebs_retire_lat { +struct list_head nd; +/* Event name */ +const char *name; +/* Event name with TPEBS modifier */ +const char *tpebs_name; +size_t count; +int sum; +};
nit: Would it make sense to make this:
struct tpebs_retire_lat {
struct tpebs_event event;
size_t count;
int sum;
}
Thanks,
Ian
Quoted 20 lines
tools/perf/util/metricgroup.h +1
-0+struct metric_event *metricgroup__lookup (struct rblist *metric_events,struct evsel *evsel,bool create);tools/perf/util/stat.h +2
-1@@ -111,6 +111,8 @@ struct perf_stat_config {struct rblist metric_events;struct list_head tpebs_events;size_t tpebs_event_size; +struct list_head tpebs_results; +pid_t tpebs_pid;int ctl_fd;int ctl_fd_ack;bool ctl_fd_close; --2.43.0
RFC PATCH v4 3/6 perf stat: Add retire latency values into the expr_parse_ctx to prepare for final metric calculation
In reply to [email protected]From: Weilin Wang <[email protected]>
Retire latency values of events are used in metric formulas. This update adds code to process data from perf record for required retire latency values.
--- tools/perf/builtin-stat.c | 1 + tools/perf/util/metricgroup.h | 1 + tools/perf/util/stat-shadow.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+)
tools/perf/builtin-stat.c +1 -0
@@ -786,6 +786,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,if (!strcmp (evname, t->name)) { t->count +=1 ; t->sum += sample->retire_lat; + t->val = (double ) t->sum / t->count;break ; } }
tools/perf/util/metricgroup.h +1 -0
@@ -82,6 +82,7 @@ struct tpebs_retire_lat {const char *tpebs_name;size_t count;int sum; +double val; }; struct metric_event *metricgroup__lookup(struct rblist *metric_events,
tools/perf/util/stat-shadow.c +19 -0
@@ -355,6 +355,20 @@ static void print_nsecs(struct perf_stat_config *config,print_metric (config, ctxp,NULL ,NULL ,"CPUs utilized" ,0 ); } +static int prepare_retire_lat (struct expr_parse_ctx *pctx, +struct list_head *retire_lats) +{ +int ret =0 ; +struct tpebs_retire_lat *t; + +list_for_each_entry (t, retire_lats, nd) { + ret =expr__add_id_val (pctx,strdup (t->tpebs_name), t->val); +if (ret <0 ) +return ret; + } +return ret; +} + static int prepare_metric(const struct metric_expr *mexp, const struct evsel *evsel, struct expr_parse_ctx *pctx,
@@ -486,6 +500,11 @@ static void generic_metric(struct perf_stat_config *config, pctx->sctx.user_requested_cpu_list =strdup (config->user_requested_cpu_list); pctx->sctx.runtime = runtime; pctx->sctx.system_wide = config->system_wide; + i =prepare_retire_lat (pctx, &config->tpebs_results); +if (i <0 ) { +expr__ctx_free (pctx); +return ; + } i =prepare_metric (mexp, evsel, pctx, aggr_idx);if (i <0 ) {expr__ctx_free (pctx);
Signature · 1 line
2.43.0
Ian Rogers
reviewerRe: [RFC PATCH v4 3/6] perf stat: Add retire latency values into the expr_parse_ctx to prepare for final metric calculation
Quoted 30 lines · On Tue, Mar 12, 2024 at 4:49 PM <[email protected]> wrote:
From: Weilin Wang <[email protected]>
Retire latency values of events are used in metric formulas. This update adds code to process data from perf record for required retire latency values.
Signed-off-by Weilin Wang <[email protected]>--- tools/perf/builtin-stat.c | 1 + tools/perf/util/metricgroup.h | 1 + tools/perf/util/stat-shadow.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+)tools/perf/builtin-stat.c +1
-0@@ -786,6 +786,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,if (!strcmp (evname, t->name)) { t->count +=1 ; t->sum += sample->retire_lat; + t->val = (double ) t->sum / t->count;break ; } }tools/perf/util/metricgroup.h +0
-0
tools/perf/util/metricgroup.h struct tpebs_retire_lat { · line 85
Quoted 4 lines
tools/perf/util/metricgroup.h +1
-0@@ -82,6 +82,7 @@ struct tpebs_retire_lat {const char *tpebs_name;size_t count;int sum; +double val;
Given the similarity of count, sum and val it would be good to document them.
Quoted 43 lines
tools/perf/util/metricgroup.h +0
-0}; struct metric_event *metricgroup__lookup(struct rblist *metric_events,tools/perf/util/stat-shadow.c +19
-1@@ -355,6 +355,20 @@ static void print_nsecs(struct perf_stat_config *config,print_metric (config, ctxp,NULL ,NULL ,"CPUs utilized" ,0 ); } +static int prepare_retire_lat (struct expr_parse_ctx *pctx, +struct list_head *retire_lats) +{ +int ret =0 ; +struct tpebs_retire_lat *t; + +list_for_each_entry (t, retire_lats, nd) { + ret =expr__add_id_val (pctx,strdup (t->tpebs_name), t->val); +if (ret <0 ) +return ret; + } +return ret; +} + static int prepare_metric(const struct metric_expr *mexp, const struct evsel *evsel, struct expr_parse_ctx *pctx,@@ -486,6 +500,11 @@ static void generic_metric(struct perf_stat_config *config, pctx->sctx.user_requested_cpu_list =strdup (config->user_requested_cpu_list); pctx->sctx.runtime = runtime; pctx->sctx.system_wide = config->system_wide; + i =prepare_retire_lat (pctx, &config->tpebs_results); +if (i <0 ) { +expr__ctx_free (pctx); +return ; + } i =prepare_metric (mexp, evsel, pctx, aggr_idx);if (i <0 ) {expr__ctx_free (pctx); --2.43.0
RFC PATCH v4 4/6 perf stat: Create another thread for sample data processing
In reply to [email protected]From: Weilin Wang <[email protected]>
Another thread is required to synchronize between perf stat and perf record when we pass data through pipe.
--- tools/perf/builtin-stat.c | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-)
tools/perf/builtin-stat.c +31 -20
@@ -802,9 +802,9 @@ static int process_feature_event(struct perf_session *session,return 0 ; } -static int __cmd_script (struct child_process *cmd__maybe_unused ) +static void *__cmd_script (void *arg__maybe_unused ) { -int err =0 ; +struct child_process *cmd = arg;struct perf_session *session;struct perf_data data = { .mode =PERF_DATA_MODE_READ ,
@@ -819,29 +819,15 @@ static int __cmd_script(struct child_process *cmd __maybe_unused) .attr = perf_event__process_attr, }, }; -struct tpebs_event *e; - -list_for_each_entry (e, &stat_config.tpebs_events, nd) { -struct tpebs_retire_lat *new =malloc (sizeof (struct tpebs_retire_lat )); -if (!new) -return -1 ; - new->name =strdup (e->name); - new->tpebs_name =strdup (e->tpebs_name); - new->count =0 ; - new->sum =0 ; -list_add_tail (&new->nd, &stat_config.tpebs_results); - } - -kill (cmd->pid,SIGTERM ); session =perf_session__new (&data, &script.tool);if (IS_ERR (session)) -return PTR_ERR (session); +return NULL ; script.session = session; - err =perf_session__process_events (session); +perf_session__process_events (session);perf_session__delete (session); -return err; +return NULL ; }static int __run_perf_stat (int argc,const char **argv,int run_idx)
@@ -861,16 +847,37 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)int err;bool second_pass = false;struct child_process cmd; +pthread_t thread_script;/* Prepare perf record for sampling event retire_latency before fork and * prepare workload */ if (stat_config.tpebs_event_size >0 ) {int ret; +struct tpebs_event *e;pr_debug ("perf stat pid = %d\n" ,getpid ()); +list_for_each_entry (e, &stat_config.tpebs_events, nd) { +struct tpebs_retire_lat *new =malloc (sizeof (struct tpebs_retire_lat )); + +if (!new) +return -1 ; + new->name =strdup (e->name); + new->tpebs_name =strdup (e->tpebs_name); + new->count =0 ; + new->sum =0 ; +list_add_tail (&new->nd, &stat_config.tpebs_results); + } ret =prepare_perf_record (&cmd);if (ret)return ret; +if (pthread_create (&thread_script,NULL , __cmd_script, &cmd)) { +kill (cmd.pid,SIGTERM ); +close (cmd.out); +pr_err ("Could not create thread to process sample data.\n" ); +return -1 ; + } +/* Wait for perf record initialization a little bit.*/ +sleep (2 ); }if (forks) {
@@ -1081,8 +1088,12 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)if (stat_config.tpebs_event_size >0 ) {int ret; - ret =__cmd_script (&cmd); +kill (cmd.pid,SIGTERM ); +pthread_join (thread_script,NULL );close (cmd.out); + ret =finish_command (&cmd); +if (ret != -ERR_RUN_COMMAND_WAITPID_SIGNAL ) +return ret; }if (stat_config.walltime_run_table)
Signature · 1 line
2.43.0
RFC PATCH v4 5/6 perf stat: Add retire latency print functions to print out at the very end of print out
In reply to [email protected]From: Weilin Wang <[email protected]>
Add print out functions so that users could read retire latency values.
Example output:
In this simple example, there is no MEM_INST_RETIRED.STLB_HIT_STORES sample. Therefore, the MEM_INST_RETIRED.STLB_HIT_STORES:p retire_latency value, count and sum are all 0.
Performance counter stats for 'system wide':
181,047,168 cpu_core/TOPDOWN.SLOTS/ # 0.6 % tma_dtlb_store
3,195,608 cpu_core/topdown-retiring/
40,156,649 cpu_core/topdown-mem-bound/
3,550,925 cpu_core/topdown-bad-spec/
117,571,818 cpu_core/topdown-fe-bound/
57,118,087 cpu_core/topdown-be-bound/
69,179 cpu_core/EXE_ACTIVITY.BOUND_ON_STORES/
4,582 cpu_core/MEM_INST_RETIRED.STLB_HIT_STORES/
30,183,104 cpu_core/CPU_CLK_UNHALTED.DISTRIBUTED/
30,556,790 cpu_core/CPU_CLK_UNHALTED.THREAD/
168,486 cpu_core/DTLB_STORE_MISSES.WALK_ACTIVE/0.00 MEM_INST_RETIRED.STLB_HIT_STORES:p 0 0
1.003105924 seconds time elapsed
--- tools/perf/util/stat-display.c | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
tools/perf/util/stat-display.c +65 -0
@@ -21,6 +21,7 @@#include "iostat.h" #include "pmu.h" #include "pmus.h" +#include "metricgroup.h" #define CNTR_NOT_SUPPORTED "<not supported>"#define CNTR_NOT_COUNTED "<not counted>"
@@ -34,6 +35,7 @@#define COMM_LEN 16#define PID_LEN 7#define CPUS_LEN 4 +#define RETIRE_LEN 8static int aggr_header_lens[] = { [AGGR_CORE ] =18 ,
@@ -426,6 +428,67 @@ static void print_metric_std(struct perf_stat_config *config,fprintf (out," %-*s" ,METRIC_LEN - n -1 , unit); } +static void print_retire_lat_std (struct perf_stat_config *config, +struct outstate *os) +{ +FILE *out = os->fh; +bool newline = os->newline; +struct tpebs_retire_lat *t; +struct list_head *retire_lats = &config->tpebs_results; + +list_for_each_entry (t, retire_lats, nd) { +if (newline) +do_new_line_std (config, os); +fprintf (out,"%'*.2f %-*s" ,COUNTS_LEN , t->val,EVNAME_LEN , t->name); +fprintf (out,"%*ld %*d\n" ,RETIRE_LEN , t->count, +RETIRE_LEN , t->sum); + } +} + +static void print_retire_lat_csv (struct perf_stat_config *config, +struct outstate *os) +{ +FILE *out = os->fh; +struct tpebs_retire_lat *t; +struct list_head *retire_lats = &config->tpebs_results; +const char *sep = config->csv_sep; + +list_for_each_entry (t, retire_lats, nd) { +fprintf (out,"%f%s%s%s%s%ld%s%d\n" , t->val, sep, sep, t->name, sep, + t->count, sep, t->sum); + } +} + +static void print_retire_lat_json (struct perf_stat_config *config, +struct outstate *os) +{ +FILE *out = os->fh; +struct tpebs_retire_lat *t; +struct list_head *retire_lats = &config->tpebs_results; + +fprintf (out,"{" ); +list_for_each_entry (t, retire_lats, nd) { +fprintf (out,"\"retire_latency-value\" : \"%f\", " , t->val); +fprintf (out,"\"event-name\" : \"%s\"" , t->name); +fprintf (out,"\"sample-counts\" : \"%ld\"" , t->count); +fprintf (out,"\"retire_latency-sum\" : \"%d\"" , t->sum); + } +fprintf (out,"}" ); +} + +static void print_retire_lat (struct perf_stat_config *config, +struct outstate *os) +{ +if (!&config->tpebs_results) +return ; +if (config->json_output) +print_retire_lat_json (config, os); +else if (config->csv_output) +print_retire_lat_csv (config, os); +else +print_retire_lat_std (config, os); +} +static void new_line_csv (struct perf_stat_config *config,void *ctx) {struct outstate *os = ctx;
@@ -1609,6 +1672,8 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *confbreak ; } +print_retire_lat (config, &os); +print_footer (config);fflush (config->output);
Signature · 1 line
2.43.0
RFC PATCH v4 6/6 perf vendor events intel: Add MTL metric json files
In reply to [email protected]From: Weilin Wang <[email protected]>
Add MTL metric json file at TMA4.7 [1]. Some of the metrics' formulas use TPEBS retire_latency in MTL.
[1] https://lore.kernel.org/all/[email protected]/
--- .../arch/x86/meteorlake/metricgroups.json | 127 + .../arch/x86/meteorlake/mtl-metrics.json | 2551 +++++++++++++++++ 2 files changed, 2678 insertions(+) create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/metricgroups.json create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/mtl-metrics.json
tools/perf/pmu-events/arch/x86/meteorlake/metricgroups.json new file +127 -0
@@ -0,0 +1,127 @@ +{ + "Backend": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Bad": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "BadSpec": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "BigFootprint": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "BrMispredicts": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Branches": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "C0Wait": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "CacheHits": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "CodeGen": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Compute": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Cor": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "DSB": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "DSBmiss": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "DataSharing": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Fed": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "FetchBW": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "FetchLat": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Flops": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "FpScalar": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "FpVector": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Frontend": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "HPC": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "IcMiss": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "InsType": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "IntVector": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "L2Evicts": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "LSD": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MachineClears": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Machine_Clears": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Mem": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MemOffcore": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MemoryBW": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MemoryBound": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MemoryLat": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MemoryTLB": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Memory_BW": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Memory_Lat": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "MicroSeq": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "OS": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Offcore": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "PGO": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Pipeline": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "PortsUtil": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Power": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Prefetches": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Ret": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Retire": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "SMT": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Server": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Snoop": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "SoC": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "Summary": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "TmaL1": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "TmaL2": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "TmaL3mem": "Grouping from Top-down Microarchitecture Analysis Metrics spreadsheet", + "TopdownL1": "Metrics for top-down breakdown at level 1", + "TopdownL2": "Metrics for top-down breakdown at level 2", + "TopdownL3": "Metrics for top-down breakdown at level 3", + "TopdownL4": "Metrics for top-down breakdown at level 4", + "TopdownL5": "Metrics for top-down breakdown at level 5", + "TopdownL6": "Metrics for top-down breakdown at level 6", + "tma_L1_group": "Metrics for top-down breakdown at level 1", + "tma_L2_group": "Metrics for top-down breakdown at level 2", + "tma_L3_group": "Metrics for top-down breakdown at level 3", + "tma_L4_group": "Metrics for top-down breakdown at level 4", + "tma_L5_group": "Metrics for top-down breakdown at level 5", + "tma_L6_group": "Metrics for top-down breakdown at level 6", + "tma_alu_op_utilization_group": "Metrics contributing to tma_alu_op_utilization category", + "tma_assists_group": "Metrics contributing to tma_assists category", + "tma_backend_bound_aux_group": "Metrics contributing to tma_backend_bound_aux category", + "tma_backend_bound_group": "Metrics contributing to tma_backend_bound category", + "tma_bad_speculation_group": "Metrics contributing to tma_bad_speculation category", + "tma_base_group": "Metrics contributing to tma_base category", + "tma_branch_mispredicts_group": "Metrics contributing to tma_branch_mispredicts category", + "tma_branch_resteers_group": "Metrics contributing to tma_branch_resteers category", + "tma_core_bound_group": "Metrics contributing to tma_core_bound category", + "tma_dram_bound_group": "Metrics contributing to tma_dram_bound category", + "tma_dtlb_load_group": "Metrics contributing to tma_dtlb_load category", + "tma_dtlb_store_group": "Metrics contributing to tma_dtlb_store category", + "tma_fetch_bandwidth_group": "Metrics contributing to tma_fetch_bandwidth category", + "tma_fetch_latency_group": "Metrics contributing to tma_fetch_latency category", + "tma_fp_arith_group": "Metrics contributing to tma_fp_arith category", + "tma_fp_vector_group": "Metrics contributing to tma_fp_vector category", + "tma_frontend_bound_group": "Metrics contributing to tma_frontend_bound category", + "tma_heavy_operations_group": "Metrics contributing to tma_heavy_operations category", + "tma_int_operations_group": "Metrics contributing to tma_int_operations category", + "tma_issue2P": "Metrics related by the issue $issue2P", + "tma_issueBM": "Metrics related by the issue $issueBM", + "tma_issueBW": "Metrics related by the issue $issueBW", + "tma_issueComp": "Metrics related by the issue $issueComp", + "tma_issueD0": "Metrics related by the issue $issueD0", + "tma_issueFB": "Metrics related by the issue $issueFB", + "tma_issueFL": "Metrics related by the issue $issueFL", + "tma_issueL1": "Metrics related by the issue $issueL1", + "tma_issueLat": "Metrics related by the issue $issueLat", + "tma_issueMC": "Metrics related by the issue $issueMC", + "tma_issueMS": "Metrics related by the issue $issueMS", + "tma_issueMV": "Metrics related by the issue $issueMV", + "tma_issueRFO": "Metrics related by the issue $issueRFO", + "tma_issueSL": "Metrics related by the issue $issueSL", + "tma_issueSO": "Metrics related by the issue $issueSO", + "tma_issueSmSt": "Metrics related by the issue $issueSmSt", + "tma_issueSpSt": "Metrics related by the issue $issueSpSt", + "tma_issueSyncxn": "Metrics related by the issue $issueSyncxn", + "tma_issueTLB": "Metrics related by the issue $issueTLB", + "tma_l1_bound_group": "Metrics contributing to tma_l1_bound category", + "tma_l3_bound_group": "Metrics contributing to tma_l3_bound category", + "tma_light_operations_group": "Metrics contributing to tma_light_operations category", + "tma_load_op_utilization_group": "Metrics contributing to tma_load_op_utilization category", + "tma_machine_clears_group": "Metrics contributing to tma_machine_clears category", + "tma_mem_latency_group": "Metrics contributing to tma_mem_latency category", + "tma_mem_scheduler_group": "Metrics contributing to tma_mem_scheduler category", + "tma_memory_bound_group": "Metrics contributing to tma_memory_bound category", + "tma_microcode_sequencer_group": "Metrics contributing to tma_microcode_sequencer category", + "tma_mite_group": "Metrics contributing to tma_mite category", + "tma_nuke_group": "Metrics contributing to tma_nuke category", + "tma_other_light_ops_group": "Metrics contributing to tma_other_light_ops category", + "tma_ports_utilization_group": "Metrics contributing to tma_ports_utilization category", + "tma_ports_utilized_0_group": "Metrics contributing to tma_ports_utilized_0 category", + "tma_ports_utilized_3m_group": "Metrics contributing to tma_ports_utilized_3m category", + "tma_resource_bound_group": "Metrics contributing to tma_resource_bound category", + "tma_retiring_group": "Metrics contributing to tma_retiring category", + "tma_serializing_operation_group": "Metrics contributing to tma_serializing_operation category", + "tma_store_bound_group": "Metrics contributing to tma_store_bound category", + "tma_store_op_utilization_group": "Metrics contributing to tma_store_op_utilization category" +}
tools/perf/pmu-events/arch/x86/meteorlake/mtl-metrics.json new file +2551 -0
2,551 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 2 lines · On Tue, Mar 12, 2024 at 4:49 PM <[email protected]> wrote:
From: Weilin Wang <[email protected]>
For the series, some nits noted on particular patches but otherwise:
Thanks,
Ian
Quoted 36 lines
Changes in v4:
- Remove uncessary debug print and update code and comments for better readability and quality [Namhyung]
- Update mtl metric json file with consistent TmaL1 and TopdownL1 metricgroupv3: https://lore.kernel.org/all/[email protected]/
Weilin Wang (6):
perf stat: Parse and find tpebs events when parsing metrics to prepare
for perf record sampling
perf stat: Fork and launch perf record when perf stat needs to get
retire latency value for a metric.
perf stat: Add retire latency values into theexpr_parse_ctxto
prepare for final metric calculation
perf stat: Create another thread for sample data processing perf stat: Add retire latency print functions to print out at the very
end of print out
perf vendor events intel: Add MTL metric json filestools/perf/builtin-stat.c | 211 +- .../arch/x86/meteorlake/metricgroups.json | 127 + .../arch/x86/meteorlake/mtl-metrics.json | 2551 +++++++++++++++++ tools/perf/util/data.c | 4 + tools/perf/util/data.h | 1 + tools/perf/util/metricgroup.c | 88 +- tools/perf/util/metricgroup.h | 23 +- tools/perf/util/stat-display.c | 65 + tools/perf/util/stat-shadow.c | 19 + tools/perf/util/stat.h | 4 + 10 files changed, 3074 insertions(+), 19 deletions(-) create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/metricgroups.json create mode 100644 tools/perf/pmu-events/arch/x86/meteorlake/mtl-metrics.json--
2.43.0