On 6/5/2019 7:44 PM, Jiri Olsa wrote:
On Mon, Jun 03, 2019 at 10:36:16PM +0800, Jin Yao wrote:

SNIP

-                               break;
                        return setup_compute_opt(option);
                }
@@ -949,6 +953,14 @@ hist_entry__cmp_wdiff(struct perf_hpp_fmt *fmt,
  }
static int64_t
+hist_entry__cmp_cycles(struct perf_hpp_fmt *fmt __maybe_unused,
+                      struct hist_entry *left __maybe_unused,
+                      struct hist_entry *right __maybe_unused)
+{
+       return 0;
+}

we have hist_entry__cmp_nop for that

SNIP

        default:
                BUG_ON(1);
        }
@@ -1407,6 +1452,12 @@ static int hpp__color_wdiff(struct perf_hpp_fmt *fmt,
        return __hpp__color_compare(fmt, hpp, he, COMPUTE_WEIGHTED_DIFF);
  }
+static int hpp__color_cycles(struct perf_hpp_fmt *fmt,
+                            struct perf_hpp *hpp, struct hist_entry *he)
+{
+       return __hpp__color_compare(fmt, hpp, he, COMPUTE_CYCLES);
+}
+
  static void
  hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
  {
@@ -1608,6 +1659,10 @@ static void data__hpp_register(struct data__file *d, int 
idx)
                fmt->color = hpp__color_delta;
                fmt->sort  = hist_entry__cmp_delta_abs;
                break;
+       case PERF_HPP_DIFF__CYCLES:
+               fmt->color = hpp__color_cycles;
+               fmt->sort  = hist_entry__cmp_cycles;

also please explain in comment why it's nop

jirka


Got it, I will update the patch.

Thanks
Jin Yao

Reply via email to