diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:18:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:18:41 -0500 |
commit | adc1ef1e37358d3c17d1a74a58b2e104fc0bda15 (patch) | |
tree | 6f43107a76ed87f2b817594d2d62246ab82cfba6 /tools/perf/util/pstack.c | |
parent | 84e53ff77cb1e005f49966cd6789109d84acc9e2 (diff) | |
parent | 07ac002f2fcc74c5be47b656d9201d5de84dc53d (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
- UAPI fixes, from David Howels
- Separate perf tests into multiple objects, one per test, from Jiri Olsa.
- Fixes to /proc/pid/maps parsing, preparatory to supporting data maps,
from Namhyung Kim
- Fix compile error for non-NEWT builds, from Namhyung Kim
- Implement ui_progress for GTK, from Namhyung Kim
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/pstack.c')
-rw-r--r-- | tools/perf/util/pstack.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c index 13d36faf64eb..daa17aeb6c63 100644 --- a/tools/perf/util/pstack.c +++ b/tools/perf/util/pstack.c | |||
@@ -17,59 +17,59 @@ struct pstack { | |||
17 | 17 | ||
18 | struct pstack *pstack__new(unsigned short max_nr_entries) | 18 | struct pstack *pstack__new(unsigned short max_nr_entries) |
19 | { | 19 | { |
20 | struct pstack *self = zalloc((sizeof(*self) + | 20 | struct pstack *pstack = zalloc((sizeof(*pstack) + |
21 | max_nr_entries * sizeof(void *))); | 21 | max_nr_entries * sizeof(void *))); |
22 | if (self != NULL) | 22 | if (pstack != NULL) |
23 | self->max_nr_entries = max_nr_entries; | 23 | pstack->max_nr_entries = max_nr_entries; |
24 | return self; | 24 | return pstack; |
25 | } | 25 | } |
26 | 26 | ||
27 | void pstack__delete(struct pstack *self) | 27 | void pstack__delete(struct pstack *pstack) |
28 | { | 28 | { |
29 | free(self); | 29 | free(pstack); |
30 | } | 30 | } |
31 | 31 | ||
32 | bool pstack__empty(const struct pstack *self) | 32 | bool pstack__empty(const struct pstack *pstack) |
33 | { | 33 | { |
34 | return self->top == 0; | 34 | return pstack->top == 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | void pstack__remove(struct pstack *self, void *key) | 37 | void pstack__remove(struct pstack *pstack, void *key) |
38 | { | 38 | { |
39 | unsigned short i = self->top, last_index = self->top - 1; | 39 | unsigned short i = pstack->top, last_index = pstack->top - 1; |
40 | 40 | ||
41 | while (i-- != 0) { | 41 | while (i-- != 0) { |
42 | if (self->entries[i] == key) { | 42 | if (pstack->entries[i] == key) { |
43 | if (i < last_index) | 43 | if (i < last_index) |
44 | memmove(self->entries + i, | 44 | memmove(pstack->entries + i, |
45 | self->entries + i + 1, | 45 | pstack->entries + i + 1, |
46 | (last_index - i) * sizeof(void *)); | 46 | (last_index - i) * sizeof(void *)); |
47 | --self->top; | 47 | --pstack->top; |
48 | return; | 48 | return; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | pr_err("%s: %p not on the pstack!\n", __func__, key); | 51 | pr_err("%s: %p not on the pstack!\n", __func__, key); |
52 | } | 52 | } |
53 | 53 | ||
54 | void pstack__push(struct pstack *self, void *key) | 54 | void pstack__push(struct pstack *pstack, void *key) |
55 | { | 55 | { |
56 | if (self->top == self->max_nr_entries) { | 56 | if (pstack->top == pstack->max_nr_entries) { |
57 | pr_err("%s: top=%d, overflow!\n", __func__, self->top); | 57 | pr_err("%s: top=%d, overflow!\n", __func__, pstack->top); |
58 | return; | 58 | return; |
59 | } | 59 | } |
60 | self->entries[self->top++] = key; | 60 | pstack->entries[pstack->top++] = key; |
61 | } | 61 | } |
62 | 62 | ||
63 | void *pstack__pop(struct pstack *self) | 63 | void *pstack__pop(struct pstack *pstack) |
64 | { | 64 | { |
65 | void *ret; | 65 | void *ret; |
66 | 66 | ||
67 | if (self->top == 0) { | 67 | if (pstack->top == 0) { |
68 | pr_err("%s: underflow!\n", __func__); | 68 | pr_err("%s: underflow!\n", __func__); |
69 | return NULL; | 69 | return NULL; |
70 | } | 70 | } |
71 | 71 | ||
72 | ret = self->entries[--self->top]; | 72 | ret = pstack->entries[--pstack->top]; |
73 | self->entries[self->top] = NULL; | 73 | pstack->entries[pstack->top] = NULL; |
74 | return ret; | 74 | return ret; |
75 | } | 75 | } |