-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After we use the filters to zoom into DSOs or threads, we can use <- (left arrow) to zoom out from the last filter applied. It is still possible to zoom out of order by using the popup menu. With this we now have the zoom out operation on the browsing fast path, by allowing fast navigation using just the four arrors and the enter key to expand collapse callchains. Suggested-by: Ingo Molnar <mingo@elte.hu> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Arnaldo Carvalho de Melo
committed
May 14, 2010
1 parent
c82ee82
commit 3e1bbdc
Showing
4 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Simple pointer stack | ||
* | ||
* (c) 2010 Arnaldo Carvalho de Melo <acme@redhat.com> | ||
*/ | ||
|
||
#include "util.h" | ||
#include "pstack.h" | ||
#include <linux/kernel.h> | ||
#include <stdlib.h> | ||
|
||
struct pstack { | ||
unsigned short top; | ||
unsigned short max_nr_entries; | ||
void *entries[0]; | ||
}; | ||
|
||
struct pstack *pstack__new(unsigned short max_nr_entries) | ||
{ | ||
struct pstack *self = zalloc((sizeof(*self) + | ||
max_nr_entries * sizeof(void *))); | ||
if (self != NULL) | ||
self->max_nr_entries = max_nr_entries; | ||
return self; | ||
} | ||
|
||
void pstack__delete(struct pstack *self) | ||
{ | ||
free(self); | ||
} | ||
|
||
bool pstack__empty(const struct pstack *self) | ||
{ | ||
return self->top == 0; | ||
} | ||
|
||
void pstack__remove(struct pstack *self, void *key) | ||
{ | ||
unsigned short i = self->top, last_index = self->top - 1; | ||
|
||
while (i-- != 0) { | ||
if (self->entries[i] == key) { | ||
if (i < last_index) | ||
memmove(self->entries + i, | ||
self->entries + i + 1, | ||
(last_index - i) * sizeof(void *)); | ||
--self->top; | ||
return; | ||
} | ||
} | ||
pr_err("%s: %p not on the pstack!\n", __func__, key); | ||
} | ||
|
||
void pstack__push(struct pstack *self, void *key) | ||
{ | ||
if (self->top == self->max_nr_entries) { | ||
pr_err("%s: top=%d, overflow!\n", __func__, self->top); | ||
return; | ||
} | ||
self->entries[self->top++] = key; | ||
} | ||
|
||
void *pstack__pop(struct pstack *self) | ||
{ | ||
void *ret; | ||
|
||
if (self->top == 0) { | ||
pr_err("%s: underflow!\n", __func__); | ||
return NULL; | ||
} | ||
|
||
ret = self->entries[--self->top]; | ||
self->entries[self->top] = NULL; | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef _PERF_PSTACK_ | ||
#define _PERF_PSTACK_ | ||
|
||
struct pstack; | ||
struct pstack *pstack__new(unsigned short max_nr_entries); | ||
void pstack__delete(struct pstack *self); | ||
bool pstack__empty(const struct pstack *self); | ||
void pstack__remove(struct pstack *self, void *key); | ||
void pstack__push(struct pstack *self, void *key); | ||
void *pstack__pop(struct pstack *self); | ||
|
||
#endif /* _PERF_PSTACK_ */ |