Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1436954

Re: [PATCH] perf: fix pmu::filter_match for SW-led groups

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf: fix pmu::filter_match for SW-led groups
Date 2016-07-05 14:10 +0200
Message-ID <rRxkS-2C5-37@gated-at.bofh.it> (permalink)
References <rJYid-6wL-9@gated-at.bofh.it> <rQwhc-5T4-35@gated-at.bofh.it> <rRgtH-sg-5@gated-at.bofh.it> <rRu3E-mM-37@gated-at.bofh.it> <rRv9o-ZE-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 05, 2016 at 10:44:48AM +0100, Mark Rutland wrote:
> My bad; I assumed that for both PMUs we'd start at the root, and thus
> would need to re-sort in order to get the current CPU's PMU ordered
> first, much like currently with rotation.
> 
> I guess I'm having difficulty figuring out the structure of that tree.
> If we can easily/cheaply find the relevant sub-tree then the above isn't
> an issue.

struct event {
	struct rb_node node;
	int pmu_id;
	s64 lag;
	...
};

bool event_less(struct rb_node *a, struct rb_node *b)
{
	struct event *left = rb_entry(a, struct event, node);
	struct event *right = rb_entry(b, struct event, node);

	if (a->pmu_id < b->pmu_id)
		return true;

	if (b->pmu_id > a->pmu_id)
		return false;

	/* a->pmu_id == b->pmu_id */
	if (a->lag < b->lag)
		return true;

	return false;
}

Will give you a tree with primary order @pmu_id and secondary order
@lag.

Which you'd iterate like:

	for (event = event_find(pmu_id); event->pmu_id == pmu_id; event = event_next(event)) {
	}

And get only the events matching @pmu_id in @lag order.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Peter Zijlstra <peterz@infradead.org> - 2016-07-02 18:50 +0200
  Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Mark Rutland <mark.rutland@arm.com> - 2016-07-04 20:10 +0200
    Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Peter Zijlstra <peterz@infradead.org> - 2016-07-05 10:40 +0200
      Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Mark Rutland <mark.rutland@arm.com> - 2016-07-05 11:50 +0200
        Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Peter Zijlstra <peterz@infradead.org> - 2016-07-05 14:10 +0200
          Re: [PATCH] perf: fix pmu::filter_match for SW-led groups Mark Rutland <mark.rutland@arm.com> - 2016-07-05 15:00 +0200

csiph-web