diff options
Diffstat (limited to 'tools/perf/ui')
| -rw-r--r-- | tools/perf/ui/browsers/annotate.c | 23 | ||||
| -rw-r--r-- | tools/perf/ui/hist.c | 28 | ||||
| -rw-r--r-- | tools/perf/ui/tui/setup.c | 8 | 
3 files changed, 33 insertions, 26 deletions
| diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index e81c2493efdf..44ba900828f6 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -966,6 +966,7 @@ int symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,  		.opts = opts,  	};  	int ret = -1, err; +	int not_annotated = list_empty(¬es->src->source);  	if (sym == NULL)  		return -1; @@ -973,13 +974,15 @@ int symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,  	if (ms->map->dso->annotate_warned)  		return -1; -	err = symbol__annotate2(ms, evsel, opts, &browser.arch); -	if (err) { -		char msg[BUFSIZ]; -		ms->map->dso->annotate_warned = true; -		symbol__strerror_disassemble(ms, err, msg, sizeof(msg)); -		ui__error("Couldn't annotate %s:\n%s", sym->name, msg); -		goto out_free_offsets; +	if (not_annotated) { +		err = symbol__annotate2(ms, evsel, opts, &browser.arch); +		if (err) { +			char msg[BUFSIZ]; +			ms->map->dso->annotate_warned = true; +			symbol__strerror_disassemble(ms, err, msg, sizeof(msg)); +			ui__error("Couldn't annotate %s:\n%s", sym->name, msg); +			goto out_free_offsets; +		}  	}  	ui_helpline__push("Press ESC to exit"); @@ -994,9 +997,11 @@ int symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,  	ret = annotate_browser__run(&browser, evsel, hbt); -	annotated_source__purge(notes->src); +	if(not_annotated) +		annotated_source__purge(notes->src);  out_free_offsets: -	zfree(¬es->offsets); +	if(not_annotated) +		zfree(¬es->offsets);  	return ret;  } diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index c1f24d004852..5075ecead5f3 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -535,6 +535,18 @@ struct perf_hpp_list perf_hpp_list = {  #undef __HPP_SORT_ACC_FN  #undef __HPP_SORT_RAW_FN +static void fmt_free(struct perf_hpp_fmt *fmt) +{ +	/* +	 * At this point fmt should be completely +	 * unhooked, if not it's a bug. +	 */ +	BUG_ON(!list_empty(&fmt->list)); +	BUG_ON(!list_empty(&fmt->sort_list)); + +	if (fmt->free) +		fmt->free(fmt); +}  void perf_hpp__init(void)  { @@ -598,9 +610,10 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list,  	list_add(&format->sort_list, &list->sorts);  } -void perf_hpp__column_unregister(struct perf_hpp_fmt *format) +static void perf_hpp__column_unregister(struct perf_hpp_fmt *format)  {  	list_del_init(&format->list); +	fmt_free(format);  }  void perf_hpp__cancel_cumulate(void) @@ -672,19 +685,6 @@ next:  } -static void fmt_free(struct perf_hpp_fmt *fmt) -{ -	/* -	 * At this point fmt should be completely -	 * unhooked, if not it's a bug. -	 */ -	BUG_ON(!list_empty(&fmt->list)); -	BUG_ON(!list_empty(&fmt->sort_list)); - -	if (fmt->free) -		fmt->free(fmt); -} -  void perf_hpp__reset_output_field(struct perf_hpp_list *list)  {  	struct perf_hpp_fmt *fmt, *tmp; diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index e9bfe856a5de..b1be59b4e2a4 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c @@ -170,9 +170,11 @@ void ui__exit(bool wait_for_ok)  				    "Press any key...", 0);  	SLtt_set_cursor_visibility(1); -	SLsmg_refresh(); -	SLsmg_reset_smg(); +	if (!pthread_mutex_trylock(&ui__lock)) { +		SLsmg_refresh(); +		SLsmg_reset_smg(); +		pthread_mutex_unlock(&ui__lock); +	}  	SLang_reset_tty(); -  	perf_error__unregister(&perf_tui_eops);  } |