perf kvm stat report: extend the title bar output
v2 cover perf kvm stat report: extend the title bar output
Hello,
This patchset is intended to add information about current pid to the "Analyze events for " title bar for the 'perf kvm stat report' command, when it's running with --pid option. To do so, patches 1-2 sync values of kvm->opts.target in 'report' with 'live' command and patch 3 reuses 'live' specific code to print desirable information.
v2 changes:
- Split the big patch into 3 small patches
- Simplified the way to enable target.system_wide flag
Thanks.
Alexander Yarygin (3):
perf kvm stat report: Save pid string in kvm->opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output
tools/perf/builtin-kvm.c | 23 ++++++++++++----------- tools/perf/util/kvm-stat.h | 1 - 2 files changed, 12 insertions(+), 12 deletions(-)
--
1.7.9.5
PATCH v2 1/3 perf kvm stat report: Save pid string in opts.target.pid
The 'perf kvm stat report' command uses the kvm->pid_str field to keep the value of the --pid option. Let's use kvm->opts.target.pid instead.
--- tools/perf/builtin-kvm.c | 6 +++--- tools/perf/util/kvm-stat.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-kvm.c +3 -3
@@ -1088,8 +1088,8 @@ static int read_events(struct perf_kvm_stat *kvm)static int parse_target_str (struct perf_kvm_stat *kvm) { -if (kvm->pid_str) { - kvm->pid_list =intlist__new (kvm->pid_str); +if (kvm->opts.target.pid) { + kvm->pid_list =intlist__new (kvm->opts.target.pid);if (kvm->pid_list ==NULL ) {pr_err ("Error parsing process id string\n" );return -EINVAL ;
@@ -1191,7 +1191,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)OPT_STRING ('k' ,"key" , &kvm->sort_key,"sort-key" ,"key for sorting: sample(sort by samples number)" " time (sort by avg time)" ), -OPT_STRING ('p' ,"pid" , &kvm->pid_str,"pid" , +OPT_STRING ('p' ,"pid" , &kvm->opts.target.pid,"pid" ,"analyze events only for given process id(s)" ), OPT_END() };
tools/perf/util/kvm-stat.h +0 -1
@@ -92,7 +92,6 @@ struct perf_kvm_stat {u64 lost_events;u64 duration; -const char *pid_str;struct intlist *pid_list;struct rb_root result;
--
1.7.9.5
tip-bot for Alexander Yarygin
merge bot[tip:perf/core] perf kvm stat report: Save pid string in opts.target.pid
perf kvm stat report: Save pid string in opts.target.pid
Commit-ID: 3ae4a76ac840021294c091884e04af7c92e481ae Gitweb: http://git.kernel.org/tip/3ae4a76ac840021294c091884e04af7c92e481ae Author: Alexander Yarygin <[email protected]> AuthorDate: Mon, 1 Sep 2014 17:44:53 +0400 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 17 Sep 2014 17:08:07 -0300
perf kvm stat report: Save pid string in opts.target.pid
The 'perf kvm stat report' command uses the kvm->pid_str field to keep the value of the --pid option. Let's use kvm->opts.target.pid instead.
--- tools/perf/builtin-kvm.c | 6 +++--- tools/perf/util/kvm-stat.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-kvm.c +3 -3
@@ -1085,8 +1085,8 @@ static int read_events(struct perf_kvm_stat *kvm)static int parse_target_str (struct perf_kvm_stat *kvm) { -if (kvm->pid_str) { - kvm->pid_list =intlist__new (kvm->pid_str); +if (kvm->opts.target.pid) { + kvm->pid_list =intlist__new (kvm->opts.target.pid);if (kvm->pid_list ==NULL ) {pr_err ("Error parsing process id string\n" );return -EINVAL ;
@@ -1188,7 +1188,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)OPT_STRING ('k' ,"key" , &kvm->sort_key,"sort-key" ,"key for sorting: sample(sort by samples number)" " time (sort by avg time)" ), -OPT_STRING ('p' ,"pid" , &kvm->pid_str,"pid" , +OPT_STRING ('p' ,"pid" , &kvm->opts.target.pid,"pid" ,"analyze events only for given process id(s)" ), OPT_END() };
tools/perf/util/kvm-stat.h +0 -1
@@ -92,7 +92,6 @@ struct perf_kvm_stat {u64 lost_events;u64 duration; -const char *pid_str;struct intlist *pid_list;struct rb_root result;
PATCH v2 2/3 perf kvm stat report: Enable the target.system_wide flag
In reply to Alexander YaryginThe 'perf kvm stat report' command can be used to analyze events either for system wide or for specific pids. Let's enable kvm->opts.target.system_wide flag when 'report' command is running for system-wide analyzing. This helps to sync kvm->opts.target values in 'report' and 'live' commands.
--- tools/perf/builtin-kvm.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-kvm.c +3 -0
@@ -1212,6 +1212,9 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv) kvm_events_report_options); } +if (!kvm->opts.target.pid) + kvm->opts.target.system_wide = true; +return kvm_events_report_vcpu (kvm); }
Signature · 1 line
1.7.9.5
tip-bot for Alexander Yarygin
merge bot[tip:perf/core] perf kvm stat report: Enable the target.system_wide flag
perf kvm stat report: Enable the target.system_wide flag
Commit-ID: f181957c2849478fc963a8ac3c7dacf0a87c6b05 Gitweb: http://git.kernel.org/tip/f181957c2849478fc963a8ac3c7dacf0a87c6b05 Author: Alexander Yarygin <[email protected]> AuthorDate: Mon, 1 Sep 2014 17:44:54 +0400 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 17 Sep 2014 17:08:07 -0300
perf kvm stat report: Enable the target.system_wide flag
The 'perf kvm stat report' command can be used to analyze events either for system wide or for specific pids.
Let's enable kvm->opts.target.system_wide flag when 'report' command is running for system-wide analyzing. This helps to sync kvm->opts.target values in 'report' and 'live' commands.
--- tools/perf/builtin-kvm.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-kvm.c +3 -0
@@ -1207,6 +1207,9 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv) kvm_events_report_options); } +if (!kvm->opts.target.pid) + kvm->opts.target.system_wide = true; +return kvm_events_report_vcpu (kvm); }
PATCH v2 3/3 perf kvm stat report: Unify the title bar output
In reply to Alexander YaryginThe 'live' command prints additional information to the "Analyze events for " title bar about the current target. Let's print the same title for the 'report' command.
--- tools/perf/builtin-kvm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
tools/perf/builtin-kvm.c +6 -8
@@ -543,14 +543,12 @@ static void print_vcpu_info(struct perf_kvm_stat *kvm)pr_info ("Analyze events for " ); -if (kvm->live) { -if (kvm->opts.target.system_wide) -pr_info ("all VMs, " ); -else if (kvm->opts.target.pid) -pr_info ("pid(s) %s, " , kvm->opts.target.pid); -else -pr_info ("dazed and confused on what is monitored, " ); - } +if (kvm->opts.target.system_wide) +pr_info ("all VMs, " ); +else if (kvm->opts.target.pid) +pr_info ("pid(s) %s, " , kvm->opts.target.pid); +else +pr_info ("dazed and confused on what is monitored, " );if (vcpu ==-1 )pr_info ("all VCPUs:\n\n" );
--
1.7.9.5
tip-bot for Alexander Yarygin
merge bot[tip:perf/core] perf kvm stat report: Unify the title bar output
perf kvm stat report: Unify the title bar output
Commit-ID: 1f3e5b55035549311e42c3f84007e6c799ed991f Gitweb: http://git.kernel.org/tip/1f3e5b55035549311e42c3f84007e6c799ed991f Author: Alexander Yarygin <[email protected]> AuthorDate: Mon, 1 Sep 2014 17:44:55 +0400 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 17 Sep 2014 17:08:08 -0300
perf kvm stat report: Unify the title bar output
The 'live' command prints additional information to the "Analyze events for " title bar about the current target. Let's print the same title for the 'report' command.
--- tools/perf/builtin-kvm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
tools/perf/builtin-kvm.c +6 -8
@@ -543,14 +543,12 @@ static void print_vcpu_info(struct perf_kvm_stat *kvm)pr_info ("Analyze events for " ); -if (kvm->live) { -if (kvm->opts.target.system_wide) -pr_info ("all VMs, " ); -else if (kvm->opts.target.pid) -pr_info ("pid(s) %s, " , kvm->opts.target.pid); -else -pr_info ("dazed and confused on what is monitored, " ); - } +if (kvm->opts.target.system_wide) +pr_info ("all VMs, " ); +else if (kvm->opts.target.pid) +pr_info ("pid(s) %s, " , kvm->opts.target.pid); +else +pr_info ("dazed and confused on what is monitored, " );if (vcpu ==-1 )pr_info ("all VCPUs:\n\n" );
Quoted 14 lines · Alexander Yarygin
Hello,
This patchset is intended to add information about current pid to the "Analyze events for " title bar for the 'perf kvm stat report' command, when it's running with --pid option. To do so, patches 1-2 sync values of
kvm->opts.targetin 'report' with 'live' command and patch 3 reuses 'live' specific code to print desirable information.v2 changes:
- Split the big patch into 3 small patches
- Simplified the way to enable target.system_wide flagThanks.
Quoted 8 lines
Alexander Yarygin (3):
perf kvm stat report: Save pid string inkvm->opts.target.pidperf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar outputtools/perf/builtin-kvm.c | 23 ++++++++++++----------- tools/perf/util/kvm-stat.h | 1 - 2 files changed, 12 insertions(+), 12 deletions(-)
All 3 look good to me.