• Home
  • Raw
  • Download

Lines Matching +full:cpu +full:- +full:nr

27 	if (config->csv_output) {  in print_running()
28 fprintf(config->output, "%s%" PRIu64 "%s%.2f", in print_running()
29 config->csv_sep, in print_running()
31 config->csv_sep, in print_running()
34 fprintf(config->output, " (%.2f%%)", 100.0 * run / ena); in print_running()
43 if (config->csv_output) in print_noise_pct()
44 fprintf(config->output, "%s%.2f%%", config->csv_sep, pct); in print_noise_pct()
46 fprintf(config->output, " ( +-%6.2f%% )", pct); in print_noise_pct()
54 if (config->run_count == 1) in print_noise()
57 ps = evsel->stats; in print_noise()
58 print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg); in print_noise()
64 const char *cgrp_name = evsel->cgrp ? evsel->cgrp->name : ""; in print_cgroup()
65 fprintf(config->output, "%s%s", config->csv_sep, cgrp_name); in print_cgroup()
71 struct evsel *evsel, int id, int nr) in aggr_printout() argument
73 switch (config->aggr_mode) { in aggr_printout()
75 fprintf(config->output, "S%d-D%d-C%*d%s%*d%s", in aggr_printout()
78 config->csv_output ? 0 : -8, in aggr_printout()
80 config->csv_sep, in aggr_printout()
81 config->csv_output ? 0 : 4, in aggr_printout()
82 nr, in aggr_printout()
83 config->csv_sep); in aggr_printout()
86 fprintf(config->output, "S%d-D%*d%s%*d%s", in aggr_printout()
88 config->csv_output ? 0 : -8, in aggr_printout()
90 config->csv_sep, in aggr_printout()
91 config->csv_output ? 0 : 4, in aggr_printout()
92 nr, in aggr_printout()
93 config->csv_sep); in aggr_printout()
96 fprintf(config->output, "S%*d%s%*d%s", in aggr_printout()
97 config->csv_output ? 0 : -5, in aggr_printout()
99 config->csv_sep, in aggr_printout()
100 config->csv_output ? 0 : 4, in aggr_printout()
101 nr, in aggr_printout()
102 config->csv_sep); in aggr_printout()
105 fprintf(config->output, "N%*d%s%*d%s", in aggr_printout()
106 config->csv_output ? 0 : -5, in aggr_printout()
108 config->csv_sep, in aggr_printout()
109 config->csv_output ? 0 : 4, in aggr_printout()
110 nr, in aggr_printout()
111 config->csv_sep); in aggr_printout()
114 if (evsel->percore && !config->percore_show_thread) { in aggr_printout()
115 fprintf(config->output, "S%d-D%d-C%*d%s", in aggr_printout()
118 config->csv_output ? 0 : -3, in aggr_printout()
119 cpu_map__id_to_cpu(id), config->csv_sep); in aggr_printout()
120 } else if (id > -1) { in aggr_printout()
121 fprintf(config->output, "CPU%*d%s", in aggr_printout()
122 config->csv_output ? 0 : -7, in aggr_printout()
123 evsel__cpus(evsel)->map[id], in aggr_printout()
124 config->csv_sep); in aggr_printout()
128 fprintf(config->output, "%*s-%*d%s", in aggr_printout()
129 config->csv_output ? 0 : 16, in aggr_printout()
130 perf_thread_map__comm(evsel->core.threads, id), in aggr_printout()
131 config->csv_output ? 0 : -8, in aggr_printout()
132 perf_thread_map__pid(evsel->core.threads, id), in aggr_printout()
133 config->csv_sep); in aggr_printout()
147 int id, nr; member
158 os->newline = true; in new_line_std()
164 fputc('\n', os->fh); in do_new_line_std()
165 fputs(os->prefix, os->fh); in do_new_line_std()
166 aggr_printout(config, os->evsel, os->id, os->nr); in do_new_line_std()
167 if (config->aggr_mode == AGGR_NONE) in do_new_line_std()
168 fprintf(os->fh, " "); in do_new_line_std()
169 fprintf(os->fh, " "); in do_new_line_std()
177 FILE *out = os->fh; in print_metric_std()
179 bool newline = os->newline; in print_metric_std()
181 os->newline = false; in print_metric_std()
184 fprintf(out, "%-*s", METRIC_LEN, ""); in print_metric_std()
196 fprintf(out, " %-*s", METRIC_LEN - n - 1, unit); in print_metric_std()
204 fputc('\n', os->fh); in new_line_csv()
205 if (os->prefix) in new_line_csv()
206 fprintf(os->fh, "%s", os->prefix); in new_line_csv()
207 aggr_printout(config, os->evsel, os->id, os->nr); in new_line_csv()
208 for (i = 0; i < os->nfields; i++) in new_line_csv()
209 fputs(config->csv_sep, os->fh); in new_line_csv()
218 FILE *out = os->fh; in print_metric_csv()
222 fprintf(out, "%s%s", config->csv_sep, config->csv_sep); in print_metric_csv()
230 fprintf(out, "%s%s%s%s", config->csv_sep, vals, config->csv_sep, skip_spaces(unit)); in print_metric_csv()
261 FILE *out = os->fh; in print_metric_only()
263 unsigned mlen = config->metric_only_len; in print_metric_only()
267 unit = fixunit(buf, os->evsel, unit); in print_metric_only()
272 mlen += strlen(color) + sizeof(PERF_COLOR_RESET) - 1; in print_metric_only()
284 FILE *out = os->fh; in print_metric_only_csv()
290 unit = fixunit(tbuf, os->evsel, unit); in print_metric_only_csv()
296 fprintf(out, "%s%s", vals, config->csv_sep); in print_metric_only_csv()
314 unit = fixunit(tbuf, os->evsel, unit); in print_metric_header()
315 if (config->csv_output) in print_metric_header()
316 fprintf(os->fh, "%s%s", unit, config->csv_sep); in print_metric_header()
318 fprintf(os->fh, "%*s ", config->metric_only_len, unit); in print_metric_header()
324 struct evlist *evlist = evsel->evlist; in first_shadow_cpu()
327 if (config->aggr_mode == AGGR_NONE) in first_shadow_cpu()
330 if (!config->aggr_get_id) in first_shadow_cpu()
334 int cpu2 = evsel__cpus(evsel)->map[i]; in first_shadow_cpu()
336 if (config->aggr_get_id(config, evlist->core.cpus, cpu2) == id) in first_shadow_cpu()
343 int id, int nr, struct evsel *evsel, double avg) in abs_printout() argument
345 FILE *output = config->output; in abs_printout()
346 double sc = evsel->scale; in abs_printout()
349 if (config->csv_output) { in abs_printout()
352 if (config->big_num) in abs_printout()
358 aggr_printout(config, evsel, id, nr); in abs_printout()
360 fprintf(output, fmt, avg, config->csv_sep); in abs_printout()
362 if (evsel->unit) in abs_printout()
363 fprintf(output, "%-*s%s", in abs_printout()
364 config->csv_output ? 0 : config->unit_width, in abs_printout()
365 evsel->unit, config->csv_sep); in abs_printout()
367 fprintf(output, "%-*s", config->csv_output ? 0 : 25, evsel__name(evsel)); in abs_printout()
374 struct evlist *evlist = counter->evlist; in is_mixed_hw_group()
375 u32 pmu_type = counter->core.attr.type; in is_mixed_hw_group()
378 if (counter->core.nr_members < 2) in is_mixed_hw_group()
383 if (pos->core.attr.type == PERF_TYPE_SOFTWARE) in is_mixed_hw_group()
386 pmu_type = pos->core.attr.type; in is_mixed_hw_group()
389 if (pmu_type != pos->core.attr.type) in is_mixed_hw_group()
396 static void printout(struct perf_stat_config *config, int id, int nr, in printout() argument
403 .fh = config->output, in printout()
406 .nr = nr, in printout()
412 if (config->metric_only) { in printout()
414 if (config->csv_output) in printout()
421 if (config->csv_output && !config->metric_only) { in printout()
434 os.nfields += aggr_fields[config->aggr_mode]; in printout()
435 if (counter->cgrp) in printout()
438 if (run == 0 || ena == 0 || counter->counts->scaled == -1) { in printout()
439 if (config->metric_only) { in printout()
443 aggr_printout(config, counter, id, nr); in printout()
445 fprintf(config->output, "%*s%s", in printout()
446 config->csv_output ? 0 : 18, in printout()
447 counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, in printout()
448 config->csv_sep); in printout()
450 if (counter->supported) { in printout()
451 config->print_free_counters_hint = 1; in printout()
453 config->print_mixed_hw_group_error = 1; in printout()
456 fprintf(config->output, "%-*s%s", in printout()
457 config->csv_output ? 0 : config->unit_width, in printout()
458 counter->unit, config->csv_sep); in printout()
460 fprintf(config->output, "%*s", in printout()
461 config->csv_output ? 0 : -25, evsel__name(counter)); in printout()
465 if (!config->csv_output) in printout()
469 if (config->csv_output) in printout()
474 if (!config->metric_only) in printout()
475 abs_printout(config, id, nr, counter, uval); in printout()
482 if (config->csv_output && !config->metric_only) { in printout()
489 &out, &config->metric_events, st); in printout()
490 if (!config->csv_output && !config->metric_only) { in printout()
499 int cpu, s2, id, s; in aggr_update_shadow() local
503 for (s = 0; s < config->aggr_map->nr; s++) { in aggr_update_shadow()
504 id = config->aggr_map->map[s]; in aggr_update_shadow()
507 for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { in aggr_update_shadow()
508 s2 = config->aggr_get_id(config, evlist->core.cpus, cpu); in aggr_update_shadow()
511 val += perf_counts(counter->counts, cpu, 0)->val; in aggr_update_shadow()
525 if (counter->uniquified_name || in uniquify_event_name()
526 !counter->pmu_name || !strncmp(counter->name, counter->pmu_name, in uniquify_event_name()
527 strlen(counter->pmu_name))) in uniquify_event_name()
530 config = strchr(counter->name, '/'); in uniquify_event_name()
533 "%s%s", counter->pmu_name, config) > 0) { in uniquify_event_name()
534 free(counter->name); in uniquify_event_name()
535 counter->name = new_name; in uniquify_event_name()
539 "%s [%s]", counter->name, counter->pmu_name) > 0) { in uniquify_event_name()
540 free(counter->name); in uniquify_event_name()
541 counter->name = new_name; in uniquify_event_name()
545 counter->uniquified_name = true; in uniquify_event_name()
553 struct evlist *evlist = counter->evlist; in collect_all_aliases()
556 alias = list_prepare_entry(counter, &(evlist->core.entries), core.node); in collect_all_aliases()
557 list_for_each_entry_continue (alias, &evlist->core.entries, core.node) { in collect_all_aliases()
560 alias->scale == counter->scale && in collect_all_aliases()
561 alias->cgrp == counter->cgrp && in collect_all_aliases()
562 !strcmp(alias->unit, counter->unit) && in collect_all_aliases()
564 strcmp(alias->pmu_name, counter->pmu_name)) { in collect_all_aliases()
565 alias->merged_stat = true; in collect_all_aliases()
576 if (counter->merged_stat) in collect_data()
579 if (config->no_merge) in collect_data()
581 else if (counter->auto_merge_stats) in collect_data()
589 int nr; member
590 int cpu; member
597 int cpu, s2; in aggr_cb() local
599 for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { in aggr_cb()
602 s2 = config->aggr_get_id(config, evsel__cpus(counter), cpu); in aggr_cb()
603 if (s2 != ad->id) in aggr_cb()
606 ad->nr++; in aggr_cb()
607 counts = perf_counts(counter->counts, cpu, 0); in aggr_cb()
612 if (counts->ena == 0 || counts->run == 0 || in aggr_cb()
613 counter->counts->scaled == -1) { in aggr_cb()
614 ad->ena = 0; in aggr_cb()
615 ad->run = 0; in aggr_cb()
618 ad->val += counts->val; in aggr_cb()
619 ad->ena += counts->ena; in aggr_cb()
620 ad->run += counts->run; in aggr_cb()
627 bool *first, int cpu) in print_counter_aggrdata() argument
630 FILE *output = config->output; in print_counter_aggrdata()
632 int id, nr; in print_counter_aggrdata() local
635 ad.id = id = config->aggr_map->map[s]; in print_counter_aggrdata()
637 ad.nr = 0; in print_counter_aggrdata()
641 nr = ad.nr; in print_counter_aggrdata()
647 aggr_printout(config, counter, id, nr); in print_counter_aggrdata()
652 uval = val * counter->scale; in print_counter_aggrdata()
653 printout(config, cpu != -1 ? cpu : id, nr, counter, uval, prefix, in print_counter_aggrdata()
663 bool metric_only = config->metric_only; in print_aggr()
664 FILE *output = config->output; in print_aggr()
669 if (!config->aggr_map || !config->aggr_get_id) in print_aggr()
678 for (s = 0; s < config->aggr_map->nr; s++) { in print_aggr()
686 &first, -1); in print_aggr()
695 return ((struct perf_aggr_thread_value *)b)->val - in cmp_val()
696 ((struct perf_aggr_thread_value *)a)->val; in cmp_val()
705 int cpu, thread, i = 0; in sort_aggr_thread() local
716 for (cpu = 0; cpu < ncpus; cpu++) { in sort_aggr_thread()
717 val += perf_counts(counter->counts, cpu, thread)->val; in sort_aggr_thread()
718 ena += perf_counts(counter->counts, cpu, thread)->ena; in sort_aggr_thread()
719 run += perf_counts(counter->counts, cpu, thread)->run; in sort_aggr_thread()
722 uval = val * counter->scale; in sort_aggr_thread()
725 * Skip value 0 when enabling --per-thread globally, in sort_aggr_thread()
752 FILE *output = config->output; in print_aggr_thread()
753 int nthreads = perf_thread_map__nr(counter->core.threads); in print_aggr_thread()
754 int ncpus = perf_cpu_map__nr(counter->core.cpus); in print_aggr_thread()
769 if (config->stats) in print_aggr_thread()
772 &config->stats[id]); in print_aggr_thread()
792 struct perf_stat_evsel *ps = counter->stats; in counter_aggr_cb()
794 cd->avg += avg_stats(&ps->res_stats[0]); in counter_aggr_cb()
795 cd->avg_enabled += avg_stats(&ps->res_stats[1]); in counter_aggr_cb()
796 cd->avg_running += avg_stats(&ps->res_stats[2]); in counter_aggr_cb()
801 * aggregated counts in system-wide mode
806 bool metric_only = config->metric_only; in print_counter_aggr()
807 FILE *output = config->output; in print_counter_aggr()
817 uval = cd.avg * counter->scale; in print_counter_aggr()
818 printout(config, -1, 0, counter, uval, prefix, cd.avg_running, cd.avg_enabled, in print_counter_aggr()
830 ad->val += perf_counts(counter->counts, ad->cpu, 0)->val; in counter_cb()
831 ad->ena += perf_counts(counter->counts, ad->cpu, 0)->ena; in counter_cb()
832 ad->run += perf_counts(counter->counts, ad->cpu, 0)->run; in counter_cb()
837 * does not use aggregated count in system-wide
842 FILE *output = config->output; in print_counter()
845 int cpu; in print_counter() local
847 for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { in print_counter()
848 struct aggr_data ad = { .cpu = cpu }; in print_counter()
859 uval = val * counter->scale; in print_counter()
860 printout(config, cpu, 0, counter, uval, prefix, run, ena, 1.0, in print_counter()
871 int cpu; in print_no_aggr_metric() local
877 nrcpus = evlist->core.cpus->nr; in print_no_aggr_metric()
878 for (cpu = 0; cpu < nrcpus; cpu++) { in print_no_aggr_metric()
882 fputs(prefix, config->output); in print_no_aggr_metric()
885 aggr_printout(config, counter, cpu, 0); in print_no_aggr_metric()
888 val = perf_counts(counter->counts, cpu, 0)->val; in print_no_aggr_metric()
889 ena = perf_counts(counter->counts, cpu, 0)->ena; in print_no_aggr_metric()
890 run = perf_counts(counter->counts, cpu, 0)->run; in print_no_aggr_metric()
892 uval = val * counter->scale; in print_no_aggr_metric()
893 printout(config, cpu, 0, counter, uval, prefix, run, ena, 1.0, in print_no_aggr_metric()
896 fputc('\n', config->output); in print_no_aggr_metric()
913 [AGGR_NONE] = "cpu,",
914 [AGGR_THREAD] = "comm-pid,",
925 .fh = config->output in print_metric_headers()
929 fprintf(config->output, "%s", prefix); in print_metric_headers()
931 if (!config->csv_output && !no_indent) in print_metric_headers()
932 fprintf(config->output, "%*s", in print_metric_headers()
933 aggr_header_lens[config->aggr_mode], ""); in print_metric_headers()
934 if (config->csv_output) { in print_metric_headers()
935 if (config->interval) in print_metric_headers()
936 fputs("time,", config->output); in print_metric_headers()
937 fputs(aggr_header_csv[config->aggr_mode], config->output); in print_metric_headers()
950 &config->metric_events, in print_metric_headers()
953 fputc('\n', config->output); in print_metric_headers()
960 bool metric_only = config->metric_only; in print_interval()
961 unsigned int unit_width = config->unit_width; in print_interval()
962 FILE *output = config->output; in print_interval()
965 if (config->interval_clear) in print_interval()
968 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep); in print_interval()
970 if ((num_print_interval == 0 && !config->csv_output) || config->interval_clear) { in print_interval()
971 switch (config->aggr_mode) { in print_interval()
993 fprintf(output, "# time CPU "); in print_interval()
998 fprintf(output, "# time comm-pid"); in print_interval()
1012 if ((num_print_interval == 0 || config->interval_clear) && metric_only) in print_interval()
1022 FILE *output = config->output; in print_header()
1027 if (!config->csv_output) { in print_header()
1030 if (_target->system_wide) in print_header()
1032 else if (_target->cpu_list) in print_header()
1033 fprintf(output, "\'CPU(s) %s", _target->cpu_list); in print_header()
1038 } else if (_target->pid) in print_header()
1039 fprintf(output, "process id \'%s", _target->pid); in print_header()
1041 fprintf(output, "thread id \'%s", _target->tid); in print_header()
1044 if (config->run_count > 1) in print_header()
1045 fprintf(output, " (%d runs)", config->run_count); in print_header()
1055 return lround(ceil(-log10(num))); in get_precision()
1070 for (idx = 0; idx < config->run_count; idx++) { in print_table()
1071 double run = (double) config->walltime_run[idx] / NSEC_PER_SEC; in print_table()
1072 int h, n = 1 + abs((int) (100.0 * (run - avg)/run) / 5); in print_table()
1075 precision, run, precision, run - avg); in print_table()
1088 return t->tv_sec + (double) t->tv_usec/USEC_PER_SEC; in timeval2double()
1093 double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; in print_footer()
1094 FILE *output = config->output; in print_footer()
1096 if (!config->null_run) in print_footer()
1099 if (config->run_count == 1) { in print_footer()
1102 if (config->ru_display) { in print_footer()
1103 double ru_utime = timeval2double(&config->ru_data.ru_utime); in print_footer()
1104 double ru_stime = timeval2double(&config->ru_data.ru_stime); in print_footer()
1111 double sd = stddev_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; in print_footer()
1118 if (config->walltime_run_table) in print_footer()
1121 fprintf(output, " %17.*f +- %.*f seconds time elapsed", in print_footer()
1128 if (config->print_free_counters_hint && sysctl__nmi_watchdog_enabled()) in print_footer()
1135 if (config->print_mixed_hw_group_error) in print_footer()
1148 s2 = config->aggr_get_id(config, evsel__cpus(counter), i); in print_percore_thread()
1149 for (s = 0; s < config->aggr_map->nr; s++) { in print_percore_thread()
1150 id = config->aggr_map->map[s]; in print_percore_thread()
1164 bool metric_only = config->metric_only; in print_percore()
1165 FILE *output = config->output; in print_percore()
1169 if (!config->aggr_map || !config->aggr_get_id) in print_percore()
1172 if (config->percore_show_thread) in print_percore()
1175 for (s = 0; s < config->aggr_map->nr; s++) { in print_percore()
1181 &first, -1); in print_percore()
1195 bool metric_only = config->metric_only; in perf_evlist__print_counters()
1196 int interval = config->interval; in perf_evlist__print_counters()
1212 if (config->aggr_mode == AGGR_GLOBAL && prefix) in perf_evlist__print_counters()
1213 fprintf(config->output, "%s", prefix); in perf_evlist__print_counters()
1216 switch (config->aggr_mode) { in perf_evlist__print_counters()
1233 fputc('\n', config->output); in perf_evlist__print_counters()
1240 if (counter->percore) in perf_evlist__print_counters()
1252 if (!interval && !config->csv_output) in perf_evlist__print_counters()
1255 fflush(config->output); in perf_evlist__print_counters()