Skip to contentSkip to conversation

perf tui: Introduce list_head based generic ui_browser refresh routine

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Aug 7, 2010 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  43730982c3e9355dd8bd6b31f0a0a3508ad4209d
Gitweb:     http://git.kernel.org/tip/43730982c3e9355dd8bd6b31f0a0a3508ad4209d
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 6 Aug 2010 16:51:12 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 6 Aug 2010 16:51:12 -0300

perf tui: Introduce list_head based generic ui_browser refresh routine

So that building other browser based on structures linked via a linked list can be as easy as it is already for the ones linked via an rb_tree.

Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>

---
 tools/perf/util/include/linux/list.h |    8 +++++
 tools/perf/util/newt.c               |   49 ++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 25 deletions(-)
tools/perf/util/include/linux/list.h +8 -0
index dbe4b81..f5ca26e 100644
@@ -15,4 +15,12 @@ static inline void list_del_range(struct list_head *begin,
 	begin->prev->next = end->next;
 	end->next->prev = begin->prev;
 }
+
+/**
+ * list_for_each_from	-	iterate over a list from one of its nodes
+ * @pos:  the &struct list_head to use as a loop cursor, from where to start
+ * @head: the head for your list.
+ */
+#define list_for_each_from(pos, head) \
+	for (; prefetch(pos->next), pos != (head); pos = pos->next)
 #endif
tools/perf/util/newt.c +24 -25

101 lines not on this page · raw message