aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 73d8bffdd484..a77e31246c00 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -778,6 +778,7 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
778 container_of(fmt, struct diff_hpp_fmt, fmt); 778 container_of(fmt, struct diff_hpp_fmt, fmt);
779 struct hist_entry *pair = get_pair_fmt(he, dfmt); 779 struct hist_entry *pair = get_pair_fmt(he, dfmt);
780 double diff; 780 double diff;
781 s64 wdiff;
781 char pfmt[20] = " "; 782 char pfmt[20] = " ";
782 783
783 if (!pair) 784 if (!pair)
@@ -806,6 +807,18 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
806 scnprintf(pfmt, 20, "%%%d.6f", dfmt->header_width); 807 scnprintf(pfmt, 20, "%%%d.6f", dfmt->header_width);
807 return value_color_snprintf(hpp->buf, hpp->size, 808 return value_color_snprintf(hpp->buf, hpp->size,
808 pfmt, diff); 809 pfmt, diff);
810 case COMPUTE_WEIGHTED_DIFF:
811 if (he->dummy)
812 goto dummy_print;
813 if (pair->diff.computed)
814 wdiff = pair->diff.wdiff;
815 else
816 wdiff = compute_wdiff(he, pair);
817
818 scnprintf(pfmt, 20, "%%14ld", dfmt->header_width);
819 return color_snprintf(hpp->buf, hpp->size,
820 get_percent_color(wdiff),
821 pfmt, wdiff);
809 default: 822 default:
810 BUG_ON(1); 823 BUG_ON(1);
811 } 824 }
@@ -826,6 +839,12 @@ static int hpp__color_ratio(struct perf_hpp_fmt *fmt,
826 return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO); 839 return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO);
827} 840}
828 841
842static int hpp__color_wdiff(struct perf_hpp_fmt *fmt,
843 struct perf_hpp *hpp, struct hist_entry *he)
844{
845 return __hpp__color_compare(fmt, hpp, he, COMPUTE_WEIGHTED_DIFF);
846}
847
829static void 848static void
830hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size) 849hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
831{ 850{
@@ -1007,6 +1026,9 @@ static void data__hpp_register(struct data__file *d, int idx)
1007 case PERF_HPP_DIFF__RATIO: 1026 case PERF_HPP_DIFF__RATIO:
1008 fmt->color = hpp__color_ratio; 1027 fmt->color = hpp__color_ratio;
1009 break; 1028 break;
1029 case PERF_HPP_DIFF__WEIGHTED_DIFF:
1030 fmt->color = hpp__color_wdiff;
1031 break;
1010 default: 1032 default:
1011 break; 1033 break;
1012 } 1034 }