Lines Matching refs:fmt
18 #define hpp__call_print_fn(hpp, fn, fmt, ...) \ argument
20 int __ret = fn(hpp, fmt, ##__VA_ARGS__); \
26 hpp_field_fn get_field, const char *fmt, int len, in __hpp__fmt() argument
42 ret = hpp__call_print_fn(hpp, print_fn, fmt, len, percent); in __hpp__fmt()
44 ret = hpp__call_print_fn(hpp, print_fn, fmt, len, get_field(he)); in __hpp__fmt()
70 fmt, len, 0.0); in __hpp__fmt()
73 fmt, len, 0ULL); in __hpp__fmt()
78 ret += hpp__call_print_fn(hpp, print_fn, fmt, len, in __hpp__fmt()
81 ret += hpp__call_print_fn(hpp, print_fn, fmt, in __hpp__fmt()
96 fmt, len, 0.0); in __hpp__fmt()
99 fmt, len, 0ULL); in __hpp__fmt()
114 int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt() argument
118 int len = fmt->user_len ?: fmt->len; in hpp__fmt()
133 int hpp__fmt_acc(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt_acc() argument
138 int len = fmt->user_len ?: fmt->len; in hpp__fmt_acc()
142 return hpp__fmt(fmt, hpp, he, get_field, fmtstr, print_fn, fmt_percent); in hpp__fmt_acc()
287 static int hpp__width_fn(struct perf_hpp_fmt *fmt, in hpp__width_fn() argument
291 int len = fmt->user_len ?: fmt->len; in hpp__width_fn()
295 len = max(len, evsel->core.nr_members * fmt->len); in hpp__width_fn()
297 if (len < (int)strlen(fmt->name)) in hpp__width_fn()
298 len = strlen(fmt->name); in hpp__width_fn()
303 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__header_fn() argument
307 int len = hpp__width_fn(fmt, hpp, hists); in hpp__header_fn()
308 return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name); in hpp__header_fn()
311 int hpp_color_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_color_scnprintf() argument
318 va_start(args, fmt); in hpp_color_scnprintf()
321 ret = percent_color_len_snprintf(hpp->buf, hpp->size, fmt, len, percent); in hpp_color_scnprintf()
327 static int hpp_entry_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_entry_scnprintf() argument
333 va_start(args, fmt); in hpp_entry_scnprintf()
334 ret = vsnprintf(hpp->buf, hpp->size, fmt, args); in hpp_entry_scnprintf()
346 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
349 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
354 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
357 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
362 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
374 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
377 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
382 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
385 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
390 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
402 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
405 return hpp__fmt(fmt, hpp, he, he_get_raw_##_field, " %*"PRIu64, \
410 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
441 static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, in HPP_PERCENT_FNS()
538 static void fmt_free(struct perf_hpp_fmt *fmt) in fmt_free() argument
544 BUG_ON(!list_empty(&fmt->list)); in fmt_free()
545 BUG_ON(!list_empty(&fmt->sort_list)); in fmt_free()
547 if (fmt->free) in fmt_free()
548 fmt->free(fmt); in fmt_free()
556 struct perf_hpp_fmt *fmt = &perf_hpp__format[i]; in perf_hpp__init() local
558 INIT_LIST_HEAD(&fmt->list); in perf_hpp__init()
561 if (fmt->sort_list.next == NULL) in perf_hpp__init()
562 INIT_LIST_HEAD(&fmt->sort_list); in perf_hpp__init()
621 struct perf_hpp_fmt *fmt, *acc, *ovh, *tmp; in perf_hpp__cancel_cumulate() local
629 perf_hpp_list__for_each_format_safe(&perf_hpp_list, fmt, tmp) { in perf_hpp__cancel_cumulate()
630 if (acc->equal(acc, fmt)) { in perf_hpp__cancel_cumulate()
631 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_cumulate()
635 if (ovh->equal(ovh, fmt)) in perf_hpp__cancel_cumulate()
636 fmt->name = "Overhead"; in perf_hpp__cancel_cumulate()
647 struct perf_hpp_fmt *fmt; in perf_hpp__setup_output_field() local
650 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_output_field()
654 if (!fmt->entry && !fmt->color) in perf_hpp__setup_output_field()
658 if (fmt_equal(fmt, pos)) in perf_hpp__setup_output_field()
662 perf_hpp__column_register(fmt); in perf_hpp__setup_output_field()
670 struct perf_hpp_fmt *fmt; in perf_hpp__append_sort_keys() local
673 perf_hpp_list__for_each_format(list, fmt) { in perf_hpp__append_sort_keys()
677 if (fmt_equal(fmt, pos)) in perf_hpp__append_sort_keys()
681 perf_hpp__register_sort_field(fmt); in perf_hpp__append_sort_keys()
690 struct perf_hpp_fmt *fmt, *tmp; in perf_hpp__reset_output_field() local
693 perf_hpp_list__for_each_format_safe(list, fmt, tmp) { in perf_hpp__reset_output_field()
694 list_del_init(&fmt->list); in perf_hpp__reset_output_field()
695 list_del_init(&fmt->sort_list); in perf_hpp__reset_output_field()
696 fmt_free(fmt); in perf_hpp__reset_output_field()
700 perf_hpp_list__for_each_sort_list_safe(list, fmt, tmp) { in perf_hpp__reset_output_field()
701 list_del_init(&fmt->list); in perf_hpp__reset_output_field()
702 list_del_init(&fmt->sort_list); in perf_hpp__reset_output_field()
703 fmt_free(fmt); in perf_hpp__reset_output_field()
712 struct perf_hpp_fmt *fmt; in hists__sort_list_width() local
717 hists__for_each_format(hists, fmt) { in hists__sort_list_width()
718 if (perf_hpp__should_skip(fmt, hists)) in hists__sort_list_width()
726 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__sort_list_width()
737 struct perf_hpp_fmt *fmt; in hists__overhead_width() local
742 hists__for_each_format(hists, fmt) { in hists__overhead_width()
743 if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt)) in hists__overhead_width()
751 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__overhead_width()
757 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists) in perf_hpp__reset_width() argument
759 if (perf_hpp__is_sort_entry(fmt)) in perf_hpp__reset_width()
760 return perf_hpp__reset_sort_width(fmt, hists); in perf_hpp__reset_width()
762 if (perf_hpp__is_dynamic_entry(fmt)) in perf_hpp__reset_width()
765 BUG_ON(fmt->idx >= PERF_HPP__MAX_INDEX); in perf_hpp__reset_width()
767 switch (fmt->idx) { in perf_hpp__reset_width()
772 fmt->len = 8; in perf_hpp__reset_width()
777 fmt->len = 9; in perf_hpp__reset_width()
782 fmt->len = 12; in perf_hpp__reset_width()
792 struct perf_hpp_fmt *fmt; in hists__reset_column_width() local
795 hists__for_each_format(hists, fmt) in hists__reset_column_width()
796 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
800 perf_hpp_list__for_each_format(&node->hpp, fmt) in hists__reset_column_width()
801 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
807 struct perf_hpp_fmt *fmt; in perf_hpp__set_user_width() local
810 perf_hpp_list__for_each_format(&perf_hpp_list, fmt) { in perf_hpp__set_user_width()
814 fmt->user_len = len; in perf_hpp__set_user_width()
823 static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt) in add_hierarchy_fmt() argument
828 bool skip = perf_hpp__should_skip(fmt, hists); in add_hierarchy_fmt()
831 if (node->level == fmt->level) { in add_hierarchy_fmt()
843 node->level = fmt->level; in add_hierarchy_fmt()
850 fmt_copy = perf_hpp_fmt__dup(fmt); in add_hierarchy_fmt()
867 struct perf_hpp_fmt *fmt; in perf_hpp__setup_hists_formats() local
877 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_hists_formats()
878 if (perf_hpp__is_dynamic_entry(fmt) && in perf_hpp__setup_hists_formats()
879 !perf_hpp__defined_dynamic_entry(fmt, hists)) in perf_hpp__setup_hists_formats()
882 ret = add_hierarchy_fmt(hists, fmt); in perf_hpp__setup_hists_formats()