Lines Matching refs:fmt

21 #define hpp__call_print_fn(hpp, fn, fmt, ...)			\  argument
23 int __ret = fn(hpp, fmt, ##__VA_ARGS__); \
29 int nr_samples, const char *fmt, int len, in __hpp__fmt_print() argument
40 return hpp__call_print_fn(hpp, print_fn, fmt, len, percent); in __hpp__fmt_print()
46 return hpp__call_print_fn(hpp, print_fn, fmt, len, avg); in __hpp__fmt_print()
49 return hpp__call_print_fn(hpp, print_fn, fmt, len, val); in __hpp__fmt_print()
59 hpp_field_fn get_field, const char *fmt, int len, in __hpp__fmt() argument
106 values[i].samples, fmt, len, in __hpp__fmt()
122 int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt() argument
127 int len = max(fmt->user_len ?: fmt->len, (int)strlen(fmt->name)); in hpp__fmt()
142 int hpp__fmt_acc(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt_acc() argument
148 int len = fmt->user_len ?: fmt->len; in hpp__fmt_acc()
152 return hpp__fmt(fmt, hpp, he, get_field, fmtstr, print_fn, fmtype); in hpp__fmt_acc()
155 int hpp__fmt_mem_stat(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp, in hpp__fmt_mem_stat()
341 static bool perf_hpp__is_mem_stat_entry(struct perf_hpp_fmt *fmt);
343 static enum mem_stat_type hpp__mem_stat_type(struct perf_hpp_fmt *fmt) in hpp__mem_stat_type() argument
345 if (!perf_hpp__is_mem_stat_entry(fmt)) in hpp__mem_stat_type()
348 switch (fmt->idx) { in hpp__mem_stat_type()
366 static int64_t hpp__sort_mem_stat(struct perf_hpp_fmt *fmt __maybe_unused, in hpp__sort_mem_stat()
372 static int hpp__width_fn(struct perf_hpp_fmt *fmt, in hpp__width_fn() argument
376 int len = fmt->user_len ?: fmt->len; in hpp__width_fn()
389 len = max(len, nr * fmt->len); in hpp__width_fn()
392 if (len < (int)strlen(fmt->name)) in hpp__width_fn()
393 len = strlen(fmt->name); in hpp__width_fn()
398 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__header_fn() argument
402 int len = hpp__width_fn(fmt, hpp, hists); in hpp__header_fn()
406 hdr = fmt->name; in hpp__header_fn()
411 static int hpp__header_mem_stat_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__header_mem_stat_fn() argument
418 enum mem_stat_type mst = hpp__mem_stat_type(fmt); in hpp__header_mem_stat_fn()
438 fmt->len = len; in hpp__header_mem_stat_fn()
442 return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name); in hpp__header_mem_stat_fn()
444 left = (len - strlen(fmt->name)) / 2 - 1; in hpp__header_mem_stat_fn()
445 right = len - left - strlen(fmt->name) - 2; in hpp__header_mem_stat_fn()
453 left, graph_dotted_line, fmt->name, right, graph_dotted_line); in hpp__header_mem_stat_fn()
473 int hpp_color_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_color_scnprintf() argument
480 va_start(args, fmt); in hpp_color_scnprintf()
483 ret = percent_color_len_snprintf(hpp->buf, hpp->size, fmt, len, percent); in hpp_color_scnprintf()
489 static int hpp_entry_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_entry_scnprintf() argument
495 va_start(args, fmt); in hpp_entry_scnprintf()
496 ret = vsnprintf(hpp->buf, hpp->size, fmt, args); in hpp_entry_scnprintf()
508 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
511 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
516 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
519 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
524 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
536 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
539 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
544 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
547 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
552 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
564 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
567 return hpp__fmt(fmt, hpp, he, he_get_raw_##_field, " %*"PRIu64, \
572 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
584 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
587 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.1f", \
592 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
599 static int hpp__color_mem_stat_##_name(struct perf_hpp_fmt *fmt, \
603 return hpp__fmt_mem_stat(fmt, hpp, he, PERF_MEM_STAT_##_type, \
608 static int hpp__entry_mem_stat_##_name(struct perf_hpp_fmt *fmt, \
612 return hpp__fmt_mem_stat(fmt, hpp, he, PERF_MEM_STAT_##_type, \
660 static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, in HPP_PERCENT_FNS()
667 static bool perf_hpp__is_mem_stat_entry(struct perf_hpp_fmt *fmt) in perf_hpp__is_mem_stat_entry() argument
669 return fmt->sort == hpp__sort_mem_stat; in perf_hpp__is_mem_stat_entry()
802 static void fmt_free(struct perf_hpp_fmt *fmt) in fmt_free() argument
808 BUG_ON(!list_empty(&fmt->list)); in fmt_free()
809 BUG_ON(!list_empty(&fmt->sort_list)); in fmt_free()
811 if (fmt->free) in fmt_free()
812 fmt->free(fmt); in fmt_free()
825 struct perf_hpp_fmt *fmt = &perf_hpp__format[i]; in perf_hpp__init() local
827 INIT_LIST_HEAD(&fmt->list); in perf_hpp__init()
830 if (fmt->sort_list.next == NULL) in perf_hpp__init()
831 INIT_LIST_HEAD(&fmt->sort_list); in perf_hpp__init()
911 struct perf_hpp_fmt *fmt, *acc, *ovh, *acc_lat, *tmp; in perf_hpp__cancel_cumulate() local
921 perf_hpp_list__for_each_format_safe(&perf_hpp_list, fmt, tmp) { in perf_hpp__cancel_cumulate()
922 if (fmt_equal(acc, fmt) || fmt_equal(acc_lat, fmt)) { in perf_hpp__cancel_cumulate()
923 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_cumulate()
927 if (fmt_equal(ovh, fmt)) in perf_hpp__cancel_cumulate()
928 fmt->name = "Overhead"; in perf_hpp__cancel_cumulate()
936 perf_hpp_list__for_each_format_safe(&node->hpp, fmt, tmp) { in perf_hpp__cancel_cumulate()
937 if (fmt_equal(acc, fmt) || fmt_equal(acc_lat, fmt)) { in perf_hpp__cancel_cumulate()
938 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_cumulate()
942 if (fmt_equal(ovh, fmt)) in perf_hpp__cancel_cumulate()
943 fmt->name = "Overhead"; in perf_hpp__cancel_cumulate()
951 struct perf_hpp_fmt *fmt, *lat, *acc, *tmp; in perf_hpp__cancel_latency() local
962 perf_hpp_list__for_each_format_safe(&perf_hpp_list, fmt, tmp) { in perf_hpp__cancel_latency()
963 if (fmt_equal(lat, fmt) || fmt_equal(acc, fmt)) in perf_hpp__cancel_latency()
964 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_latency()
972 perf_hpp_list__for_each_format_safe(&node->hpp, fmt, tmp) { in perf_hpp__cancel_latency()
973 if (fmt_equal(lat, fmt) || fmt_equal(acc, fmt)) in perf_hpp__cancel_latency()
974 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_latency()
982 struct perf_hpp_fmt *fmt; in perf_hpp__setup_output_field() local
985 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_output_field()
989 if (!fmt->entry && !fmt->color) in perf_hpp__setup_output_field()
993 if (fmt_equal(fmt, pos)) in perf_hpp__setup_output_field()
997 perf_hpp__column_register(fmt); in perf_hpp__setup_output_field()
1005 struct perf_hpp_fmt *fmt; in perf_hpp__append_sort_keys() local
1008 perf_hpp_list__for_each_format(list, fmt) { in perf_hpp__append_sort_keys()
1012 if (fmt_equal(fmt, pos)) in perf_hpp__append_sort_keys()
1016 perf_hpp__register_sort_field(fmt); in perf_hpp__append_sort_keys()
1025 struct perf_hpp_fmt *fmt, *tmp; in perf_hpp__reset_output_field() local
1028 perf_hpp_list__for_each_format_safe(list, fmt, tmp) in perf_hpp__reset_output_field()
1029 perf_hpp__column_unregister(fmt); in perf_hpp__reset_output_field()
1032 perf_hpp_list__for_each_sort_list_safe(list, fmt, tmp) in perf_hpp__reset_output_field()
1033 perf_hpp__column_unregister(fmt); in perf_hpp__reset_output_field()
1041 struct perf_hpp_fmt *fmt; in hists__sort_list_width() local
1046 hists__for_each_format(hists, fmt) { in hists__sort_list_width()
1047 if (perf_hpp__should_skip(fmt, hists)) in hists__sort_list_width()
1055 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__sort_list_width()
1066 struct perf_hpp_fmt *fmt; in hists__overhead_width() local
1071 hists__for_each_format(hists, fmt) { in hists__overhead_width()
1072 if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt)) in hists__overhead_width()
1080 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__overhead_width()
1086 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists) in perf_hpp__reset_width() argument
1088 if (perf_hpp__is_sort_entry(fmt)) in perf_hpp__reset_width()
1089 return perf_hpp__reset_sort_width(fmt, hists); in perf_hpp__reset_width()
1091 if (perf_hpp__is_dynamic_entry(fmt)) in perf_hpp__reset_width()
1094 BUG_ON(fmt->idx >= PERF_HPP__MAX_INDEX); in perf_hpp__reset_width()
1096 switch (fmt->idx) { in perf_hpp__reset_width()
1102 fmt->len = 8; in perf_hpp__reset_width()
1107 fmt->len = 9; in perf_hpp__reset_width()
1112 fmt->len = 12; in perf_hpp__reset_width()
1118 fmt->len = 8; in perf_hpp__reset_width()
1126 fmt->len = MEM_STAT_LEN * MEM_STAT_PRINT_LEN; in perf_hpp__reset_width()
1136 struct perf_hpp_fmt *fmt; in hists__reset_column_width() local
1139 hists__for_each_format(hists, fmt) in hists__reset_column_width()
1140 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
1144 perf_hpp_list__for_each_format(&node->hpp, fmt) in hists__reset_column_width()
1145 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
1151 struct perf_hpp_fmt *fmt; in perf_hpp__set_user_width() local
1154 perf_hpp_list__for_each_format(&perf_hpp_list, fmt) { in perf_hpp__set_user_width()
1158 fmt->user_len = len; in perf_hpp__set_user_width()
1167 static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt) in add_hierarchy_fmt() argument
1172 bool skip = perf_hpp__should_skip(fmt, hists); in add_hierarchy_fmt()
1175 if (node->level == fmt->level) { in add_hierarchy_fmt()
1187 node->level = fmt->level; in add_hierarchy_fmt()
1194 fmt_copy = perf_hpp_fmt__dup(fmt); in add_hierarchy_fmt()
1211 struct perf_hpp_fmt *fmt; in perf_hpp__setup_hists_formats() local
1221 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_hists_formats()
1222 if (perf_hpp__is_dynamic_entry(fmt) && in perf_hpp__setup_hists_formats()
1223 !perf_hpp__defined_dynamic_entry(fmt, hists)) in perf_hpp__setup_hists_formats()
1226 ret = add_hierarchy_fmt(hists, fmt); in perf_hpp__setup_hists_formats()
1237 struct perf_hpp_fmt *fmt; in perf_hpp__alloc_mem_stats() local
1242 perf_hpp_list__for_each_format(list, fmt) { in perf_hpp__alloc_mem_stats()
1243 if (!perf_hpp__is_mem_stat_entry(fmt)) in perf_hpp__alloc_mem_stats()
1247 mst[nr_mem_stats++] = hpp__mem_stat_type(fmt); in perf_hpp__alloc_mem_stats()