diff options
author | Namhyung Kim <namhyung@kernel.org> | 2015-04-24 10:15:32 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-05 18:13:22 -0300 |
commit | c8539e3fc630067020814657636b45095edfb5bb (patch) | |
tree | 2fcfbf34968411b8be0d8fea7b93285b9d260986 /tools/perf/util/pstack.c | |
parent | ea7cd59233097984850adc0e4119644f089be734 (diff) | |
download | linux-c8539e3fc630067020814657636b45095edfb5bb.tar.gz linux-c8539e3fc630067020814657636b45095edfb5bb.tar.bz2 linux-c8539e3fc630067020814657636b45095edfb5bb.zip |
perf tools: Introduce pstack_peek()
The pstack_peek() is to get the topmost entry without removing it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429838133-14001-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/pstack.c')
-rw-r--r-- | tools/perf/util/pstack.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c index a126e6cc6e73..b234a6e3d0d4 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]; +} |