[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c8539e3fc630067020814657636b45095edfb5bb@git.kernel.org>
Date: Tue, 5 May 2015 20:22:13 -0700
From: tip-bot for Namhyung Kim <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: a.p.zijlstra@...llo.nl, dsahern@...il.com, hpa@...or.com,
linux-kernel@...r.kernel.org, mingo@...nel.org, acme@...hat.com,
jolsa@...hat.com, namhyung@...nel.org, tglx@...utronix.de
Subject: [tip:perf/core] perf tools: Introduce pstack_peek()
Commit-ID: c8539e3fc630067020814657636b45095edfb5bb
Gitweb: http://git.kernel.org/tip/c8539e3fc630067020814657636b45095edfb5bb
Author: Namhyung Kim <namhyung@...nel.org>
AuthorDate: Fri, 24 Apr 2015 10:15:32 +0900
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 5 May 2015 18:13:22 -0300
perf tools: Introduce pstack_peek()
The pstack_peek() is to get the topmost entry without removing it.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Acked-by: Jiri Olsa <jolsa@...hat.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/1429838133-14001-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/pstack.c | 7 +++++++
tools/perf/util/pstack.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c
index a126e6c..b234a6e 100644
--- a/tools/perf/util/pstack.c
+++ b/tools/perf/util/pstack.c
@@ -74,3 +74,10 @@ void *pstack__pop(struct pstack *pstack)
pstack->entries[pstack->top] = NULL;
return ret;
}
+
+void *pstack__peek(struct pstack *pstack)
+{
+ if (pstack->top == 0)
+ return NULL;
+ return pstack->entries[pstack->top - 1];
+}
diff --git a/tools/perf/util/pstack.h b/tools/perf/util/pstack.h
index c3cb658..ded7f2e 100644
--- a/tools/perf/util/pstack.h
+++ b/tools/perf/util/pstack.h
@@ -10,5 +10,6 @@ bool pstack__empty(const struct pstack *pstack);
void pstack__remove(struct pstack *pstack, void *key);
void pstack__push(struct pstack *pstack, void *key);
void *pstack__pop(struct pstack *pstack);
+void *pstack__peek(struct pstack *pstack);
#endif /* _PERF_PSTACK_ */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists