aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-07 12:56:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 15:08:33 -0400
commitd247eb6b924bbc2f13748c89b6c72c7a3d46645c (patch)
tree88be5eaca242e18622517825b670995a266660f3 /tools
parentef8f34aabf2450a9fb36b2c87fe0ea0b86a38195 (diff)
perf ui: Shorten ui_browser member names
LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/newt.c36
-rw-r--r--tools/perf/util/ui/browser.c57
-rw-r--r--tools/perf/util/ui/browser.h6
3 files changed, 49 insertions, 50 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 266a9e06525b..9768be31f9c5 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -450,8 +450,8 @@ static int map_browser__search(struct map_browser *self)
450 if (sym != NULL) { 450 if (sym != NULL) {
451 u32 *idx = symbol__browser_index(sym); 451 u32 *idx = symbol__browser_index(sym);
452 452
453 self->b.first_visible_entry = &sym->rb_node; 453 self->b.top = &sym->rb_node;
454 self->b.index = self->b.first_visible_entry_idx = *idx; 454 self->b.index = self->b.top_idx = *idx;
455 } else 455 } else
456 ui_helpline__fpush("%s not found!", target); 456 ui_helpline__fpush("%s not found!", target);
457 457
@@ -967,7 +967,7 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
967 } 967 }
968 968
969 SLsmg_set_color(color); 969 SLsmg_set_color(color);
970 SLsmg_gotorc(self->b.top + row, self->b.left); 970 SLsmg_gotorc(self->b.y + row, self->b.x);
971 slsmg_write_nstring(" ", offset + extra_offset); 971 slsmg_write_nstring(" ", offset + extra_offset);
972 slsmg_printf("%c ", folded_sign); 972 slsmg_printf("%c ", folded_sign);
973 slsmg_write_nstring(str, width); 973 slsmg_write_nstring(str, width);
@@ -1030,7 +1030,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *self,
1030 } 1030 }
1031 1031
1032 s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); 1032 s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
1033 SLsmg_gotorc(self->b.top + row, self->b.left); 1033 SLsmg_gotorc(self->b.y + row, self->b.x);
1034 SLsmg_set_color(color); 1034 SLsmg_set_color(color);
1035 slsmg_write_nstring(" ", offset); 1035 slsmg_write_nstring(" ", offset);
1036 slsmg_printf("%c ", folded_sign); 1036 slsmg_printf("%c ", folded_sign);
@@ -1110,7 +1110,7 @@ static int hist_browser__show_entry(struct hist_browser *self,
1110 } 1110 }
1111 1111
1112 SLsmg_set_color(color); 1112 SLsmg_set_color(color);
1113 SLsmg_gotorc(self->b.top + row, self->b.left); 1113 SLsmg_gotorc(self->b.y + row, self->b.x);
1114 if (symbol_conf.use_callchain) { 1114 if (symbol_conf.use_callchain) {
1115 slsmg_printf("%c ", folded_sign); 1115 slsmg_printf("%c ", folded_sign);
1116 width -= 2; 1116 width -= 2;
@@ -1138,10 +1138,10 @@ static unsigned int hist_browser__refresh(struct ui_browser *self)
1138 struct rb_node *nd; 1138 struct rb_node *nd;
1139 struct hist_browser *hb = container_of(self, struct hist_browser, b); 1139 struct hist_browser *hb = container_of(self, struct hist_browser, b);
1140 1140
1141 if (self->first_visible_entry == NULL) 1141 if (self->top == NULL)
1142 self->first_visible_entry = rb_first(&hb->hists->entries); 1142 self->top = rb_first(&hb->hists->entries);
1143 1143
1144 for (nd = self->first_visible_entry; nd; nd = rb_next(nd)) { 1144 for (nd = self->top; nd; nd = rb_next(nd)) {
1145 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 1145 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
1146 1146
1147 if (h->filtered) 1147 if (h->filtered)
@@ -1244,7 +1244,7 @@ static void ui_browser__hists_seek(struct ui_browser *self,
1244 nd = hists__filter_entries(rb_first(self->entries)); 1244 nd = hists__filter_entries(rb_first(self->entries));
1245 break; 1245 break;
1246 case SEEK_CUR: 1246 case SEEK_CUR:
1247 nd = self->first_visible_entry; 1247 nd = self->top;
1248 goto do_offset; 1248 goto do_offset;
1249 case SEEK_END: 1249 case SEEK_END:
1250 nd = hists__filter_prev_entries(rb_last(self->entries)); 1250 nd = hists__filter_prev_entries(rb_last(self->entries));
@@ -1258,7 +1258,7 @@ static void ui_browser__hists_seek(struct ui_browser *self,
1258 * Moves not relative to the first visible entry invalidates its 1258 * Moves not relative to the first visible entry invalidates its
1259 * row_offset: 1259 * row_offset:
1260 */ 1260 */
1261 h = rb_entry(self->first_visible_entry, struct hist_entry, rb_node); 1261 h = rb_entry(self->top, struct hist_entry, rb_node);
1262 h->row_offset = 0; 1262 h->row_offset = 0;
1263 1263
1264 /* 1264 /*
@@ -1286,7 +1286,7 @@ do_offset:
1286 } else { 1286 } else {
1287 h->row_offset += offset; 1287 h->row_offset += offset;
1288 offset = 0; 1288 offset = 0;
1289 self->first_visible_entry = nd; 1289 self->top = nd;
1290 break; 1290 break;
1291 } 1291 }
1292 } 1292 }
@@ -1294,7 +1294,7 @@ do_offset:
1294 if (nd == NULL) 1294 if (nd == NULL)
1295 break; 1295 break;
1296 --offset; 1296 --offset;
1297 self->first_visible_entry = nd; 1297 self->top = nd;
1298 } while (offset != 0); 1298 } while (offset != 0);
1299 } else if (offset < 0) { 1299 } else if (offset < 0) {
1300 while (1) { 1300 while (1) {
@@ -1307,7 +1307,7 @@ do_offset:
1307 } else { 1307 } else {
1308 h->row_offset += offset; 1308 h->row_offset += offset;
1309 offset = 0; 1309 offset = 0;
1310 self->first_visible_entry = nd; 1310 self->top = nd;
1311 break; 1311 break;
1312 } 1312 }
1313 } else { 1313 } else {
@@ -1317,7 +1317,7 @@ do_offset:
1317 } else { 1317 } else {
1318 h->row_offset = h->nr_rows + offset; 1318 h->row_offset = h->nr_rows + offset;
1319 offset = 0; 1319 offset = 0;
1320 self->first_visible_entry = nd; 1320 self->top = nd;
1321 break; 1321 break;
1322 } 1322 }
1323 } 1323 }
@@ -1327,7 +1327,7 @@ do_offset:
1327 if (nd == NULL) 1327 if (nd == NULL)
1328 break; 1328 break;
1329 ++offset; 1329 ++offset;
1330 self->first_visible_entry = nd; 1330 self->top = nd;
1331 if (offset == 0) { 1331 if (offset == 0) {
1332 /* 1332 /*
1333 * Last unfiltered hist_entry, check if it is 1333 * Last unfiltered hist_entry, check if it is
@@ -1342,7 +1342,7 @@ do_offset:
1342 first = false; 1342 first = false;
1343 } 1343 }
1344 } else { 1344 } else {
1345 self->first_visible_entry = nd; 1345 self->top = nd;
1346 h = rb_entry(nd, struct hist_entry, rb_node); 1346 h = rb_entry(nd, struct hist_entry, rb_node);
1347 h->row_offset = 0; 1347 h->row_offset = 0;
1348 } 1348 }
@@ -1463,7 +1463,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
1463 switch (es->u.key) { 1463 switch (es->u.key) {
1464 case 'd': { /* Debug */ 1464 case 'd': { /* Debug */
1465 static int seq; 1465 static int seq;
1466 struct hist_entry *h = rb_entry(self->b.first_visible_entry, 1466 struct hist_entry *h = rb_entry(self->b.top,
1467 struct hist_entry, rb_node); 1467 struct hist_entry, rb_node);
1468 ui_helpline__pop(); 1468 ui_helpline__pop();
1469 ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d", 1469 ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
@@ -1471,7 +1471,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
1471 self->hists->nr_entries, 1471 self->hists->nr_entries,
1472 self->b.height, 1472 self->b.height,
1473 self->b.index, 1473 self->b.index,
1474 self->b.first_visible_entry_idx, 1474 self->b.top_idx,
1475 h->row_offset, h->nr_rows); 1475 h->row_offset, h->nr_rows);
1476 } 1476 }
1477 continue; 1477 continue;
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 0b2b9306312d..edbb7dd9eb2e 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -49,7 +49,7 @@ void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whenc
49 pos = head->next; 49 pos = head->next;
50 break; 50 break;
51 case SEEK_CUR: 51 case SEEK_CUR:
52 pos = self->first_visible_entry; 52 pos = self->top;
53 break; 53 break;
54 case SEEK_END: 54 case SEEK_END:
55 pos = head->prev; 55 pos = head->prev;
@@ -66,7 +66,7 @@ void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whenc
66 pos = pos->prev; 66 pos = pos->prev;
67 } 67 }
68 68
69 self->first_visible_entry = pos; 69 self->top = pos;
70} 70}
71 71
72void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence) 72void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
@@ -79,7 +79,7 @@ void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
79 nd = rb_first(root); 79 nd = rb_first(root);
80 break; 80 break;
81 case SEEK_CUR: 81 case SEEK_CUR:
82 nd = self->first_visible_entry; 82 nd = self->top;
83 break; 83 break;
84 case SEEK_END: 84 case SEEK_END:
85 nd = rb_last(root); 85 nd = rb_last(root);
@@ -96,7 +96,7 @@ void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
96 nd = rb_prev(nd); 96 nd = rb_prev(nd);
97 } 97 }
98 98
99 self->first_visible_entry = nd; 99 self->top = nd;
100} 100}
101 101
102unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self) 102unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
@@ -104,13 +104,13 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
104 struct rb_node *nd; 104 struct rb_node *nd;
105 int row = 0; 105 int row = 0;
106 106
107 if (self->first_visible_entry == NULL) 107 if (self->top == NULL)
108 self->first_visible_entry = rb_first(self->entries); 108 self->top = rb_first(self->entries);
109 109
110 nd = self->first_visible_entry; 110 nd = self->top;
111 111
112 while (nd != NULL) { 112 while (nd != NULL) {
113 SLsmg_gotorc(self->top + row, self->left); 113 SLsmg_gotorc(self->y + row, self->x);
114 self->write(self, nd, row); 114 self->write(self, nd, row);
115 if (++row == self->height) 115 if (++row == self->height)
116 break; 116 break;
@@ -122,7 +122,7 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
122 122
123bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row) 123bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
124{ 124{
125 return (self->first_visible_entry_idx + row) == self->index; 125 return self->top_idx + row == self->index;
126} 126}
127 127
128void ui_browser__refresh_dimensions(struct ui_browser *self) 128void ui_browser__refresh_dimensions(struct ui_browser *self)
@@ -135,13 +135,13 @@ void ui_browser__refresh_dimensions(struct ui_browser *self)
135 self->height = rows - 5; 135 self->height = rows - 5;
136 if (self->height > self->nr_entries) 136 if (self->height > self->nr_entries)
137 self->height = self->nr_entries; 137 self->height = self->nr_entries;
138 self->top = (rows - self->height) / 2; 138 self->y = (rows - self->height) / 2;
139 self->left = (cols - self->width) / 2; 139 self->x = (cols - self->width) / 2;
140} 140}
141 141
142void ui_browser__reset_index(struct ui_browser *self) 142void ui_browser__reset_index(struct ui_browser *self)
143{ 143{
144 self->index = self->first_visible_entry_idx = 0; 144 self->index = self->top_idx = 0;
145 self->seek(self, 0, SEEK_SET); 145 self->seek(self, 0, SEEK_SET);
146} 146}
147 147
@@ -180,7 +180,7 @@ int ui_browser__refresh(struct ui_browser *self)
180 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1); 180 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
181 row = self->refresh(self); 181 row = self->refresh(self);
182 SLsmg_set_color(HE_COLORSET_NORMAL); 182 SLsmg_set_color(HE_COLORSET_NORMAL);
183 SLsmg_fill_region(self->top + row, self->left, 183 SLsmg_fill_region(self->y + row, self->x,
184 self->height - row, self->width, ' '); 184 self->height - row, self->width, ' ');
185 185
186 return 0; 186 return 0;
@@ -205,8 +205,8 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
205 if (self->index == self->nr_entries - 1) 205 if (self->index == self->nr_entries - 1)
206 break; 206 break;
207 ++self->index; 207 ++self->index;
208 if (self->index == self->first_visible_entry_idx + self->height) { 208 if (self->index == self->top_idx + self->height) {
209 ++self->first_visible_entry_idx; 209 ++self->top_idx;
210 self->seek(self, +1, SEEK_CUR); 210 self->seek(self, +1, SEEK_CUR);
211 } 211 }
212 break; 212 break;
@@ -214,34 +214,34 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
214 if (self->index == 0) 214 if (self->index == 0)
215 break; 215 break;
216 --self->index; 216 --self->index;
217 if (self->index < self->first_visible_entry_idx) { 217 if (self->index < self->top_idx) {
218 --self->first_visible_entry_idx; 218 --self->top_idx;
219 self->seek(self, -1, SEEK_CUR); 219 self->seek(self, -1, SEEK_CUR);
220 } 220 }
221 break; 221 break;
222 case NEWT_KEY_PGDN: 222 case NEWT_KEY_PGDN:
223 case ' ': 223 case ' ':
224 if (self->first_visible_entry_idx + self->height > self->nr_entries - 1) 224 if (self->top_idx + self->height > self->nr_entries - 1)
225 break; 225 break;
226 226
227 offset = self->height; 227 offset = self->height;
228 if (self->index + offset > self->nr_entries - 1) 228 if (self->index + offset > self->nr_entries - 1)
229 offset = self->nr_entries - 1 - self->index; 229 offset = self->nr_entries - 1 - self->index;
230 self->index += offset; 230 self->index += offset;
231 self->first_visible_entry_idx += offset; 231 self->top_idx += offset;
232 self->seek(self, +offset, SEEK_CUR); 232 self->seek(self, +offset, SEEK_CUR);
233 break; 233 break;
234 case NEWT_KEY_PGUP: 234 case NEWT_KEY_PGUP:
235 if (self->first_visible_entry_idx == 0) 235 if (self->top_idx == 0)
236 break; 236 break;
237 237
238 if (self->first_visible_entry_idx < self->height) 238 if (self->top_idx < self->height)
239 offset = self->first_visible_entry_idx; 239 offset = self->top_idx;
240 else 240 else
241 offset = self->height; 241 offset = self->height;
242 242
243 self->index -= offset; 243 self->index -= offset;
244 self->first_visible_entry_idx -= offset; 244 self->top_idx -= offset;
245 self->seek(self, -offset, SEEK_CUR); 245 self->seek(self, -offset, SEEK_CUR);
246 break; 246 break;
247 case NEWT_KEY_HOME: 247 case NEWT_KEY_HOME:
@@ -253,7 +253,7 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
253 offset = self->nr_entries - 1; 253 offset = self->nr_entries - 1;
254 254
255 self->index = self->nr_entries - 1; 255 self->index = self->nr_entries - 1;
256 self->first_visible_entry_idx = self->index - offset; 256 self->top_idx = self->index - offset;
257 self->seek(self, -offset, SEEK_END); 257 self->seek(self, -offset, SEEK_END);
258 break; 258 break;
259 default: 259 default:
@@ -271,14 +271,13 @@ unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
271 struct list_head *head = self->entries; 271 struct list_head *head = self->entries;
272 int row = 0; 272 int row = 0;
273 273
274 if (self->first_visible_entry == NULL || 274 if (self->top == NULL || self->top == self->entries)
275 self->first_visible_entry == self->entries) 275 self->top = head->next;
276 self->first_visible_entry = head->next;
277 276
278 pos = self->first_visible_entry; 277 pos = self->top;
279 278
280 list_for_each_from(pos, head) { 279 list_for_each_from(pos, head) {
281 SLsmg_gotorc(self->top + row, self->left); 280 SLsmg_gotorc(self->y + row, self->x);
282 self->write(self, pos, row); 281 self->write(self, pos, row);
283 if (++row == self->height) 282 if (++row == self->height)
284 break; 283 break;
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index bcc4391405bd..8eed24cf2854 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -13,9 +13,9 @@
13 13
14struct ui_browser { 14struct ui_browser {
15 newtComponent form, sb; 15 newtComponent form, sb;
16 u64 index, first_visible_entry_idx; 16 u64 index, top_idx;
17 void *first_visible_entry, *entries; 17 void *top, *entries;
18 u16 top, left, width, height; 18 u16 y, x, width, height;
19 void *priv; 19 void *priv;
20 unsigned int (*refresh)(struct ui_browser *self); 20 unsigned int (*refresh)(struct ui_browser *self);
21 void (*write)(struct ui_browser *self, void *entry, int row); 21 void (*write)(struct ui_browser *self, void *entry, int row);