Lines Matching full:config
23 static void print_running(struct perf_stat_config *config, in print_running() argument
26 if (config->csv_output) { in print_running()
27 fprintf(config->output, "%s%" PRIu64 "%s%.2f", in print_running()
28 config->csv_sep, in print_running()
30 config->csv_sep, in print_running()
33 fprintf(config->output, " (%.2f%%)", 100.0 * run / ena); in print_running()
37 static void print_noise_pct(struct perf_stat_config *config, in print_noise_pct() argument
42 if (config->csv_output) in print_noise_pct()
43 fprintf(config->output, "%s%.2f%%", config->csv_sep, pct); in print_noise_pct()
45 fprintf(config->output, " ( +-%6.2f%% )", pct); in print_noise_pct()
48 static void print_noise(struct perf_stat_config *config, in print_noise() argument
53 if (config->run_count == 1) in print_noise()
57 print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg); in print_noise()
60 static void print_cgroup(struct perf_stat_config *config, struct evsel *evsel) in print_cgroup() argument
64 fprintf(config->output, "%s%s", config->csv_sep, cgrp_name); in print_cgroup()
69 static void aggr_printout(struct perf_stat_config *config, in aggr_printout() argument
72 switch (config->aggr_mode) { in aggr_printout()
74 fprintf(config->output, "S%d-D%d-C%*d%s%*d%s", in aggr_printout()
77 config->csv_output ? 0 : -8, in aggr_printout()
79 config->csv_sep, in aggr_printout()
80 config->csv_output ? 0 : 4, in aggr_printout()
82 config->csv_sep); in aggr_printout()
85 fprintf(config->output, "S%d-D%*d%s%*d%s", in aggr_printout()
87 config->csv_output ? 0 : -8, in aggr_printout()
89 config->csv_sep, in aggr_printout()
90 config->csv_output ? 0 : 4, in aggr_printout()
92 config->csv_sep); in aggr_printout()
95 fprintf(config->output, "S%*d%s%*d%s", in aggr_printout()
96 config->csv_output ? 0 : -5, in aggr_printout()
98 config->csv_sep, in aggr_printout()
99 config->csv_output ? 0 : 4, in aggr_printout()
101 config->csv_sep); in aggr_printout()
105 fprintf(config->output, "S%d-D%d-C%*d%s", in aggr_printout()
108 config->csv_output ? 0 : -5, in aggr_printout()
109 cpu_map__id_to_cpu(id), config->csv_sep); in aggr_printout()
111 fprintf(config->output, "CPU%*d%s ", in aggr_printout()
112 config->csv_output ? 0 : -5, in aggr_printout()
114 config->csv_sep); in aggr_printout()
118 fprintf(config->output, "%*s-%*d%s", in aggr_printout()
119 config->csv_output ? 0 : 16, in aggr_printout()
121 config->csv_output ? 0 : -8, in aggr_printout()
123 config->csv_sep); in aggr_printout()
143 static void new_line_std(struct perf_stat_config *config __maybe_unused, in new_line_std()
151 static void do_new_line_std(struct perf_stat_config *config, in do_new_line_std() argument
156 aggr_printout(config, os->evsel, os->id, os->nr); in do_new_line_std()
157 if (config->aggr_mode == AGGR_NONE) in do_new_line_std()
162 static void print_metric_std(struct perf_stat_config *config, in print_metric_std() argument
179 do_new_line_std(config, os); in print_metric_std()
189 static void new_line_csv(struct perf_stat_config *config, void *ctx) in new_line_csv() argument
196 fprintf(os->fh, "%s%s", os->prefix, config->csv_sep); in new_line_csv()
197 aggr_printout(config, os->evsel, os->id, os->nr); in new_line_csv()
199 fputs(config->csv_sep, os->fh); in new_line_csv()
202 static void print_metric_csv(struct perf_stat_config *config __maybe_unused, in print_metric_csv()
212 fprintf(out, "%s%s", config->csv_sep, config->csv_sep); in print_metric_csv()
220 fprintf(out, "%s%s%s%s", config->csv_sep, vals, config->csv_sep, skip_spaces(unit)); in print_metric_csv()
248 static void print_metric_only(struct perf_stat_config *config, in print_metric_only() argument
255 unsigned mlen = config->metric_only_len; in print_metric_only()
270 static void print_metric_only_csv(struct perf_stat_config *config __maybe_unused, in print_metric_only_csv()
288 fprintf(out, "%s%s", vals, config->csv_sep); in print_metric_only_csv()
291 static void new_line_metric(struct perf_stat_config *config __maybe_unused, in new_line_metric()
296 static void print_metric_header(struct perf_stat_config *config, in print_metric_header() argument
307 if (config->csv_output) in print_metric_header()
308 fprintf(os->fh, "%s%s", unit, config->csv_sep); in print_metric_header()
310 fprintf(os->fh, "%*s ", config->metric_only_len, unit); in print_metric_header()
313 static int first_shadow_cpu(struct perf_stat_config *config, in first_shadow_cpu() argument
319 if (!config->aggr_get_id) in first_shadow_cpu()
322 if (config->aggr_mode == AGGR_NONE) in first_shadow_cpu()
325 if (config->aggr_mode == AGGR_GLOBAL) in first_shadow_cpu()
331 if (config->aggr_get_id(config, evlist->core.cpus, cpu2) == id) in first_shadow_cpu()
337 static void abs_printout(struct perf_stat_config *config, in abs_printout() argument
340 FILE *output = config->output; in abs_printout()
344 if (config->csv_output) { in abs_printout()
347 if (config->big_num) in abs_printout()
353 aggr_printout(config, evsel, id, nr); in abs_printout()
355 fprintf(output, fmt, avg, config->csv_sep); in abs_printout()
359 config->csv_output ? 0 : config->unit_width, in abs_printout()
360 evsel->unit, config->csv_sep); in abs_printout()
362 fprintf(output, "%-*s", config->csv_output ? 0 : 25, perf_evsel__name(evsel)); in abs_printout()
364 print_cgroup(config, evsel); in abs_printout()
391 static void printout(struct perf_stat_config *config, int id, int nr, in printout() argument
398 .fh = config->output, in printout()
407 if (config->metric_only) { in printout()
409 if (config->csv_output) in printout()
416 if (config->csv_output && !config->metric_only) { in printout()
429 os.nfields += aggr_fields[config->aggr_mode]; in printout()
434 if (config->metric_only) { in printout()
435 pm(config, &os, NULL, "", "", 0); in printout()
438 aggr_printout(config, counter, id, nr); in printout()
440 fprintf(config->output, "%*s%s", in printout()
441 config->csv_output ? 0 : 18, in printout()
443 config->csv_sep); in printout()
446 config->print_free_counters_hint = 1; in printout()
448 config->print_mixed_hw_group_error = 1; in printout()
451 fprintf(config->output, "%-*s%s", in printout()
452 config->csv_output ? 0 : config->unit_width, in printout()
453 counter->unit, config->csv_sep); in printout()
455 fprintf(config->output, "%*s", in printout()
456 config->csv_output ? 0 : -25, in printout()
459 print_cgroup(config, counter); in printout()
461 if (!config->csv_output) in printout()
462 pm(config, &os, NULL, NULL, "", 0); in printout()
463 print_noise(config, counter, noise); in printout()
464 print_running(config, run, ena); in printout()
465 if (config->csv_output) in printout()
466 pm(config, &os, NULL, NULL, "", 0); in printout()
470 if (!config->metric_only) in printout()
471 abs_printout(config, id, nr, counter, uval); in printout()
478 if (config->csv_output && !config->metric_only) { in printout()
479 print_noise(config, counter, noise); in printout()
480 print_running(config, run, ena); in printout()
483 perf_stat__print_shadow_stats(config, counter, uval, in printout()
484 first_shadow_cpu(config, counter, id), in printout()
485 &out, &config->metric_events, st); in printout()
486 if (!config->csv_output && !config->metric_only) { in printout()
487 print_noise(config, counter, noise); in printout()
488 print_running(config, run, ena); in printout()
492 static void aggr_update_shadow(struct perf_stat_config *config, in aggr_update_shadow() argument
499 for (s = 0; s < config->aggr_map->nr; s++) { in aggr_update_shadow()
500 id = config->aggr_map->map[s]; in aggr_update_shadow()
504 s2 = config->aggr_get_id(config, evlist->core.cpus, cpu); in aggr_update_shadow()
510 first_shadow_cpu(config, counter, id), in aggr_update_shadow()
519 char *config; in uniquify_event_name() local
526 config = strchr(counter->name, '/'); in uniquify_event_name()
527 if (config) { in uniquify_event_name()
529 "%s%s", counter->pmu_name, config) > 0) { in uniquify_event_name()
544 static void collect_all_aliases(struct perf_stat_config *config, struct evsel *counter, in collect_all_aliases() argument
545 void (*cb)(struct perf_stat_config *config, struct evsel *counter, void *data, in collect_all_aliases() argument
562 cb(config, alias, data, false); in collect_all_aliases()
566 static bool collect_data(struct perf_stat_config *config, struct evsel *counter, in collect_data() argument
567 void (*cb)(struct perf_stat_config *config, struct evsel *counter, void *data, in collect_data() argument
573 cb(config, counter, data, true); in collect_data()
574 if (config->no_merge) in collect_data()
577 collect_all_aliases(config, counter, cb, data); in collect_data()
588 static void aggr_cb(struct perf_stat_config *config, in aggr_cb() argument
597 s2 = config->aggr_get_id(config, evsel__cpus(counter), cpu); in aggr_cb()
619 static void print_counter_aggrdata(struct perf_stat_config *config, in print_counter_aggrdata() argument
625 FILE *output = config->output; in print_counter_aggrdata()
630 ad.id = id = config->aggr_map->map[s]; in print_counter_aggrdata()
633 if (!collect_data(config, counter, aggr_cb, &ad)) in print_counter_aggrdata()
642 aggr_printout(config, counter, id, nr); in print_counter_aggrdata()
648 printout(config, id, nr, counter, uval, prefix, in print_counter_aggrdata()
654 static void print_aggr(struct perf_stat_config *config, in print_aggr() argument
658 bool metric_only = config->metric_only; in print_aggr()
659 FILE *output = config->output; in print_aggr()
664 if (!(config->aggr_map || config->aggr_get_id)) in print_aggr()
667 aggr_update_shadow(config, evlist); in print_aggr()
673 for (s = 0; s < config->aggr_map->nr; s++) { in print_aggr()
679 print_counter_aggrdata(config, counter, s, in print_aggr()
743 static void print_aggr_thread(struct perf_stat_config *config, in print_aggr_thread() argument
747 FILE *output = config->output; in print_aggr_thread()
764 if (config->stats) in print_aggr_thread()
765 printout(config, id, 0, buf[thread].counter, buf[thread].uval, in print_aggr_thread()
767 &config->stats[id]); in print_aggr_thread()
769 printout(config, id, 0, buf[thread].counter, buf[thread].uval, in print_aggr_thread()
782 static void counter_aggr_cb(struct perf_stat_config *config __maybe_unused, in counter_aggr_cb()
798 static void print_counter_aggr(struct perf_stat_config *config, in print_counter_aggr() argument
801 bool metric_only = config->metric_only; in print_counter_aggr()
802 FILE *output = config->output; in print_counter_aggr()
806 if (!collect_data(config, counter, counter_aggr_cb, &cd)) in print_counter_aggr()
813 printout(config, -1, 0, counter, uval, prefix, cd.avg_running, cd.avg_enabled, in print_counter_aggr()
819 static void counter_cb(struct perf_stat_config *config __maybe_unused, in counter_cb()
834 static void print_counter(struct perf_stat_config *config, in print_counter() argument
837 FILE *output = config->output; in print_counter()
845 if (!collect_data(config, counter, counter_cb, &ad)) in print_counter()
855 printout(config, cpu, 0, counter, uval, prefix, run, ena, 1.0, in print_counter()
862 static void print_no_aggr_metric(struct perf_stat_config *config, in print_no_aggr_metric() argument
877 fputs(prefix, config->output); in print_no_aggr_metric()
880 aggr_printout(config, counter, cpu, 0); in print_no_aggr_metric()
888 printout(config, cpu, 0, counter, uval, prefix, run, ena, 1.0, in print_no_aggr_metric()
891 fputc('\n', config->output); in print_no_aggr_metric()
913 static void print_metric_headers(struct perf_stat_config *config, in print_metric_headers() argument
920 .fh = config->output in print_metric_headers()
924 fprintf(config->output, "%s", prefix); in print_metric_headers()
926 if (!config->csv_output && !no_indent) in print_metric_headers()
927 fprintf(config->output, "%*s", in print_metric_headers()
928 aggr_header_lens[config->aggr_mode], ""); in print_metric_headers()
929 if (config->csv_output) { in print_metric_headers()
930 if (config->interval) in print_metric_headers()
931 fputs("time,", config->output); in print_metric_headers()
932 fputs(aggr_header_csv[config->aggr_mode], config->output); in print_metric_headers()
943 perf_stat__print_shadow_stats(config, counter, 0, in print_metric_headers()
946 &config->metric_events, in print_metric_headers()
949 fputc('\n', config->output); in print_metric_headers()
952 static void print_interval(struct perf_stat_config *config, in print_interval() argument
956 bool metric_only = config->metric_only; in print_interval()
957 unsigned int unit_width = config->unit_width; in print_interval()
958 FILE *output = config->output; in print_interval()
961 if (config->interval_clear) in print_interval()
964 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep); in print_interval()
966 if ((num_print_interval == 0 && !config->csv_output) || config->interval_clear) { in print_interval()
967 switch (config->aggr_mode) { in print_interval()
1003 if ((num_print_interval == 0 || config->interval_clear) && metric_only) in print_interval()
1004 print_metric_headers(config, evlist, " ", true); in print_interval()
1009 static void print_header(struct perf_stat_config *config, in print_header() argument
1013 FILE *output = config->output; in print_header()
1018 if (!config->csv_output) { in print_header()
1035 if (config->run_count > 1) in print_header()
1036 fprintf(output, " (%d runs)", config->run_count); in print_header()
1049 static void print_table(struct perf_stat_config *config, in print_table() argument
1061 for (idx = 0; idx < config->run_count; idx++) { in print_table()
1062 double run = (double) config->walltime_run[idx] / NSEC_PER_SEC; in print_table()
1082 static void print_footer(struct perf_stat_config *config) in print_footer() argument
1084 double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; in print_footer()
1085 FILE *output = config->output; in print_footer()
1088 if (!config->null_run) in print_footer()
1091 if (config->run_count == 1) { in print_footer()
1094 if (config->ru_display) { in print_footer()
1095 double ru_utime = timeval2double(&config->ru_data.ru_utime); in print_footer()
1096 double ru_stime = timeval2double(&config->ru_data.ru_stime); in print_footer()
1103 double sd = stddev_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; in print_footer()
1110 if (config->walltime_run_table) in print_footer()
1111 print_table(config, output, precision, avg); in print_footer()
1116 print_noise_pct(config, sd, avg); in print_footer()
1120 if (config->print_free_counters_hint && in print_footer()
1129 if (config->print_mixed_hw_group_error) in print_footer()
1135 static void print_percore(struct perf_stat_config *config, in print_percore() argument
1138 bool metric_only = config->metric_only; in print_percore()
1139 FILE *output = config->output; in print_percore()
1143 if (!(config->aggr_map || config->aggr_get_id)) in print_percore()
1146 for (s = 0; s < config->aggr_map->nr; s++) { in print_percore()
1150 print_counter_aggrdata(config, counter, s, in print_percore()
1161 struct perf_stat_config *config, in perf_evlist__print_counters() argument
1166 bool metric_only = config->metric_only; in perf_evlist__print_counters()
1167 int interval = config->interval; in perf_evlist__print_counters()
1172 print_interval(config, evlist, prefix = buf, ts); in perf_evlist__print_counters()
1174 print_header(config, _target, argc, argv); in perf_evlist__print_counters()
1180 print_metric_headers(config, evlist, prefix, false); in perf_evlist__print_counters()
1183 if (config->aggr_mode == AGGR_GLOBAL && prefix) in perf_evlist__print_counters()
1184 fprintf(config->output, "%s", prefix); in perf_evlist__print_counters()
1187 switch (config->aggr_mode) { in perf_evlist__print_counters()
1191 print_aggr(config, evlist, prefix); in perf_evlist__print_counters()
1195 print_aggr_thread(config, _target, counter, prefix); in perf_evlist__print_counters()
1200 print_counter_aggr(config, counter, prefix); in perf_evlist__print_counters()
1203 fputc('\n', config->output); in perf_evlist__print_counters()
1207 print_no_aggr_metric(config, evlist, prefix); in perf_evlist__print_counters()
1211 print_percore(config, counter, prefix); in perf_evlist__print_counters()
1213 print_counter(config, counter, prefix); in perf_evlist__print_counters()
1222 if (!interval && !config->csv_output) in perf_evlist__print_counters()
1223 print_footer(config); in perf_evlist__print_counters()
1225 fflush(config->output); in perf_evlist__print_counters()