perf diff: Introduce delta-abs compute method (v2)
Namhyung Kim
maintainercover perf diff: Introduce delta-abs compute method (v2)
Hello,
This patchset adds 'delta-abs' compute method to -c/--compute option. The 'delta-abs' is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option.
* v2 changes
- rebase onto acme/perf/core
- change default option to '-o 1 -c delta-abs'
Below is default output (-c delta):
$ perf diff -o 1 -c delta | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
+1.15% [kernel.kallsyms] [k] copy_user_generic_string
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
+0.64% [kernel.kallsyms] [k] kmem_cache_alloc
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
+0.45% [kernel.kallsyms] [k] alloc_set_pte
0.16% +0.45% [kernel.kallsyms] [k] menu_select
+0.41% ld-2.24.so [.] do_lookup_xNow with 'delta-abs' it shows entries have bigger delta value either positive or negative.
$ perf diff -o 1 -c delta-abs | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
12.72% -3.01% [kernel.kallsyms] [k] intel_idle
9.72% -1.31% [unknown] [.] 0x0000000000411343
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
+1.15% [kernel.kallsyms] [k] copy_user_generic_string
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single
+0.64% [kernel.kallsyms] [k] kmem_cache_alloc
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlockThe patch 2 and 3 are to add config options to control the default behavior of perf diff command. And patch 4 changes the default setting.
The code is avaiable at 'perf/diff-delta-abs-v2' branch in
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Thanks,
Namhyung
Namhyung Kim (4):
perf diff: Add 'delta-abs' compute method perf diff: Add diff.order config option perf diff: Add diff.compute config option perf diff: Change default setting to "delta-abs"
tools/perf/Documentation/perf-config.txt | 12 +++++ tools/perf/Documentation/perf-diff.txt | 15 ++++-- tools/perf/builtin-diff.c | 78 ++++++++++++++++++++++++++++++-- 3 files changed, 98 insertions(+), 7 deletions(-)
Signature · 1 line
2.11.0
Namhyung Kim
maintainerPATCH v2 1/4 perf diff: Add 'delta-abs' compute method
The 'delta-abs' compute method is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option.
Below is default output (-c delta):
$ perf diff -o 1 -c delta | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
+1.15% [kernel.kallsyms] [k] copy_user_generic_string
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
+0.64% [kernel.kallsyms] [k] kmem_cache_alloc
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
+0.45% [kernel.kallsyms] [k] alloc_set_pte
0.16% +0.45% [kernel.kallsyms] [k] menu_select
+0.41% ld-2.24.so [.] do_lookup_xNow with 'delta-abs' it shows entries have bigger delta value either positive or negative.
$ perf diff -o 1 -c delta-abs | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
12.72% -3.01% [kernel.kallsyms] [k] intel_idle
9.72% -1.31% [unknown] [.] 0x0000000000411343
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
0.16% +0.45% [kernel.kallsyms] [k] menu_select
0.72% -0.44% [kernel.kallsyms] [k] lookup_fast--- tools/perf/Documentation/perf-diff.txt | 6 ++++- tools/perf/builtin-diff.c | 46 ++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-diff.txt +5 -1
@@ -86,7 +86,7 @@ OPTIONS -c:: --compute:: - Differential computation selection - delta,ratio,wdiff (default is delta). + Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). See COMPARISON METHODS section for more info. -p::
@@ -181,6 +181,10 @@ delta relative to how entries are filtered. Use --percentage=absolute to prevent such fluctuation. +delta-abs +~~~~~~~~~ +Same as 'delta` method, but sort the result with the absolute values. + ratio ~~~~~ If specified the 'Ratio' column is displayed with value 'r' computed as:
tools/perf/builtin-diff.c +44 -2
135 lines not on this page · raw message
Signature · 1 line
2.11.0
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf diff: Add 'delta-abs' compute method
perf diff: Add 'delta-abs' compute method
Commit-ID: a1668c25a8e1b53d00b2997ef5bc5e25c7a77235 Gitweb: http://git.kernel.org/tip/a1668c25a8e1b53d00b2997ef5bc5e25c7a77235 Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 10 Feb 2017 16:36:11 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Feb 2017 14:29:36 -0300
perf diff: Add 'delta-abs' compute method
The 'delta-abs' compute method is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option.
Below is default output (-c delta):
$ perf diff -o 1 -c delta | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
+1.15% [kernel.kallsyms] [k] copy_user_generic_string
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
+0.64% [kernel.kallsyms] [k] kmem_cache_alloc
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
+0.45% [kernel.kallsyms] [k] alloc_set_pte
0.16% +0.45% [kernel.kallsyms] [k] menu_select
+0.41% ld-2.24.so [.] do_lookup_xNow with 'delta-abs' it shows entries have bigger delta value either positive or negative.
$ perf diff -o 1 -c delta-abs | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
12.72% -3.01% [kernel.kallsyms] [k] intel_idle
9.72% -1.31% [unknown] [.] 0x0000000000411343
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
0.16% +0.45% [kernel.kallsyms] [k] menu_select
0.72% -0.44% [kernel.kallsyms] [k] lookup_fast--- tools/perf/Documentation/perf-diff.txt | 6 ++++- tools/perf/builtin-diff.c | 46 ++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-diff.txt +5 -1
@@ -86,7 +86,7 @@ OPTIONS -c:: --compute:: - Differential computation selection - delta,ratio,wdiff (default is delta). + Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). See COMPARISON METHODS section for more info. -p::
@@ -181,6 +181,10 @@ with: relative to how entries are filtered. Use --percentage=absolute to prevent such fluctuation. +delta-abs +~~~~~~~~~ +Same as 'delta` method, but sort the result with the absolute values. + ratio ~~~~~ If specified the 'Ratio' column is displayed with value 'r' computed as:
tools/perf/builtin-diff.c +44 -2
135 lines not on this page · raw message
Namhyung Kim
maintainerPATCH v2 2/4 perf diff: Add diff.order config option
In reply to Namhyung KimIn many cases, I need to look at differences between two data so I often used the -o option to sort the result base on the difference first. It'd be nice to have a config option to set it by default.
The diff.order config option is to set the default value of -o/--order option.
--- tools/perf/Documentation/perf-config.txt | 7 +++++++ tools/perf/Documentation/perf-diff.txt | 6 +++++- tools/perf/builtin-diff.c | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-config.txt +7 -0
@@ -498,6 +498,13 @@ Variables But if this option is 'no-cache', it will not update the build-id cache. 'skip' skips post-processing and does not update the cache. +diff.*:: + diff.order:: + This option sets the number of column to sort the result. + Default is 0 which means sorting by baseline. + Setting it to 1 will sort the result by delta (or other + compute method selected). + SEE ALSO -------- linkperf:perf[1]
tools/perf/Documentation/perf-diff.txt +5 -1
@@ -99,7 +99,11 @@ OPTIONS -o:: --order:: - Specify compute sorting column number. + Specify compute sorting column number. 0 means sorting by baseline + overhead (default) and 1 means sorting by computed value of column 1 + (data from the first file other base baseline). Values more than 1 + can be used only if enough data files are provided. + Default value can be set using diff.order config option. --percentage:: Determine how to display the overhead percentage of filtered entries.
tools/perf/builtin-diff.c +14 -0
@@ -17,6 +17,7 @@#include "util/symbol.h" #include "util/util.h" #include "util/data.h" +#include "util/config.h" #include <stdlib.h> #include <math.h>
@@ -1291,6 +1292,17 @@ static int data_init(int argc, const char **argv)return 0 ; } +static int diff__config (const char *var,const char *value, +void *cb__maybe_unused ) +{ +if (!strcmp (var,"diff.order" )) { + sort_compute =perf_config_int (var, value); +return 0 ; + } + +return 0 ; +} +int cmd_diff (int argc,const char **argv,const char *prefix__maybe_unused ) {int ret =hists__init ();
@@ -1298,6 +1310,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)if (ret <0 )return ret; +perf_config (diff__config,NULL ); + argc =parse_options (argc, argv, options, diff_usage,0 );if (symbol__init (NULL ) <0 )
Signature · 1 line
2.11.0
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf diff: Add diff.order config option
perf diff: Add diff.order config option
Commit-ID: d49dd15d69731589de4436a6dcfca59567320fdf Gitweb: http://git.kernel.org/tip/d49dd15d69731589de4436a6dcfca59567320fdf Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 10 Feb 2017 16:36:12 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Feb 2017 14:29:37 -0300
perf diff: Add diff.order config option
In many cases, I need to look at differences between two data so I often used the -o option to sort the result base on the difference first. It'd be nice to have a config option to set it by default.
The diff.order config option is to set the default value of -o/--order option.
--- tools/perf/Documentation/perf-config.txt | 7 +++++++ tools/perf/Documentation/perf-diff.txt | 6 +++++- tools/perf/builtin-diff.c | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-config.txt +7 -0
@@ -498,6 +498,13 @@ record.*:: But if this option is 'no-cache', it will not update the build-id cache. 'skip' skips post-processing and does not update the cache. +diff.*:: + diff.order:: + This option sets the number of columns to sort the result. + The default is 0, which means sorting by baseline. + Setting it to 1 will sort the result by delta (or other + compute method selected). + SEE ALSO -------- linkperf:perf[1]
tools/perf/Documentation/perf-diff.txt +5 -1
@@ -99,7 +99,11 @@ OPTIONS -o:: --order:: - Specify compute sorting column number. + Specify compute sorting column number. 0 means sorting by baseline + overhead (default) and 1 means sorting by computed value of column 1 + (data from the first file other base baseline). Values more than 1 + can be used only if enough data files are provided. + The default value can be set using the diff.order config option. --percentage:: Determine how to display the overhead percentage of filtered entries.
tools/perf/builtin-diff.c +14 -0
@@ -17,6 +17,7 @@#include "util/symbol.h" #include "util/util.h" #include "util/data.h" +#include "util/config.h" #include <stdlib.h> #include <math.h>
@@ -1291,6 +1292,17 @@ static int data_init(int argc, const char **argv)return 0 ; } +static int diff__config (const char *var,const char *value, +void *cb__maybe_unused ) +{ +if (!strcmp (var,"diff.order" )) { + sort_compute =perf_config_int (var, value); +return 0 ; + } + +return 0 ; +} +int cmd_diff (int argc,const char **argv,const char *prefix__maybe_unused ) {int ret =hists__init ();
@@ -1298,6 +1310,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)if (ret <0 )return ret; +perf_config (diff__config,NULL ); + argc =parse_options (argc, argv, options, diff_usage,0 );if (symbol__init (NULL ) <0 )
Namhyung Kim
maintainerPATCH v2 3/4 perf diff: Add diff.compute config option
In reply to Namhyung KimThe diff.compute config variable is to set the default compute method of perf diff command (-c option). Possible values 'delta' (default), 'delta-abs', 'ratio' and 'wdiff'.
--- tools/perf/Documentation/perf-config.txt | 5 +++++ tools/perf/Documentation/perf-diff.txt | 5 +++-- tools/perf/builtin-diff.c | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-config.txt +5 -0
@@ -505,6 +505,11 @@ Variables Setting it to 1 will sort the result by delta (or other compute method selected). + diff.compute:: + This options sets the method of computing diff result. + Possible values are 'delta', 'delta-abs', 'ratio' and + 'wdiff'. Default is 'delta'. + SEE ALSO -------- linkperf:perf[1]
tools/perf/Documentation/perf-diff.txt +3 -2
@@ -86,8 +86,9 @@ OPTIONS -c:: --compute:: - Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). - See COMPARISON METHODS section for more info. + Differential computation selection - delta,ratio,wdiff,delta-abs + (default is delta). Default can be changed using diff.compute + config option. See COMPARISON METHODS section for more info. -p:: --period::
tools/perf/builtin-diff.c +15 -1
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute; +static int compute =COMPUTE_DELTA ;static int compute_2_hpp[COMPUTE_MAX ] = { [COMPUTE_DELTA ] =PERF_HPP_DIFF__DELTA ,
@@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value, sort_compute =perf_config_int (var, value);return 0 ; } +if (!strcmp (var,"diff.compute" )) { +if (!strcmp (value,"delta" )) + compute =COMPUTE_DELTA ; +else if (!strcmp (value,"delta-abs" )) + compute =COMPUTE_DELTA_ABS ; +else if (!strcmp (value,"ratio" )) + compute =COMPUTE_RATIO ; +else if (!strcmp (value,"wdiff" )) + compute =COMPUTE_WEIGHTED_DIFF ; +else { +pr_err ("Invalid compute method: %s\n" , value); +return -1 ; + } + }return 0 ; }
Signature · 1 line
2.11.0
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf diff: Add diff.compute config option
perf diff: Add diff.compute config option
Commit-ID: 4b35994abe459f08f58b4b3855abf4ba80308680 Gitweb: http://git.kernel.org/tip/4b35994abe459f08f58b4b3855abf4ba80308680 Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 10 Feb 2017 16:36:13 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Feb 2017 14:29:37 -0300
perf diff: Add diff.compute config option
The diff.compute config variable is to set the default compute method of perf diff command (-c option). Possible values 'delta' (default), 'delta-abs', 'ratio' and 'wdiff'.
--- tools/perf/Documentation/perf-config.txt | 5 +++++ tools/perf/Documentation/perf-diff.txt | 5 +++-- tools/perf/builtin-diff.c | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-config.txt +5 -0
@@ -505,6 +505,11 @@ diff.*:: Setting it to 1 will sort the result by delta (or other compute method selected). + diff.compute:: + This options sets the method for computing the diff result. + Possible values are 'delta', 'delta-abs', 'ratio' and + 'wdiff'. Default is 'delta'. + SEE ALSO -------- linkperf:perf[1]
tools/perf/Documentation/perf-diff.txt +3 -2
@@ -86,8 +86,9 @@ OPTIONS -c:: --compute:: - Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). - See COMPARISON METHODS section for more info. + Differential computation selection - delta, ratio, wdiff, delta-abs + (default is delta). Default can be changed using diff.compute + config option. See COMPARISON METHODS section for more info. -p:: --period::
tools/perf/builtin-diff.c +15 -1
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute; +static int compute =COMPUTE_DELTA ;static int compute_2_hpp[COMPUTE_MAX ] = { [COMPUTE_DELTA ] =PERF_HPP_DIFF__DELTA ,
@@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value, sort_compute =perf_config_int (var, value);return 0 ; } +if (!strcmp (var,"diff.compute" )) { +if (!strcmp (value,"delta" )) { + compute =COMPUTE_DELTA ; + }else if (!strcmp (value,"delta-abs" )) { + compute =COMPUTE_DELTA_ABS ; + }else if (!strcmp (value,"ratio" )) { + compute =COMPUTE_RATIO ; + }else if (!strcmp (value,"wdiff" )) { + compute =COMPUTE_WEIGHTED_DIFF ; + }else { +pr_err ("Invalid compute method: %s\n" , value); +return -1 ; + } + }return 0 ; }
Namhyung Kim
maintainerPATCH v2 4/4 perf diff: Change default setting to "delta-abs"
In reply to Namhyung KimThe "delta-abs" compute method will show most changed entries on top. So users can easily see how much effect between the data. To see original-style (sorted by baseline) use -o 0 option.
--- tools/perf/builtin-diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-diff.c +2 -2
@@ -66,7 +66,7 @@ static bool force;static bool show_period;static bool show_formula;static bool show_baseline_only; -static unsigned int sort_compute; +static unsigned int sort_compute =1 ;static s64 compute_wdiff_w1;static s64 compute_wdiff_w2;
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute =COMPUTE_DELTA ; +static int compute =COMPUTE_DELTA_ABS ;static int compute_2_hpp[COMPUTE_MAX ] = { [COMPUTE_DELTA ] =PERF_HPP_DIFF__DELTA ,
Signature · 1 line
2.11.0
Namhyung Kim
maintainerPATCH 4/4 perf diff: Change default setting to "delta-abs"
The "delta-abs" compute method will show most changed entries on top. So users can easily see how much effect between the data. Note that it also changes the default of -o option to 1 in order to apply the compute method. To see original-style (sorted by baseline) use -o 0 option.
--- tools/perf/Documentation/perf-diff.txt | 4 ++-- tools/perf/builtin-diff.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
tools/perf/Documentation/perf-diff.txt +2 -2
@@ -87,7 +87,7 @@ OPTIONS -c:: --compute:: Differential computation selection - delta,ratio,wdiff,delta-abs - (default is delta). Default can be changed using diff.compute + (default is delta-abs). Default can be changed using diff.compute config option. See COMPARISON METHODS section for more info. -p::
@@ -101,7 +101,7 @@ OPTIONS -o:: --order:: Specify compute sorting column number. 0 means sorting by baseline - overhead (default) and 1 means sorting by computed value of column 1 + overhead and 1 (default) means sorting by computed value of column 1 (data from the first file other base baseline). Values more than 1 can be used only if enough data files are provided. Default value can be set using diff.order config option.
tools/perf/builtin-diff.c +3 -3
@@ -66,7 +66,7 @@ static bool force;static bool show_period;static bool show_formula;static bool show_baseline_only; -static unsigned int sort_compute; +static unsigned int sort_compute =1 ;static s64 compute_wdiff_w1;static s64 compute_wdiff_w2;
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute =COMPUTE_DELTA ; +static int compute =COMPUTE_DELTA_ABS ;static int compute_2_hpp[COMPUTE_MAX ] = { [COMPUTE_DELTA ] =PERF_HPP_DIFF__DELTA ,
@@ -810,7 +810,7 @@ static const struct option options[] = {OPT_BOOLEAN ('b' ,"baseline-only" , &show_baseline_only,"Show only items with match in baseline" ),OPT_CALLBACK ('c' ,"compute" , &compute, -"delta,delta-abs,ratio,wdiff:w1,w2 (default delta)" , +"delta,delta-abs,ratio,wdiff:w1,w2 (default delta-abs)" ,"Entries differential computation selection" , setup_compute), OPT_BOOLEAN('p', "period", &show_period,
Signature · 1 line
2.11.0
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf diff: Change default setting to "delta-abs"
perf diff: Change default setting to "delta-abs"
Commit-ID: be57b3fd218ad4a19725ac4bd53e67b2ede42a9d Gitweb: http://git.kernel.org/tip/be57b3fd218ad4a19725ac4bd53e67b2ede42a9d Author: Namhyung Kim <[email protected]> AuthorDate: Sat, 11 Feb 2017 01:18:56 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Feb 2017 14:29:38 -0300
perf diff: Change default setting to "delta-abs"
The "delta-abs" compute method will show most changed entries on top. So users can easily see how much effect between the data. Note that it also changes the default of -o option to 1 in order to apply the compute method. To see original-style (sorted by baseline) use -o 0 option.
--- tools/perf/Documentation/perf-diff.txt | 4 ++-- tools/perf/builtin-diff.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
tools/perf/Documentation/perf-diff.txt +2 -2
@@ -87,7 +87,7 @@ OPTIONS -c:: --compute:: Differential computation selection - delta, ratio, wdiff, delta-abs - (default is delta). Default can be changed using diff.compute + (default is delta-abs). Default can be changed using diff.compute config option. See COMPARISON METHODS section for more info. -p::
@@ -101,7 +101,7 @@ OPTIONS -o:: --order:: Specify compute sorting column number. 0 means sorting by baseline - overhead (default) and 1 means sorting by computed value of column 1 + overhead and 1 (default) means sorting by computed value of column 1 (data from the first file other base baseline). Values more than 1 can be used only if enough data files are provided. The default value can be set using the diff.order config option.
tools/perf/builtin-diff.c +3 -3
@@ -66,7 +66,7 @@ static bool force;static bool show_period;static bool show_formula;static bool show_baseline_only; -static unsigned int sort_compute; +static unsigned int sort_compute =1 ;static s64 compute_wdiff_w1;static s64 compute_wdiff_w2;
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute =COMPUTE_DELTA ; +static int compute =COMPUTE_DELTA_ABS ;static int compute_2_hpp[COMPUTE_MAX ] = { [COMPUTE_DELTA ] =PERF_HPP_DIFF__DELTA ,
@@ -810,7 +810,7 @@ static const struct option options[] = {OPT_BOOLEAN ('b' ,"baseline-only" , &show_baseline_only,"Show only items with match in baseline" ),OPT_CALLBACK ('c' ,"compute" , &compute, -"delta,delta-abs,ratio,wdiff:w1,w2 (default delta)" , +"delta,delta-abs,ratio,wdiff:w1,w2 (default delta-abs)" ,"Entries differential computation selection" , setup_compute), OPT_BOOLEAN('p', "period", &show_period,
Quoted 29 lines · Namhyung Kim
Hello,
This patchset adds 'delta-abs' compute method to -c/--compute option. The 'delta-abs' is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option.
* v2 changes
- rebase onto acme/perf/core
- change default option to '-o 1 -c delta-abs'Below is default output (-c delta):
$ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_xNow with 'delta-abs' it shows entries have bigger delta value either positive or negative.
Quoted 11 lines
$ perf diff -o 1 -c delta-abs | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
12.72% -3.01% [kernel.kallsyms] [k] intel_idle
9.72% -1.31% [unknown] [.] 0x0000000000411343
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
+1.15% [kernel.kallsyms] [k] copy_user_generic_string
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single
+0.64% [kernel.kallsyms] [k] kmem_cache_alloc
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlockNice!
BTW., to me the second output looks a lot more intuitive and useful than the default one.
Would it be possible to flip over the default to the 'most useful' options, and see whether anyone complains?
Thanks,
Ingo
Namhyung Kim
maintainerHi Ingo,
Quoted 44 lines · Ingo Molnar
Quoted 29 lines · Namhyung Kim
Hello,
This patchset adds 'delta-abs' compute method to -c/--compute option. The 'delta-abs' is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option.
* v2 changes
- rebase onto acme/perf/core
- change default option to '-o 1 -c delta-abs'Below is default output (-c delta):
$ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_xNow with 'delta-abs' it shows entries have bigger delta value either positive or negative.
Quoted 11 lines
$ perf diff -o 1 -c delta-abs | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 12.72% -3.01% [kernel.kallsyms] [k] intel_idle 9.72% -1.31% [unknown] [.] 0x0000000000411343 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock
Quoted 4 lines
Nice!
BTW., to me the second output looks a lot more intuitive and useful than the default one.
Thanks!
Quoted 3 lines
Would it be possible to flip over the default to the 'most useful' options, and see whether anyone complains?
The patch 4 makes it default.
By the way, the current default (sort by baseline) looks like below:
$ perf diff | grep -v ^# | head
42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit
12.72% -3.01% [kernel.kallsyms] [k] intel_idle
9.72% -1.31% [unknown] [.] 0x0000000000411343
2.40% +0.95% [kernel.kallsyms] [k] bit_putcs
1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single
0.62% +1.23% [kernel.kallsyms] [k] mutex_lock
0.31% +0.79% [kernel.kallsyms] [k] link_path_walk
0.16% +0.45% [kernel.kallsyms] [k] menu_select
0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlockWhile this example doesn't show much difference, it could be..
Thanks,
Namhyung
Quoted 4 lines · Namhyung Kim
Quoted 2 lines
Would it be possible to flip over the default to the 'most useful' options, and see whether anyone complains?
The patch 4 makes it default.
/me must be blind!
Yes, looks really nice that way.
Thanks,
Ingo