lkml.org 
[lkml]   [2020]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 3/6] perf: Use min_heap in visit_groups_merge
On Thu, Feb 13, 2020 at 11:51:30PM -0800, Ian Rogers wrote:
>
> - *evt = perf_event_groups_next(*evt);
> + next = perf_event_groups_next(itrs[0]);
> + if (next) {
> + min_heap_pop_push(&event_heap, &next,
> + &perf_min_heap);
> + } else
> + min_heap_pop(&event_heap, &perf_min_heap);
> }

Like this:

@@ -3585,9 +3581,9 @@ static noinline int visit_groups_merge(s
if (ret)
return ret;

- next = perf_event_groups_next(*evt);
- if (next)
- min_heap_pop_push(&event_heap, &next, &perf_min_heap);
+ *evt = perf_event_groups_next(*evt);
+ if (*evt)
+ min_heapify(&event_heap, 0, &perf_min_heap);
else
min_heap_pop(&event_heap, &perf_min_heap);
}

That's an 'obvious' replace and resort and obviates the need for that
weird pop that doesn't return nothing operation.

\
 
 \ /
  Last update: 2020-02-17 18:24    [W:0.076 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site