diff options
Diffstat (limited to 'tools/perf/ui')
| -rw-r--r-- | tools/perf/ui/browser.c | 9 | ||||
| -rw-r--r-- | tools/perf/ui/browser.h | 1 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/annotate.c | 158 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/hists.c | 7 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/map.c | 60 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/scripts.c | 1 | ||||
| -rw-r--r-- | tools/perf/ui/gtk/annotate.c | 26 | ||||
| -rw-r--r-- | tools/perf/ui/gtk/hists.c | 7 | ||||
| -rw-r--r-- | tools/perf/ui/hist.c | 7 | ||||
| -rw-r--r-- | tools/perf/ui/tui/setup.c | 21 | ||||
| -rw-r--r-- | tools/perf/ui/ui.h | 2 | 
11 files changed, 164 insertions, 135 deletions
| diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 809ea4632a3..bbc782e364b 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c @@ -2,7 +2,6 @@  #include "../cache.h"  #include "../../perf.h"  #include "libslang.h" -#include <newt.h>  #include "ui.h"  #include "util.h"  #include <linux/compiler.h> @@ -234,7 +233,7 @@ void ui_browser__reset_index(struct ui_browser *browser)  void __ui_browser__show_title(struct ui_browser *browser, const char *title)  {  	SLsmg_gotorc(0, 0); -	ui_browser__set_color(browser, NEWT_COLORSET_ROOT); +	ui_browser__set_color(browser, HE_COLORSET_ROOT);  	slsmg_write_nstring(title, browser->width + 1);  } @@ -514,6 +513,12 @@ static struct ui_browser_colorset {  		.bg	  = "default",  	},  	{ +		.colorset = HE_COLORSET_ROOT, +		.name	  = "root", +		.fg	  = "white", +		.bg	  = "blue", +	}, +	{  		.name = NULL,  	}  }; diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h index af70314605e..404ff66a3e3 100644 --- a/tools/perf/ui/browser.h +++ b/tools/perf/ui/browser.h @@ -11,6 +11,7 @@  #define HE_COLORSET_SELECTED	53  #define HE_COLORSET_CODE	54  #define HE_COLORSET_ADDR	55 +#define HE_COLORSET_ROOT	56  struct ui_browser {  	u64	      index, top_idx; diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 7dca1555c61..cc64d3f7fc3 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -8,15 +8,19 @@  #include "../../util/hist.h"  #include "../../util/sort.h"  #include "../../util/symbol.h" +#include "../../util/evsel.h"  #include <pthread.h> -#include <newt.h>  struct browser_disasm_line {  	struct rb_node	rb_node; -	double		percent;  	u32		idx;  	int		idx_asm;  	int		jump_sources; +	/* +	 * actual length of this array is saved on the nr_events field +	 * of the struct annotate_browser +	 */ +	double		percent[1];  };  static struct annotate_browser_opt { @@ -33,8 +37,9 @@ struct annotate_browser {  	struct ui_browser b;  	struct rb_root	  entries;  	struct rb_node	  *curr_hot; -	struct disasm_line	  *selection; +	struct disasm_line  *selection;  	struct disasm_line  **offsets; +	int		    nr_events;  	u64		    start;  	int		    nr_asm_entries;  	int		    nr_entries; @@ -94,14 +99,24 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int  			     (!current_entry || (browser->use_navkeypressed &&  					         !browser->navkeypressed)));  	int width = browser->width, printed; +	int i, pcnt_width = 7 * ab->nr_events; +	double percent_max = 0.0;  	char bf[256]; -	if (dl->offset != -1 && bdl->percent != 0.0) { -		ui_browser__set_percent_color(browser, bdl->percent, current_entry); -		slsmg_printf("%6.2f ", bdl->percent); +	for (i = 0; i < ab->nr_events; i++) { +		if (bdl->percent[i] > percent_max) +			percent_max = bdl->percent[i]; +	} + +	if (dl->offset != -1 && percent_max != 0.0) { +		for (i = 0; i < ab->nr_events; i++) { +			ui_browser__set_percent_color(browser, bdl->percent[i], +						      current_entry); +			slsmg_printf("%6.2f ", bdl->percent[i]); +		}  	} else {  		ui_browser__set_percent_color(browser, 0, current_entry); -		slsmg_write_nstring(" ", 7); +		slsmg_write_nstring(" ", pcnt_width);  	}  	SLsmg_write_char(' '); @@ -111,12 +126,12 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int  		width += 1;  	if (!*dl->line) -		slsmg_write_nstring(" ", width - 7); +		slsmg_write_nstring(" ", width - pcnt_width);  	else if (dl->offset == -1) {  		printed = scnprintf(bf, sizeof(bf), "%*s  ",  				    ab->addr_width, " ");  		slsmg_write_nstring(bf, printed); -		slsmg_write_nstring(dl->line, width - printed - 6); +		slsmg_write_nstring(dl->line, width - printed - pcnt_width + 1);  	} else {  		u64 addr = dl->offset;  		int color = -1; @@ -175,7 +190,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int  		}  		disasm_line__scnprintf(dl, bf, sizeof(bf), !annotate_browser__opts.use_offset); -		slsmg_write_nstring(bf, width - 10 - printed); +		slsmg_write_nstring(bf, width - pcnt_width - 3 - printed);  	}  	if (current_entry) @@ -200,6 +215,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)  	unsigned int from, to;  	struct map_symbol *ms = ab->b.priv;  	struct symbol *sym = ms->sym; +	u8 pcnt_width = 7;  	/* PLT symbols contain external offsets */  	if (strstr(sym->name, "@plt")) @@ -223,57 +239,44 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)  		to = (u64)btarget->idx;  	} +	pcnt_width *= ab->nr_events; +  	ui_browser__set_color(browser, HE_COLORSET_CODE); -	__ui_browser__line_arrow(browser, 9 + ab->addr_width, from, to); +	__ui_browser__line_arrow(browser, pcnt_width + 2 + ab->addr_width, +				 from, to);  }  static unsigned int annotate_browser__refresh(struct ui_browser *browser)  { +	struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);  	int ret = ui_browser__list_head_refresh(browser); +	int pcnt_width; + +	pcnt_width = 7 * ab->nr_events;  	if (annotate_browser__opts.jump_arrows)  		annotate_browser__draw_current_jump(browser);  	ui_browser__set_color(browser, HE_COLORSET_NORMAL); -	__ui_browser__vline(browser, 7, 0, browser->height - 1); +	__ui_browser__vline(browser, pcnt_width, 0, browser->height - 1);  	return ret;  } -static double disasm_line__calc_percent(struct disasm_line *dl, struct symbol *sym, int evidx) +static int disasm__cmp(struct browser_disasm_line *a, +		       struct browser_disasm_line *b, int nr_pcnt)  { -	double percent = 0.0; - -	if (dl->offset != -1) { -		int len = sym->end - sym->start; -		unsigned int hits = 0; -		struct annotation *notes = symbol__annotation(sym); -		struct source_line *src_line = notes->src->lines; -		struct sym_hist *h = annotation__histogram(notes, evidx); -		s64 offset = dl->offset; -		struct disasm_line *next; +	int i; -		next = disasm__get_next_ip_line(¬es->src->source, dl); -		while (offset < (s64)len && -		       (next == NULL || offset < next->offset)) { -			if (src_line) { -				percent += src_line[offset].percent; -			} else -				hits += h->addr[offset]; - -			++offset; -		} -		/* - 		 * If the percentage wasn't already calculated in - 		 * symbol__get_source_line, do it now: - 		 */ -		if (src_line == NULL && h->sum) -			percent = 100.0 * hits / h->sum; +	for (i = 0; i < nr_pcnt; i++) { +		if (a->percent[i] == b->percent[i]) +			continue; +		return a->percent[i] < b->percent[i];  	} - -	return percent; +	return 0;  } -static void disasm_rb_tree__insert(struct rb_root *root, struct browser_disasm_line *bdl) +static void disasm_rb_tree__insert(struct rb_root *root, struct browser_disasm_line *bdl, +				   int nr_events)  {  	struct rb_node **p = &root->rb_node;  	struct rb_node *parent = NULL; @@ -282,7 +285,8 @@ static void disasm_rb_tree__insert(struct rb_root *root, struct browser_disasm_l  	while (*p != NULL) {  		parent = *p;  		l = rb_entry(parent, struct browser_disasm_line, rb_node); -		if (bdl->percent < l->percent) + +		if (disasm__cmp(bdl, l, nr_events))  			p = &(*p)->rb_left;  		else  			p = &(*p)->rb_right; @@ -331,12 +335,13 @@ static void annotate_browser__set_rb_top(struct annotate_browser *browser,  }  static void annotate_browser__calc_percent(struct annotate_browser *browser, -					   int evidx) +					   struct perf_evsel *evsel)  {  	struct map_symbol *ms = browser->b.priv;  	struct symbol *sym = ms->sym;  	struct annotation *notes = symbol__annotation(sym); -	struct disasm_line *pos; +	struct disasm_line *pos, *next; +	s64 len = symbol__size(sym);  	browser->entries = RB_ROOT; @@ -344,12 +349,34 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,  	list_for_each_entry(pos, ¬es->src->source, node) {  		struct browser_disasm_line *bpos = disasm_line__browser(pos); -		bpos->percent = disasm_line__calc_percent(pos, sym, evidx); -		if (bpos->percent < 0.01) { +		const char *path = NULL; +		double max_percent = 0.0; +		int i; + +		if (pos->offset == -1) { +			RB_CLEAR_NODE(&bpos->rb_node); +			continue; +		} + +		next = disasm__get_next_ip_line(¬es->src->source, pos); + +		for (i = 0; i < browser->nr_events; i++) { +			bpos->percent[i] = disasm__calc_percent(notes, +						evsel->idx + i, +						pos->offset, +						next ? next->offset : len, +					        &path); + +			if (max_percent < bpos->percent[i]) +				max_percent = bpos->percent[i]; +		} + +		if (max_percent < 0.01) {  			RB_CLEAR_NODE(&bpos->rb_node);  			continue;  		} -		disasm_rb_tree__insert(&browser->entries, bpos); +		disasm_rb_tree__insert(&browser->entries, bpos, +				       browser->nr_events);  	}  	pthread_mutex_unlock(¬es->lock); @@ -401,7 +428,8 @@ static void annotate_browser__init_asm_mode(struct annotate_browser *browser)  	browser->b.nr_entries = browser->nr_asm_entries;  } -static bool annotate_browser__callq(struct annotate_browser *browser, int evidx, +static bool annotate_browser__callq(struct annotate_browser *browser, +				    struct perf_evsel *evsel,  				    struct hist_browser_timer *hbt)  {  	struct map_symbol *ms = browser->b.priv; @@ -432,7 +460,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser, int evidx,  	}  	pthread_mutex_unlock(¬es->lock); -	symbol__tui_annotate(target, ms->map, evidx, hbt); +	symbol__tui_annotate(target, ms->map, evsel, hbt);  	ui_browser__show_title(&browser->b, sym->name);  	return true;  } @@ -615,7 +643,8 @@ static void annotate_browser__update_addr_width(struct annotate_browser *browser  		browser->addr_width += browser->jumps_width + 1;  } -static int annotate_browser__run(struct annotate_browser *browser, int evidx, +static int annotate_browser__run(struct annotate_browser *browser, +				 struct perf_evsel *evsel,  				 struct hist_browser_timer *hbt)  {  	struct rb_node *nd = NULL; @@ -628,7 +657,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx,  	if (ui_browser__show(&browser->b, sym->name, help) < 0)  		return -1; -	annotate_browser__calc_percent(browser, evidx); +	annotate_browser__calc_percent(browser, evsel);  	if (browser->curr_hot) {  		annotate_browser__set_rb_top(browser, browser->curr_hot); @@ -641,7 +670,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx,  		key = ui_browser__run(&browser->b, delay_secs);  		if (delay_secs != 0) { -			annotate_browser__calc_percent(browser, evidx); +			annotate_browser__calc_percent(browser, evsel);  			/*  			 * Current line focus got out of the list of most active  			 * lines, NULL it so that if TAB|UNTAB is pressed, we @@ -657,7 +686,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx,  				hbt->timer(hbt->arg);  			if (delay_secs != 0) -				symbol__annotate_decay_histogram(sym, evidx); +				symbol__annotate_decay_histogram(sym, evsel->idx);  			continue;  		case K_TAB:  			if (nd != NULL) { @@ -754,7 +783,7 @@ show_help:  					goto show_sup_ins;  				goto out;  			} else if (!(annotate_browser__jump(browser) || -				     annotate_browser__callq(browser, evidx, hbt))) { +				     annotate_browser__callq(browser, evsel, hbt))) {  show_sup_ins:  				ui_helpline__puts("Actions are only available for 'callq', 'retq' & jump instructions.");  			} @@ -776,10 +805,10 @@ out:  	return key;  } -int hist_entry__tui_annotate(struct hist_entry *he, int evidx, +int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,  			     struct hist_browser_timer *hbt)  { -	return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx, hbt); +	return symbol__tui_annotate(he->ms.sym, he->ms.map, evsel, hbt);  }  static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, @@ -826,7 +855,8 @@ static inline int width_jumps(int n)  	return 1;  } -int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, +int symbol__tui_annotate(struct symbol *sym, struct map *map, +			 struct perf_evsel *evsel,  			 struct hist_browser_timer *hbt)  {  	struct disasm_line *pos, *n; @@ -847,6 +877,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,  		},  	};  	int ret = -1; +	int nr_pcnt = 1; +	size_t sizeof_bdl = sizeof(struct browser_disasm_line);  	if (sym == NULL)  		return -1; @@ -862,7 +894,12 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,  		return -1;  	} -	if (symbol__annotate(sym, map, sizeof(struct browser_disasm_line)) < 0) { +	if (perf_evsel__is_group_event(evsel)) { +		nr_pcnt = evsel->nr_members; +		sizeof_bdl += sizeof(double) * (nr_pcnt - 1); +	} + +	if (symbol__annotate(sym, map, sizeof_bdl) < 0) {  		ui__error("%s", ui_helpline__last_msg);  		goto out_free_offsets;  	} @@ -900,6 +937,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,  	browser.addr_width = browser.target_width = browser.min_addr_width = hex_width(size);  	browser.max_addr_width = hex_width(sym->end);  	browser.jumps_width = width_jumps(browser.max_jump_sources); +	browser.nr_events = nr_pcnt;  	browser.b.nr_entries = browser.nr_entries;  	browser.b.entries = ¬es->src->source,  	browser.b.width += 18; /* Percentage */ @@ -909,7 +947,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,  	annotate_browser__update_addr_width(&browser); -	ret = annotate_browser__run(&browser, evidx, hbt); +	ret = annotate_browser__run(&browser, evsel, hbt);  	list_for_each_entry_safe(pos, n, ¬es->src->source, node) {  		list_del(&pos->node);  		disasm_line__free(pos); diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index aa22704047d..d88a2d0acb6 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -2,7 +2,6 @@  #include "../libslang.h"  #include <stdlib.h>  #include <string.h> -#include <newt.h>  #include <linux/rbtree.h>  #include "../../util/evsel.h" @@ -1193,7 +1192,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size,  	char buf[512];  	size_t buflen = sizeof(buf); -	if (symbol_conf.event_group && evsel->nr_members > 1) { +	if (perf_evsel__is_group_event(evsel)) {  		struct perf_evsel *pos;  		perf_evsel__group_desc(evsel, buf, buflen); @@ -1599,7 +1598,7 @@ do_annotate:  			 * Don't let this be freed, say, by hists__decay_entry.  			 */  			he->used = true; -			err = hist_entry__tui_annotate(he, evsel->idx, hbt); +			err = hist_entry__tui_annotate(he, evsel, hbt);  			he->used = false;  			/*  			 * offer option to annotate the other branch source or target @@ -1709,7 +1708,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser,  	ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED :  						       HE_COLORSET_NORMAL); -	if (symbol_conf.event_group && evsel->nr_members > 1) { +	if (perf_evsel__is_group_event(evsel)) {  		struct perf_evsel *pos;  		ev_name = perf_evsel__group_name(evsel); diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index 98851d55a53..95c7cfb8f2c 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c @@ -1,6 +1,5 @@  #include "../libslang.h"  #include <elf.h> -#include <newt.h>  #include <inttypes.h>  #include <sys/ttydefaults.h>  #include <string.h> @@ -10,41 +9,9 @@  #include "../../util/symbol.h"  #include "../browser.h"  #include "../helpline.h" +#include "../keysyms.h"  #include "map.h" -static int ui_entry__read(const char *title, char *bf, size_t size, int width) -{ -	struct newtExitStruct es; -	newtComponent form, entry; -	const char *result; -	int err = -1; - -	newtCenteredWindow(width, 1, title); -	form = newtForm(NULL, NULL, 0); -	if (form == NULL) -		return -1; - -	entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL); -	if (entry == NULL) -		goto out_free_form; - -	newtFormAddComponent(form, entry); -	newtFormAddHotKey(form, NEWT_KEY_ENTER); -	newtFormAddHotKey(form, NEWT_KEY_ESCAPE); -	newtFormAddHotKey(form, NEWT_KEY_LEFT); -	newtFormAddHotKey(form, CTRL('c')); -	newtFormRun(form, &es); - -	if (result != NULL) { -		strncpy(bf, result, size); -		err = 0; -	} -out_free_form: -	newtPopWindow(); -	newtFormDestroy(form); -	return err; -} -  struct map_browser {  	struct ui_browser b;  	struct map	  *map; @@ -78,10 +45,11 @@ static int map_browser__search(struct map_browser *self)  {  	char target[512];  	struct symbol *sym; -	int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40); - -	if (err) -		return err; +	int err = ui_browser__input_window("Search by name/addr", +					   "Prefix with 0x to search by address", +					   target, "ENTER: OK, ESC: Cancel", 0); +	if (err != K_ENTER) +		return -1;  	if (target[0] == '0' && tolower(target[1]) == 'x') {  		u64 addr = strtoull(target, NULL, 16); @@ -112,12 +80,20 @@ static int map_browser__run(struct map_browser *self)  	while (1) {  		key = ui_browser__run(&self->b, 0); -		if (verbose && key == '/') -			map_browser__search(self); -		else +		switch (key) { +		case '/': +			if (verbose) +				map_browser__search(self); +		default:  			break; +                case K_LEFT: +                case K_ESC: +                case 'q': +                case CTRL('c'): +                        goto out; +		}  	} - +out:  	ui_browser__hide(&self->b);  	return key;  } diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c index cbbd44b0d93..12f009e61e9 100644 --- a/tools/perf/ui/browsers/scripts.c +++ b/tools/perf/ui/browsers/scripts.c @@ -1,5 +1,4 @@  #include <elf.h> -#include <newt.h>  #include <inttypes.h>  #include <sys/ttydefaults.h>  #include <string.h> diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index 7d8dc581a54..f538794615d 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c @@ -1,6 +1,7 @@  #include "gtk.h"  #include "util/debug.h"  #include "util/annotate.h" +#include "util/evsel.h"  #include "ui/helpline.h" @@ -32,7 +33,7 @@ static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym,  		return 0;  	symhist = annotation__histogram(symbol__annotation(sym), evidx); -	if (!symhist->addr[dl->offset]) +	if (!symbol_conf.event_group && !symhist->addr[dl->offset])  		return 0;  	percent = 100.0 * symhist->addr[dl->offset] / symhist->sum; @@ -85,7 +86,7 @@ static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl)  }  static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, -				struct map *map, int evidx, +				struct map *map, struct perf_evsel *evsel,  				struct hist_browser_timer *hbt __maybe_unused)  {  	struct disasm_line *pos, *n; @@ -118,10 +119,24 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,  	list_for_each_entry(pos, ¬es->src->source, node) {  		GtkTreeIter iter; +		int ret = 0;  		gtk_list_store_append(store, &iter); -		if (perf_gtk__get_percent(s, sizeof(s), sym, pos, evidx)) +		if (perf_evsel__is_group_event(evsel)) { +			for (i = 0; i < evsel->nr_members; i++) { +				ret += perf_gtk__get_percent(s + ret, +							     sizeof(s) - ret, +							     sym, pos, +							     evsel->idx + i); +				ret += scnprintf(s + ret, sizeof(s) - ret, " "); +			} +		} else { +			ret = perf_gtk__get_percent(s, sizeof(s), sym, pos, +						    evsel->idx); +		} + +		if (ret)  			gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1);  		if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos))  			gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); @@ -139,7 +154,8 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,  	return 0;  } -int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, +int symbol__gtk_annotate(struct symbol *sym, struct map *map, +			 struct perf_evsel *evsel,  			 struct hist_browser_timer *hbt)  {  	GtkWidget *window; @@ -206,7 +222,7 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx,  	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window,  				 tab_label); -	perf_gtk__annotate_symbol(scrolled_window, sym, map, evidx, hbt); +	perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt);  	return 0;  } diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 1e764a8ad25..6f259b3d14e 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c @@ -32,21 +32,18 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,  	int ret;  	double percent = 0.0;  	struct hists *hists = he->hists; +	struct perf_evsel *evsel = hists_to_evsel(hists);  	if (hists->stats.total_period)  		percent = 100.0 * get_field(he) / hists->stats.total_period;  	ret = __percent_color_snprintf(hpp->buf, hpp->size, percent); -	if (symbol_conf.event_group) { +	if (perf_evsel__is_group_event(evsel)) {  		int prev_idx, idx_delta; -		struct perf_evsel *evsel = hists_to_evsel(hists);  		struct hist_entry *pair;  		int nr_members = evsel->nr_members; -		if (nr_members <= 1) -			return ret; -  		prev_idx = perf_evsel__group_idx(evsel);  		list_for_each_entry(pair, &he->pairs.head, pairs.node) { diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index d671e63aa35..4bf91b09d62 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -16,6 +16,7 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,  {  	int ret;  	struct hists *hists = he->hists; +	struct perf_evsel *evsel = hists_to_evsel(hists);  	if (fmt_percent) {  		double percent = 0.0; @@ -28,15 +29,11 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,  	} else  		ret = print_fn(hpp->buf, hpp->size, fmt, get_field(he)); -	if (symbol_conf.event_group) { +	if (perf_evsel__is_group_event(evsel)) {  		int prev_idx, idx_delta; -		struct perf_evsel *evsel = hists_to_evsel(hists);  		struct hist_entry *pair;  		int nr_members = evsel->nr_members; -		if (nr_members <= 1) -			return ret; -  		prev_idx = perf_evsel__group_idx(evsel);  		list_for_each_entry(pair, &he->pairs.head, pairs.node) { diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index 81efa192e86..b9401482d11 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c @@ -1,4 +1,3 @@ -#include <newt.h>  #include <signal.h>  #include <stdbool.h> @@ -88,13 +87,6 @@ int ui__getch(int delay_secs)  	return SLkp_getkey();  } -static void newt_suspend(void *d __maybe_unused) -{ -	newtSuspend(); -	raise(SIGTSTP); -	newtResume(); -} -  static void ui__signal(int sig)  {  	ui__exit(false); @@ -106,7 +98,17 @@ int ui__init(void)  {  	int err; -	newtInit(); +	SLutf8_enable(-1); +	SLtt_get_terminfo(); +	SLtt_get_screen_size(); + +	err = SLsmg_init_smg(); +	if (err < 0) +		goto out; +	err = SLang_init_tty(0, 0, 0); +	if (err < 0) +		goto out; +  	err = SLkp_init();  	if (err < 0) {  		pr_err("TUI initialization failed.\n"); @@ -115,7 +117,6 @@ int ui__init(void)  	SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB); -	newtSetSuspendCallback(newt_suspend, NULL);  	ui_helpline__init();  	ui_browser__init();  	ui_progress__init(); diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h index d86359c9990..70cb0d4eb8a 100644 --- a/tools/perf/ui/ui.h +++ b/tools/perf/ui/ui.h @@ -12,7 +12,7 @@ extern int use_browser;  void setup_browser(bool fallback_to_pager);  void exit_browser(bool wait_for_ok); -#ifdef NEWT_SUPPORT +#ifdef SLANG_SUPPORT  int ui__init(void);  void ui__exit(bool wait_for_ok);  #else |