perf/core improvements and changes
Subsystems (3)
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit f5540ecb8910cb2bc923c50b4ca5e7a50a9bf775:
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2016-01-19 08:30:48 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
for you to fetch changes up to 888b1187f17cff61527d6f9c314a63311f784dca:
perf config: Document 'hist.percentage' variable in man page (2016-01-21 11:55:21 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Rename the "colors.code" ~/.perfconfig variable to "colors.jump_arrows", as it controls just the that UI element in the annotate browser (Taeung Song)
- Fix 'perf test CQM' endless loop detected by 'gcc6 -Wmisleading-indentation' (Markus Trippelsdorf)
- Fix behaviour of Shift-Tab when nothing focussed in the annotate TUI browser, detected with gcc6 -Wmisleading-indentation (Markus Trippelsdorf)
- Avoid trying to read ELF symtabs from device files, noticed while doing memory profiling work (Jiri Olsa)
- Fix mem data cacheline hists browser widht setting for unresolved addresses (Jiri Olsa)
- Fix 'perf stat' stddev reporting due to mistakenly cleaning event private stats (Jiri Olsa)
Infrastructure:
- Elliminate duplication in the hists browser filter functions, getting the common part into a function that receives callbacks for filtering by DSO, thread, etc (Namhyung Kim)
Documentation:
- Document the perf sysctls in Documentation/sysctl/kernel.txt (Ben Hutchings)
- Document a bunch more ~/.perfconfig knobs (Taeung Song)
----------------------------------------------------------------
Ben Hutchings (1):
perf tools: Document the perf sysctls
Jiri Olsa (4):
perf symbols: Do not read symbols/data from device files perf hists: Fix HISTC_MEM_DCACHELINE width setting perf stat: Do not clean event's private stats perf stat: Making several helper functions static
Markus Trippelsdorf (3):
perf tests: Remove wrong semicolon in while loop in CQM test perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed perf pmu: Fix misleadingly indented assignment (whitespace)
Namhyung Kim (2):
perf hists: Remove parent filter check in DSO filter function perf hists: Cleanup filtering functions
Taeung Song (6):
perf annotate: Rename 'colors.code' to 'colors.jump_arrows' perf config: Document variables for 'colors' section in man page perf config: Document variables for 'tui' and 'gtk' sections in man page perf config: Document 'buildid.dir' variable in man page perf config: Document variables for 'annotate' section in man page perf config: Document 'hist.percentage' variable in man page
Documentation/sysctl/kernel.txt | 13 ++ tools/perf/Documentation/perf-config.txt | 200 +++++++++++++++++++++++++++- tools/perf/Documentation/perfconfig.example | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- tools/perf/ui/browser.c | 4 +- tools/perf/ui/browser.h | 2 +- tools/perf/ui/browsers/annotate.c | 6 +- tools/perf/util/dso.c | 5 + tools/perf/util/evsel.c | 15 ++- tools/perf/util/hist.c | 94 +++++-------- tools/perf/util/pmu.c | 2 +- tools/perf/util/stat.c | 15 +-- tools/perf/util/stat.h | 10 -- tools/perf/util/symbol.c | 6 +- tools/perf/util/util.c | 10 ++ tools/perf/util/util.h | 1 + 16 files changed, 289 insertions(+), 98 deletions(-)
Arnaldo Carvalho de Melo
maintainerPATCH 1/16 perf tests: Remove wrong semicolon in while loop in CQM test
From: Markus Trippelsdorf <[email protected]>
The while loop was spinning. Fix by removing a semicolon.
The issue was pointed out by gcc-6's -Wmisleading-indentation.
--- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/tests/intel-cqm.c +1 -1
@@ -17,7 +17,7 @@ static pid_t spawn(void)if (pid)return pid; -while (1 ); +while (1 )sleep (5 );return 0 ; }
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/16 perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed
In reply to Arnaldo Carvalho de MeloFrom: Markus Trippelsdorf <[email protected]>
The issue was pointed out by gcc-6's -Wmisleading-indentation.
--- tools/perf/ui/browsers/annotate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/ui/browsers/annotate.c +2 -2
@@ -755,11 +755,11 @@ static int annotate_browser__run(struct annotate_browser *browser, nd = browser->curr_hot;break ;case K_UNTAB : -if (nd !=NULL ) +if (nd !=NULL ) { nd =rb_next (nd);if (nd ==NULL ) nd =rb_first (&browser->entries); -else + }else nd = browser->curr_hot;break ;case K_F1 :
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 3/16 perf pmu: Fix misleadingly indented assignment (whitespace)
In reply to Arnaldo Carvalho de MeloFrom: Markus Trippelsdorf <[email protected]>
One line in perf_pmu__parse_unit() is indented wrongly, leading to a warning (=> error) from gcc 6:
util/pmu.c:156:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
sret = read(fd, alias->unit, UNIT_MAX_LEN);
^~~~ util/pmu.c:153:2: note: ...this 'if' clause, but it is not
if (fd == -1)
^~--- tools/perf/util/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/pmu.c +1 -1
@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *nif (fd ==-1 )return -1 ; - sret =read (fd, alias->unit,UNIT_MAX_LEN ); + sret =read (fd, alias->unit,UNIT_MAX_LEN );if (sret <0 ) goto error;
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 4/16 perf symbols: Do not read symbols/data from device files
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
With mem sampling we could get data source within mapped device file. Processing such sample would block during report phase on trying to read the device file.
Chacking for device files and skip the processing if it's detected.
--- tools/perf/util/dso.c | 5 +++++ tools/perf/util/symbol.c | 6 +++++- tools/perf/util/util.c | 10 ++++++++++ tools/perf/util/util.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-)
tools/perf/util/dso.c +5 -0
@@ -52,6 +52,11 @@ int dso__read_binary_type_filename(const struct dso *dso, debuglink--;if (*debuglink =='/' ) debuglink++; + + ret =-1 ; +if (!is_regular_file (filename)) +break ; + ret =filename__read_debuglink (filename, debuglink, size - (debuglink - filename)); }
tools/perf/util/symbol.c +5 -1
@@ -1466,7 +1466,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)* Read the build id if possible. This is required for * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work */ -if (filename__read_build_id (dso->long_name, build_id,BUILD_ID_SIZE ) >0 ) +if (is_regular_file (name) && +filename__read_build_id (dso->long_name, build_id,BUILD_ID_SIZE ) >0 )dso__set_build_id (dso, build_id);/*
@@ -1487,6 +1488,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) root_dir, name, PATH_MAX))continue ; +if (!is_regular_file (name)) +continue ; +/* Name is now the name of the next image to try */ if (symsrc__init (ss, dso, name, symtab_type) <0 )continue ;
tools/perf/util/util.c +10 -0
@@ -691,3 +691,13 @@ out:return tip; } + +bool is_regular_file (const char *file) +{ +struct stat st; + +if (stat (file, &st)) +return false; + +return S_ISREG (st.st_mode); +}
tools/perf/util/util.h +1 -0
@@ -343,5 +343,6 @@ int fetch_kernel_version(unsigned int *puint,#define KVER_PARAM (x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)const char *perf_tip (const char *dirpath); +bool is_regular_file (const char *file);#endif /* GIT_COMPAT_UTIL_H */
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 5/16 perf hists: Fix HISTC_MEM_DCACHELINE width setting
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Set correct width for unresolved mem_dcacheline addr.
--- tools/perf/util/hist.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/hist.c +2 -0
@@ -131,6 +131,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) symlen = unresolved_col_width +4 +2 ;hists__new_col_len (hists,HISTC_MEM_DADDR_SYMBOL , symlen); +hists__new_col_len (hists,HISTC_MEM_DCACHELINE , + symlen); }if (h->mem_info->iaddr.sym) {
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 6/16 perf stat: Do not clean event's private stats
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Mel reported stddev reporting was broken due to following commit:
106a94a0f8c2 ("perf stat: Introduce read_counters function")
This commit merged interval and overall counters reading into single read_counters function.
The old interval code cleaned the stddev data for some reason (it's never displayed in interval mode) and the mentioned commit kept on cleaning the stddev data in merged function, which resulted in the stddev not being displayed.
Removing the wrong stddev data cleanup init_stats call.
--- tools/perf/util/stat.c | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/stat.c +0 -1
@@ -310,7 +310,6 @@ int perf_stat_process_counter(struct perf_stat_config *config,int i, ret; aggr->val = aggr->ena = aggr->run =0 ; -init_stats (ps->res_stats);if (counter->per_pkg)zero_per_pkg (counter);
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 7/16 perf stat: Making several helper functions static
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
There's no need for the following functions to be global:
perf_evsel__reset_stat_priv
perf_evsel__alloc_stat_priv
perf_evsel__free_stat_priv
perf_evsel__alloc_prev_raw_counts
perf_evsel__free_prev_raw_counts
perf_evsel__alloc_stats
They all ended up in util/stat.c, and they no longer need to be called from outside this object.
--- tools/perf/util/stat.c | 14 +++++++------- tools/perf/util/stat.h | 10 ---------- 2 files changed, 7 insertions(+), 17 deletions(-)
tools/perf/util/stat.c +7 -7
@@ -97,7 +97,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel) } } -void perf_evsel__reset_stat_priv (struct perf_evsel *evsel) +static void perf_evsel__reset_stat_priv (struct perf_evsel *evsel) {int i;struct perf_stat_evsel *ps = evsel->priv;
@@ -108,7 +108,7 @@ void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)perf_stat_evsel_id_init (evsel); } -int perf_evsel__alloc_stat_priv (struct perf_evsel *evsel) +static int perf_evsel__alloc_stat_priv (struct perf_evsel *evsel) { evsel->priv =zalloc (sizeof (struct perf_stat_evsel ));if (evsel->priv ==NULL )
@@ -117,13 +117,13 @@ int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)return 0 ; } -void perf_evsel__free_stat_priv (struct perf_evsel *evsel) +static void perf_evsel__free_stat_priv (struct perf_evsel *evsel) {zfree (&evsel->priv); } -int perf_evsel__alloc_prev_raw_counts (struct perf_evsel *evsel, -int ncpus,int nthreads) +static int perf_evsel__alloc_prev_raw_counts (struct perf_evsel *evsel, +int ncpus,int nthreads) {struct perf_counts *counts;
@@ -134,13 +134,13 @@ int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,return counts ?0 : -ENOMEM ; } -void perf_evsel__free_prev_raw_counts (struct perf_evsel *evsel) +static void perf_evsel__free_prev_raw_counts (struct perf_evsel *evsel) {perf_counts__delete (evsel->prev_raw_counts); evsel->prev_raw_counts =NULL ; } -int perf_evsel__alloc_stats (struct perf_evsel *evsel,bool alloc_raw) +static int perf_evsel__alloc_stats (struct perf_evsel *evsel,bool alloc_raw) {int ncpus =perf_evsel__nr_cpus (evsel);int nthreads =thread_map__nr (evsel->threads);
tools/perf/util/stat.h +0 -10
@@ -74,16 +74,6 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,void perf_stat__print_shadow_stats (FILE *out,struct perf_evsel *evsel,double avg,int cpu,enum aggr_mode aggr); -void perf_evsel__reset_stat_priv (struct perf_evsel *evsel); -int perf_evsel__alloc_stat_priv (struct perf_evsel *evsel); -void perf_evsel__free_stat_priv (struct perf_evsel *evsel); - -int perf_evsel__alloc_prev_raw_counts (struct perf_evsel *evsel, -int ncpus,int nthreads); -void perf_evsel__free_prev_raw_counts (struct perf_evsel *evsel); - -int perf_evsel__alloc_stats (struct perf_evsel *evsel,bool alloc_raw); -int perf_evlist__alloc_stats (struct perf_evlist *evlist,bool alloc_raw);void perf_evlist__free_stats (struct perf_evlist *evlist);void perf_evlist__reset_stats (struct perf_evlist *evlist);
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 8/16 perf hists: Remove parent filter check in DSO filter function
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The --exclude-other option sets HIST_FILTER__PARENT bit and it's only set when a hist entry was created. DSO filters don't change this so no need to have the check in hists__filter_by_dso() IMHO.
--- tools/perf/util/hist.c | 3 --- 1 file changed, 3 deletions(-)
tools/perf/util/hist.c +0 -3
@@ -1266,9 +1266,6 @@ void hists__filter_by_dso(struct hists *hists)for (nd =rb_first (&hists->entries); nd; nd =rb_next (nd)) { struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); -if (symbol_conf.exclude_other && !h->parent) -continue ; -if (hists__filter_entry_by_dso (hists, h))continue ;
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 9/16 perf hists: Cleanup filtering functions
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The hists__filter_by_xxx functions share same logic with different filters. Factor out the common code into the hists__filter_by_type.
--- tools/perf/util/hist.c | 89 ++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 60 deletions(-)
tools/perf/util/hist.c +29 -60
@@ -1254,25 +1254,6 @@ static bool hists__filter_entry_by_dso(struct hists *hists,return false; } -void hists__filter_by_dso (struct hists *hists) -{ -struct rb_node *nd; - - hists->stats.nr_non_filtered_samples =0 ; - -hists__reset_filter_stats (hists); -hists__reset_col_len (hists); - -for (nd =rb_first (&hists->entries); nd; nd =rb_next (nd)) { - struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); - -if (hists__filter_entry_by_dso (hists, h)) -continue ; - -hists__remove_entry_filter (hists, h,HIST_FILTER__DSO ); - } -} -static bool hists__filter_entry_by_thread (struct hists *hists,struct hist_entry *he) {
@@ -1285,25 +1266,6 @@ static bool hists__filter_entry_by_thread(struct hists *hists,return false; } -void hists__filter_by_thread (struct hists *hists) -{ -struct rb_node *nd; - - hists->stats.nr_non_filtered_samples =0 ; - -hists__reset_filter_stats (hists); -hists__reset_col_len (hists); - -for (nd =rb_first (&hists->entries); nd; nd =rb_next (nd)) { - struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); - -if (hists__filter_entry_by_thread (hists, h)) -continue ; - -hists__remove_entry_filter (hists, h,HIST_FILTER__THREAD ); - } -} -static bool hists__filter_entry_by_symbol (struct hists *hists,struct hist_entry *he) {
@@ -1317,25 +1279,6 @@ static bool hists__filter_entry_by_symbol(struct hists *hists,return false; } -void hists__filter_by_symbol (struct hists *hists) -{ -struct rb_node *nd; - - hists->stats.nr_non_filtered_samples =0 ; - -hists__reset_filter_stats (hists); -hists__reset_col_len (hists); - -for (nd =rb_first (&hists->entries); nd; nd =rb_next (nd)) { - struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); - -if (hists__filter_entry_by_symbol (hists, h)) -continue ; - -hists__remove_entry_filter (hists, h,HIST_FILTER__SYMBOL ); - } -} -static bool hists__filter_entry_by_socket (struct hists *hists,struct hist_entry *he) {
@@ -1348,7 +1291,9 @@ static bool hists__filter_entry_by_socket(struct hists *hists,return false; } -void hists__filter_by_socket (struct hists *hists) +typedef bool (*filter_fn_t )(struct hists *hists,struct hist_entry *he); + +static void hists__filter_by_type (struct hists *hists,int type,filter_fn_t filter) {struct rb_node *nd;
@@ -1360,13 +1305,37 @@ void hists__filter_by_socket(struct hists *hists)for (nd =rb_first (&hists->entries); nd; nd =rb_next (nd)) { struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); -if (hists__filter_entry_by_socket (hists, h)) +if (filter (hists, h))continue ; -hists__remove_entry_filter (hists, h,HIST_FILTER__SOCKET ); +hists__remove_entry_filter (hists, h, type); } } +void hists__filter_by_thread (struct hists *hists) +{ +hists__filter_by_type (hists,HIST_FILTER__THREAD , + hists__filter_entry_by_thread); +} + +void hists__filter_by_dso (struct hists *hists) +{ +hists__filter_by_type (hists,HIST_FILTER__DSO , + hists__filter_entry_by_dso); +} + +void hists__filter_by_symbol (struct hists *hists) +{ +hists__filter_by_type (hists,HIST_FILTER__SYMBOL , + hists__filter_entry_by_symbol); +} + +void hists__filter_by_socket (struct hists *hists) +{ +hists__filter_by_type (hists,HIST_FILTER__SOCKET , + hists__filter_entry_by_socket); +} +void events_stats__inc (struct events_stats *stats,u32 type) { ++stats->nr_events[0 ];
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 10/16 perf tools: Document the perf sysctls
In reply to Arnaldo Carvalho de MeloFrom: Ben Hutchings <[email protected]>
perf_event_paranoid was only documented in source code and a perf error message. Copy the documentation from the error message to Documentation/sysctl/kernel.txt.
perf_cpu_time_max_percent was already documented but missing from the list at the top, so add it there.
--- Documentation/sysctl/kernel.txt | 13 +++++++++++++ tools/perf/util/evsel.c | 15 +++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-)
Documentation/sysctl/kernel.txt +13 -0
@@ -58,6 +58,8 @@ show up in /proc/sys/kernel: - panic_on_stackoverflow - panic_on_unrecovered_nmi - panic_on_warn +- perf_cpu_time_max_percent +- perf_event_paranoid - pid_max - powersave-nap [ PPC only ] - printk
@@ -639,6 +641,17 @@ allowed to execute. ============================================================== +perf_event_paranoid: + +Controls use of the performance events system by unprivileged +users (without CAP_SYS_ADMIN). The default value is 1. + + -1: Allow use of (almost) all events by all users +>=0: Disallow raw tracepoint access by users without CAP_IOC_LOCK +>=1: Disallow CPU event access by users without CAP_SYS_ADMIN +>=2: Disallow kernel profiling by users without CAP_SYS_ADMIN + +============================================================== pid_max:
tools/perf/util/evsel.c +9 -6
@@ -2362,12 +2362,15 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,case EPERM :case EACCES :return scnprintf (msg, size, -"You may not have permission to collect %sstats.\n" -"Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" -" -1 - Not paranoid at all\n" -" 0 - Disallow raw tracepoint access for unpriv\n" -" 1 - Disallow cpu events for unpriv\n" -" 2 - Disallow kernel profiling for unpriv" , +"You may not have permission to collect %sstats.\n\n" +"Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n" +"which controls use of the performance events system by\n" +"unprivileged users (without CAP_SYS_ADMIN).\n\n" +"The default value is 1:\n\n" +" -1: Allow use of (almost) all events by all users\n" +">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" +">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" +">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN" , target->system_wide ?"system-wide " :"" );case ENOENT : return scnprintf(msg, size, "The %s event is not supported.",
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 11/16 perf annotate: Rename 'colors.code' to 'colors.jump_arrows'
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
USe 'jump_arrows' config name instead of 'code' on 'colors' section. 'colors.code' config is only for jump arrows on assembly code listings i.e.
│ ┌──jmp 1333
│ │ xchg %ax,%ax
│ │ mov %r15,%r10
│ └─→cmp %r15,%r14But this config name seems unfit.
'jump_arrows' is more descriptive than 'code'.
--- tools/perf/Documentation/perf-config.txt | 2 +- tools/perf/Documentation/perfconfig.example | 2 +- tools/perf/ui/browser.c | 4 ++-- tools/perf/ui/browser.h | 2 +- tools/perf/ui/browsers/annotate.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/Documentation/perf-config.txt +1 -1
@@ -62,7 +62,7 @@ Given a $HOME/.perfconfig like this: medium = green, default normal = lightgray, default selected = white, lightgray - code = blue, default + jump_arrows = blue, default addr = magenta, default root = white, blue
tools/perf/Documentation/perfconfig.example +1 -1
@@ -5,7 +5,7 @@ medium = green, lightgray normal = black, lightgray selected = lightgray, magenta - code = blue, lightgray + jump_arrows = blue, lightgray addr = magenta, lightgray [tui]
tools/perf/ui/browser.c +2 -2
@@ -531,8 +531,8 @@ static struct ui_browser_colorset { .bg = "yellow", }, { - .colorset = HE_COLORSET_CODE, - .name = "code", + .colorset = HE_COLORSET_JUMP_ARROWS, + .name = "jump_arrows", .fg = "blue", .bg = "default", },
tools/perf/ui/browser.h +1 -1
@@ -7,7 +7,7 @@#define HE_COLORSET_MEDIUM 51#define HE_COLORSET_NORMAL 52#define HE_COLORSET_SELECTED 53 -#define HE_COLORSET_CODE 54 +#define HE_COLORSET_JUMP_ARROWS 54#define HE_COLORSET_ADDR 55#define HE_COLORSET_ROOT 56
tools/perf/ui/browsers/annotate.c +1 -1
@@ -284,7 +284,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) to = (u64 )btarget->idx; } -ui_browser__set_color (browser,HE_COLORSET_CODE ); +ui_browser__set_color (browser,HE_COLORSET_JUMP_ARROWS );__ui_browser__line_arrow (browser, pcnt_width +2 + ab->addr_width, from, to); }
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 12/16 perf config: Document variables for 'colors' section in man page
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
Explain 'colors' section and its variables, used for The variables for customizing the colors used in the output for the 'report', 'top' and 'annotate' in the TUI, those are:
'top', 'medium', 'normal', 'selected',
'jump_arrows', 'addr' and 'root'.
--- tools/perf/Documentation/perf-config.txt | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tools/perf/Documentation/perf-config.txt +46 -0
@@ -98,6 +98,52 @@ Given a $HOME/.perfconfig like this: order = caller sort-key = function +Variables +~~~~~~~~~ + +colors.*:: + The variables for customizing the colors used in the output for the + 'report', 'top' and 'annotate' in the TUI. They should specify the + foreground and background colors, separated by a comma, for example: + + medium = green, lightgray + + If you want to use the color configured for you terminal, just leave it + as 'default', for example: + + medium = default, lightgray + + Available colors: + red, yellow, green, cyan, gray, black, blue, + white, default, magenta, lightgray + + colors.top:: + 'top' means a overhead percentage which is more than 5%. + And values of this variable specify percentage colors. + Basic key values are foreground-color 'red' and + background-color 'default'. + colors.medium:: + 'medium' means a overhead percentage which has more than 0.5%. + Default values are 'green' and 'default'. + colors.normal:: + 'normal' means the rest of overhead percentages + except 'top', 'medium', 'selected'. + Default values are 'lightgray' and 'default'. + colors.selected:: + This selects the colors for the current entry in a list of entries + from sub-commands (top, report, annotate). + Default values are 'black' and 'lightgray'. + colors.jump_arrows:: + Colors for jump arrows on assembly code listings + such as 'jns', 'jmp', 'jane', etc. + Default values are 'blue', 'default'. + colors.addr:: + This selects colors for addresses from 'annotate'. + Default values are 'magenta', 'default'. + colors.root:: + Colors for headers in the output of a sub-commands (top, report). + Default values are 'white', 'blue'. + SEE ALSO -------- linkperf:perf[1]
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 13/16 perf config: Document variables for 'tui' and 'gtk' sections in man page
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
Explain 'tui' and 'gtk' sections and these variables.
'top', 'report' and 'annotate'
--- tools/perf/Documentation/perf-config.txt | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/perf/Documentation/perf-config.txt +10 -0
@@ -144,6 +144,16 @@ colors.*:: Colors for headers in the output of a sub-commands (top, report). Default values are 'white', 'blue'. +tui.*, gtk.*:: + Subcommands that can be configured here are 'top', 'report' and 'annotate'. + These values are booleans, for example: + + [tui] + top = true + + will make the TUI be the default for the 'top' subcommand. Those will be + available if the required libs were detected at tool build time. + SEE ALSO -------- linkperf:perf[1]
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 14/16 perf config: Document 'buildid.dir' variable in man page
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
Explain 'buildid.dir' variable.
--- tools/perf/Documentation/perf-config.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/perf/Documentation/perf-config.txt +15 -0
@@ -154,6 +154,21 @@ tui.*, gtk.*:: will make the TUI be the default for the 'top' subcommand. Those will be available if the required libs were detected at tool build time. +buildid.*:: + buildid.dir:: + Each executable and shared library in modern distributions comes with a + content based identifier that, if available, will be inserted in a + 'perf.data' file header to, at analysis time find what is needed to do + symbol resolution, code annotation, etc. + + The recording tools also stores a hard link or copy in a per-user + directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms + and /proc/kcore files to be used at analysis time. + + The buildid.dir variable can be used to either change this directory + cache location, or to disable it altogether. If you want to disable it, + set buildid.dir to /dev/null. The default is $HOME/.debug + SEE ALSO -------- linkperf:perf[1]
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 15/16 perf config: Document variables for 'annotate' section in man page
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
Explain 'annotate' section and its variables.
'hide_src_code', 'use_offset', 'jump_arrows', 'show_linenr', 'show_nr_jump' and 'show_total_period'.
--- tools/perf/Documentation/perf-config.txt | 110 +++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+)
tools/perf/Documentation/perf-config.txt +110 -0
@@ -169,6 +169,116 @@ buildid.*:: cache location, or to disable it altogether. If you want to disable it, set buildid.dir to /dev/null. The default is $HOME/.debug +annotate.*:: + These options work only for TUI. + These are in control of addresses, jump function, source code + in lines of assembly code from a specific program. + + annotate.hide_src_code:: + If a program which is analyzed has source code, + this option lets 'annotate' print a list of assembly code with the source code. + For example, let's see a part of a program. There're four lines. + If this option is 'true', they can be printed + without source code from a program as below. + + │ push %rbp + │ mov %rsp,%rbp + │ sub $0x10,%rsp + │ mov (%rdi),%rdx + + But if this option is 'false', source code of the part + can be also printed as below. Default is 'false'. + + │ struct rb_node *rb_next(const struct rb_node *node) + │ { + │ push %rbp + │ mov %rsp,%rbp + │ sub $0x10,%rsp + │ struct rb_node *parent; + │ + │ if (RB_EMPTY_NODE(node)) + │ mov (%rdi),%rdx + │ return n; + + annotate.use_offset:: + Basing on a first address of a loaded function, offset can be used. + Instead of using original addresses of assembly code, + addresses subtracted from a base address can be printed. + Let's illustrate an example. + If a base address is 0XFFFFFFFF81624d50 as below, + + ffffffff81624d50 <load0> + + an address on assembly code has a specific absolute address as below + + ffffffff816250b8:│ mov 0x8(%r14),%rdi + + but if use_offset is 'true', an address subtracted from a base address is printed. + Default is true. This option is only applied to TUI. + + 368:│ mov 0x8(%r14),%rdi + + annotate.jump_arrows:: + There can be jump instruction among assembly code. + Depending on a boolean value of jump_arrows, + arrows can be printed or not which represent + where do the instruction jump into as below. + + │ ┌──jmp 1333 + │ │ xchg %ax,%ax + │1330:│ mov %r15,%r10 + │1333:└─→cmp %r15,%r14 + + If jump_arrow is 'false', the arrows isn't printed as below. + Default is 'false'. + + │ ↓ jmp 1333 + │ xchg %ax,%ax + │1330: mov %r15,%r10 + │1333: cmp %r15,%r14 + + annotate.show_linenr:: + When showing source code if this option is 'true', + line numbers are printed as below. + + │1628 if (type & PERF_SAMPLE_IDENTIFIER) { + │ ↓ jne 508 + │1628 data->id = *array; + │1629 array++; + │1630 } + + However if this option is 'false', they aren't printed as below. + Default is 'false'. + + │ if (type & PERF_SAMPLE_IDENTIFIER) { + │ ↓ jne 508 + │ data->id = *array; + │ array++; + │ } + + annotate.show_nr_jumps:: + Let's see a part of assembly code. + + │1382: movb $0x1,-0x270(%rbp) + + If use this, the number of branches jumping to that address can be printed as below. + Default is 'false'. + + │1 1382: movb $0x1,-0x270(%rbp) + + annotate.show_total_period:: + To compare two records on an instruction base, with this option + provided, display total number of samples that belong to a line + in assembly code. If this option is 'true', total periods are printed + instead of percent values as below. + + 302 │ mov %eax,%eax + + But if this option is 'false', percent values for overhead are printed i.e. + Default is 'false'. + + 99.93 │ mov %eax,%eax + SEE ALSO -------- linkperf:perf[1]
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerPATCH 16/16 perf config: Document 'hist.percentage' variable in man page
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
Explain 'hist.percentage' variable.
--- tools/perf/Documentation/perf-config.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
tools/perf/Documentation/perf-config.txt +17 -0
@@ -279,6 +279,23 @@ annotate.*:: 99.93 │ mov %eax,%eax +hist.*:: + hist.percentage:: + This option control the way to calculate overhead of filtered entries - + that means the value of this option is effective only if there's a + filter (by comm, dso or symbol name). Suppose a following example: + + Overhead Symbols + ........ ....... + 33.33% foo + 33.33% bar + 33.33% baz + + This is an original overhead and we'll filter out the first 'foo' + entry. The value of 'relative' would increase the overhead of 'bar' + and 'baz' to 50.00% for each, while 'absolute' would show their + current overhead (33.33%). + SEE ALSO -------- linkperf:perf[1]
Signature · 1 line
2.5.0
Quoted 91 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit
f5540ecb8910cb2bc923c50b4ca5e7a50a9bf775:Merge tag 'perf-core-for-mingo' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/urgent (2016-01-19 08:30:48 +0100)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingofor you to fetch changes up to
888b1187f17cff61527d6f9c314a63311f784dca:perf config: Document 'hist.percentage' variable in man page (2016-01-21 11:55:21 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:User visible:
- Rename the "colors.code" ~/.perfconfig variable to "colors.jump_arrows", as it controls just the that UI element in the annotate browser (Taeung Song)
- Fix 'perf test CQM' endless loop detected by 'gcc6 -Wmisleading-indentation' (Markus Trippelsdorf)
- Fix behaviour of Shift-Tab when nothing focussed in the annotate TUI browser, detected with gcc6 -Wmisleading-indentation (Markus Trippelsdorf)
- Avoid trying to read ELF symtabs from device files, noticed while doing memory profiling work (Jiri Olsa)
- Fix mem data cacheline hists browser widht setting for unresolved addresses (Jiri Olsa)
- Fix 'perf stat' stddev reporting due to mistakenly cleaning event private stats (Jiri Olsa)
Infrastructure:
- Elliminate duplication in the hists browser filter functions, getting the common part into a function that receives callbacks for filtering by DSO, thread, etc (Namhyung Kim)
Documentation:
- Document the perf sysctls in
Documentation/sysctl/kernel.txt(Ben Hutchings)- Document a bunch more ~/.perfconfig knobs (Taeung Song)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Ben Hutchings (1):
perf tools: Document the perf sysctlsJiri Olsa (4):
perf symbols: Do not read symbols/data from device files perf hists: FixHISTC_MEM_DCACHELINEwidth setting perf stat: Do not clean event's private stats perf stat: Making several helper functions staticMarkus Trippelsdorf (3):
perf tests: Remove wrong semicolon in while loop in CQM test perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed perf pmu: Fix misleadingly indented assignment (whitespace)Namhyung Kim (2):
perf hists: Remove parent filter check in DSO filter function perf hists: Cleanup filtering functionsTaeung Song (6):
perf annotate: Rename 'colors.code' to 'colors.jump_arrows' perf config: Document variables for 'colors' section in man page perf config: Document variables for 'tui' and 'gtk' sections in man page perf config: Document 'buildid.dir' variable in man page perf config: Document variables for 'annotate' section in man page perf config: Document 'hist.percentage' variable in man pageDocumentation/sysctl/kernel.txt | 13 ++ tools/perf/Documentation/perf-config.txt | 200 +++++++++++++++++++++++++++- tools/perf/Documentation/perfconfig.example | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- tools/perf/ui/browser.c | 4 +- tools/perf/ui/browser.h | 2 +- tools/perf/ui/browsers/annotate.c | 6 +- tools/perf/util/dso.c | 5 + tools/perf/util/evsel.c | 15 ++-
Quoted 8 lines
tools/perf/util/hist.c | 94 +++++-------- tools/perf/util/pmu.c | 2 +- tools/perf/util/stat.c | 15 +-- tools/perf/util/stat.h | 10 -- tools/perf/util/symbol.c | 6 +- tools/perf/util/util.c | 10 ++ tools/perf/util/util.h | 1 + 16 files changed, 289 insertions(+), 98 deletions(-)
Pulled into tip:perf/core, thanks a lot Arnaldo!
Ingo