Lines Matching refs:fmt
19 #define hpp__call_print_fn(hpp, fn, fmt, ...) \ argument
21 int __ret = fn(hpp, fmt, ##__VA_ARGS__); \
27 hpp_field_fn get_field, const char *fmt, int len, in __hpp__fmt() argument
43 ret = hpp__call_print_fn(hpp, print_fn, fmt, len, percent); in __hpp__fmt()
45 ret = hpp__call_print_fn(hpp, print_fn, fmt, len, get_field(he)); in __hpp__fmt()
71 fmt, len, 0.0); in __hpp__fmt()
74 fmt, len, 0ULL); in __hpp__fmt()
79 ret += hpp__call_print_fn(hpp, print_fn, fmt, len, in __hpp__fmt()
82 ret += hpp__call_print_fn(hpp, print_fn, fmt, in __hpp__fmt()
97 fmt, len, 0.0); in __hpp__fmt()
100 fmt, len, 0ULL); in __hpp__fmt()
115 int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt() argument
119 int len = fmt->user_len ?: fmt->len; in hpp__fmt()
134 int hpp__fmt_acc(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__fmt_acc() argument
139 int len = fmt->user_len ?: fmt->len; in hpp__fmt_acc()
143 return hpp__fmt(fmt, hpp, he, get_field, fmtstr, print_fn, fmt_percent); in hpp__fmt_acc()
290 static int hpp__width_fn(struct perf_hpp_fmt *fmt, in hpp__width_fn() argument
294 int len = fmt->user_len ?: fmt->len; in hpp__width_fn()
298 len = max(len, evsel->core.nr_members * fmt->len); in hpp__width_fn()
300 if (len < (int)strlen(fmt->name)) in hpp__width_fn()
301 len = strlen(fmt->name); in hpp__width_fn()
306 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, in hpp__header_fn() argument
310 int len = hpp__width_fn(fmt, hpp, hists); in hpp__header_fn()
311 return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name); in hpp__header_fn()
314 int hpp_color_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_color_scnprintf() argument
321 va_start(args, fmt); in hpp_color_scnprintf()
324 ret = percent_color_len_snprintf(hpp->buf, hpp->size, fmt, len, percent); in hpp_color_scnprintf()
330 static int hpp_entry_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) in hpp_entry_scnprintf() argument
336 va_start(args, fmt); in hpp_entry_scnprintf()
337 ret = vsnprintf(hpp->buf, hpp->size, fmt, args); in hpp_entry_scnprintf()
349 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
352 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
357 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
360 return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
365 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
377 static int hpp__color_##_type(struct perf_hpp_fmt *fmt, \
380 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
385 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
388 return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
393 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
405 static int hpp__entry_##_type(struct perf_hpp_fmt *fmt, \
408 return hpp__fmt(fmt, hpp, he, he_get_raw_##_field, " %*"PRIu64, \
413 static int64_t hpp__sort_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
444 static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, in HPP_PERCENT_FNS()
541 static void fmt_free(struct perf_hpp_fmt *fmt) in fmt_free() argument
547 BUG_ON(!list_empty(&fmt->list)); in fmt_free()
548 BUG_ON(!list_empty(&fmt->sort_list)); in fmt_free()
550 if (fmt->free) in fmt_free()
551 fmt->free(fmt); in fmt_free()
559 struct perf_hpp_fmt *fmt = &perf_hpp__format[i]; in perf_hpp__init() local
561 INIT_LIST_HEAD(&fmt->list); in perf_hpp__init()
564 if (fmt->sort_list.next == NULL) in perf_hpp__init()
565 INIT_LIST_HEAD(&fmt->sort_list); in perf_hpp__init()
624 struct perf_hpp_fmt *fmt, *acc, *ovh, *tmp; in perf_hpp__cancel_cumulate() local
632 perf_hpp_list__for_each_format_safe(&perf_hpp_list, fmt, tmp) { in perf_hpp__cancel_cumulate()
633 if (acc->equal(acc, fmt)) { in perf_hpp__cancel_cumulate()
634 perf_hpp__column_unregister(fmt); in perf_hpp__cancel_cumulate()
638 if (ovh->equal(ovh, fmt)) in perf_hpp__cancel_cumulate()
639 fmt->name = "Overhead"; in perf_hpp__cancel_cumulate()
650 struct perf_hpp_fmt *fmt; in perf_hpp__setup_output_field() local
653 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_output_field()
657 if (!fmt->entry && !fmt->color) in perf_hpp__setup_output_field()
661 if (fmt_equal(fmt, pos)) in perf_hpp__setup_output_field()
665 perf_hpp__column_register(fmt); in perf_hpp__setup_output_field()
673 struct perf_hpp_fmt *fmt; in perf_hpp__append_sort_keys() local
676 perf_hpp_list__for_each_format(list, fmt) { in perf_hpp__append_sort_keys()
680 if (fmt_equal(fmt, pos)) in perf_hpp__append_sort_keys()
684 perf_hpp__register_sort_field(fmt); in perf_hpp__append_sort_keys()
693 struct perf_hpp_fmt *fmt, *tmp; in perf_hpp__reset_output_field() local
696 perf_hpp_list__for_each_format_safe(list, fmt, tmp) { in perf_hpp__reset_output_field()
697 list_del_init(&fmt->list); in perf_hpp__reset_output_field()
698 list_del_init(&fmt->sort_list); in perf_hpp__reset_output_field()
699 fmt_free(fmt); in perf_hpp__reset_output_field()
703 perf_hpp_list__for_each_sort_list_safe(list, fmt, tmp) { in perf_hpp__reset_output_field()
704 list_del_init(&fmt->list); in perf_hpp__reset_output_field()
705 list_del_init(&fmt->sort_list); in perf_hpp__reset_output_field()
706 fmt_free(fmt); in perf_hpp__reset_output_field()
715 struct perf_hpp_fmt *fmt; in hists__sort_list_width() local
720 hists__for_each_format(hists, fmt) { in hists__sort_list_width()
721 if (perf_hpp__should_skip(fmt, hists)) in hists__sort_list_width()
729 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__sort_list_width()
740 struct perf_hpp_fmt *fmt; in hists__overhead_width() local
745 hists__for_each_format(hists, fmt) { in hists__overhead_width()
746 if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt)) in hists__overhead_width()
754 ret += fmt->width(fmt, &dummy_hpp, hists); in hists__overhead_width()
760 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists) in perf_hpp__reset_width() argument
762 if (perf_hpp__is_sort_entry(fmt)) in perf_hpp__reset_width()
763 return perf_hpp__reset_sort_width(fmt, hists); in perf_hpp__reset_width()
765 if (perf_hpp__is_dynamic_entry(fmt)) in perf_hpp__reset_width()
768 BUG_ON(fmt->idx >= PERF_HPP__MAX_INDEX); in perf_hpp__reset_width()
770 switch (fmt->idx) { in perf_hpp__reset_width()
775 fmt->len = 8; in perf_hpp__reset_width()
780 fmt->len = 9; in perf_hpp__reset_width()
785 fmt->len = 12; in perf_hpp__reset_width()
795 struct perf_hpp_fmt *fmt; in hists__reset_column_width() local
798 hists__for_each_format(hists, fmt) in hists__reset_column_width()
799 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
803 perf_hpp_list__for_each_format(&node->hpp, fmt) in hists__reset_column_width()
804 perf_hpp__reset_width(fmt, hists); in hists__reset_column_width()
810 struct perf_hpp_fmt *fmt; in perf_hpp__set_user_width() local
813 perf_hpp_list__for_each_format(&perf_hpp_list, fmt) { in perf_hpp__set_user_width()
817 fmt->user_len = len; in perf_hpp__set_user_width()
826 static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt) in add_hierarchy_fmt() argument
831 bool skip = perf_hpp__should_skip(fmt, hists); in add_hierarchy_fmt()
834 if (node->level == fmt->level) { in add_hierarchy_fmt()
846 node->level = fmt->level; in add_hierarchy_fmt()
853 fmt_copy = perf_hpp_fmt__dup(fmt); in add_hierarchy_fmt()
870 struct perf_hpp_fmt *fmt; in perf_hpp__setup_hists_formats() local
880 perf_hpp_list__for_each_sort_list(list, fmt) { in perf_hpp__setup_hists_formats()
881 if (perf_hpp__is_dynamic_entry(fmt) && in perf_hpp__setup_hists_formats()
882 !perf_hpp__defined_dynamic_entry(fmt, hists)) in perf_hpp__setup_hists_formats()
885 ret = add_hierarchy_fmt(hists, fmt); in perf_hpp__setup_hists_formats()