Re: [PATCH v4] perf diff: Report noisy for cycles diff

From: Jin, Yao
Date: Thu Aug 15 2019 - 21:22:37 EST




On 8/15/2019 9:22 PM, Jiri Olsa wrote:
On Tue, Aug 13, 2019 at 03:30:37PM +0800, Jin Yao wrote:

SNIP

static void
hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
{
@@ -1662,6 +1794,10 @@ static void data__hpp_register(struct data__file *d, int idx)
fmt->color = hpp__color_cycles;
fmt->sort = hist_entry__cmp_nop;
break;
+ case PERF_HPP_DIFF__CYCLES_HIST:
+ fmt->color = hpp__color_cycles_hist;
+ fmt->sort = hist_entry__cmp_nop;
+ break;
default:
fmt->sort = hist_entry__cmp_nop;
break;
@@ -1688,8 +1824,15 @@ static int ui_init(void)
* PERF_HPP_DIFF__RATIO
* PERF_HPP_DIFF__WEIGHTED_DIFF
*/
- data__hpp_register(d, i ? compute_2_hpp[compute] :
- PERF_HPP_DIFF__BASELINE);
+ if (cycles_hist && (compute == COMPUTE_CYCLES)) {
+ data__hpp_register(d, i ? PERF_HPP_DIFF__CYCLES :
+ PERF_HPP_DIFF__BASELINE);
+ data__hpp_register(d, i ? PERF_HPP_DIFF__CYCLES_HIST :
+ PERF_HPP_DIFF__BASELINE);
+ } else {
+ data__hpp_register(d, i ? compute_2_hpp[compute] :
+ PERF_HPP_DIFF__BASELINE);
+ }

I tink that something like this might be less confusing instead of above:

if (cycles_hist && i && (compute == COMPUTE_CYCLES))
data__hpp_register(d, PERF_HPP_DIFF__CYCLES);

other than that the patch looks ok to me

jirka


Yes, your code is more beautiful. Thanks so much! :)

Thanks
Jin Yao