Re: [PATCH v2 3/5] perf report: Sort by sampled cycles percent per block for stdio

From: Jin, Yao
Date: Mon Oct 21 2019 - 21:04:42 EST




On 10/22/2019 12:08 AM, Jiri Olsa wrote:
On Tue, Oct 15, 2019 at 01:33:48PM +0800, Jin Yao wrote:

SNIP

+ cycles += bi->cycles_aggr / bi->num_aggr;
+
+ he_block = hists__add_entry_block(&bh->block_hists,
+ &al, bi);
+ if (!he_block) {
+ block_info__put(bi);
+ return -1;
+ }
+ }
+ }
+
+ if (block_cycles)
+ *block_cycles += cycles;
+
+ return 0;
+}
+
+static int resort_cb(struct hist_entry *he, void *arg __maybe_unused)
+{
+ /* Skip the calculation of column length in output_resort */
+ he->filtered = true;

that's a nasty hack ;-) together with setting it back to false just below

why do you want to skip the columns calculation? we could add those columns
to the output as well no?

jirka


The columns calculation for this case causes the crash. The current columns calculation requires some information but we don't provide. So I just want to skip the columns calculation.

OK, I will check how to avoid this nasty hack.

Thanks
Jin Yao

+ return 0;
+}
+
+static void hists__clear_filtered(struct hists *hists)
+{
+ struct rb_node *next = rb_first_cached(&hists->entries);
+ struct hist_entry *he;
+
+ while (next) {
+ he = rb_entry(next, struct hist_entry, rb_node);
+ he->filtered = false;
+ next = rb_next(&he->rb_node);
+ }
+}

SNIP

jirka