[tip:perf/core] perf kvm: Use NSEC_PER_USEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  c05a6e14150f81a8cb93d83af55582e05afc05ae
Gitweb: http://git.kernel.org/tip/c05a6e14150f81a8cb93d83af55582e05afc05ae
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 15:10:44 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf kvm: Use NSEC_PER_USEC

Following kernel practices and better documenting units of time.

Cc: Adrian Hunter 
Cc: Alexander Yarygin 
Cc: David Ahern 
Cc: Hemant Kumar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-5x6p6fmzrogonpbnkkkw4...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-kvm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a0040f7..08fa88f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -363,7 +363,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
if (!skip_event(decode)) {
pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" 
PRIu64 "usec\n",
 sample->time, sample->pid, 
vcpu_record->vcpu_id,
-decode, time_diff/1000);
+decode, time_diff / NSEC_PER_USEC);
}
}
 
@@ -609,15 +609,15 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("%10llu ", (unsigned long long)ecount);
pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100);
pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100);
-   pr_info("%9.2fus ", (double)min / 1e3);
-   pr_info("%9.2fus ", (double)max / 1e3);
-   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3,
+   pr_info("%9.2fus ", (double)min / NSEC_PER_USEC);
+   pr_info("%9.2fus ", (double)max / NSEC_PER_USEC);
+   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount / 
NSEC_PER_USEC,
kvm_event_rel_stddev(vcpu, event));
pr_info("\n");
}
 
pr_info("\nTotal Samples:%" PRIu64 ", Total events handled 
time:%.2fus.\n\n",
-   kvm->total_count, kvm->total_time / 1e3);
+   kvm->total_count, kvm->total_time / (double)NSEC_PER_USEC);
 
if (kvm->lost_events)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);


[tip:perf/core] perf kvm: Use NSEC_PER_USEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  c05a6e14150f81a8cb93d83af55582e05afc05ae
Gitweb: http://git.kernel.org/tip/c05a6e14150f81a8cb93d83af55582e05afc05ae
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 15:10:44 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf kvm: Use NSEC_PER_USEC

Following kernel practices and better documenting units of time.

Cc: Adrian Hunter 
Cc: Alexander Yarygin 
Cc: David Ahern 
Cc: Hemant Kumar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-5x6p6fmzrogonpbnkkkw4...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-kvm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a0040f7..08fa88f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -363,7 +363,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
if (!skip_event(decode)) {
pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" 
PRIu64 "usec\n",
 sample->time, sample->pid, 
vcpu_record->vcpu_id,
-decode, time_diff/1000);
+decode, time_diff / NSEC_PER_USEC);
}
}
 
@@ -609,15 +609,15 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("%10llu ", (unsigned long long)ecount);
pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100);
pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100);
-   pr_info("%9.2fus ", (double)min / 1e3);
-   pr_info("%9.2fus ", (double)max / 1e3);
-   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3,
+   pr_info("%9.2fus ", (double)min / NSEC_PER_USEC);
+   pr_info("%9.2fus ", (double)max / NSEC_PER_USEC);
+   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount / 
NSEC_PER_USEC,
kvm_event_rel_stddev(vcpu, event));
pr_info("\n");
}
 
pr_info("\nTotal Samples:%" PRIu64 ", Total events handled 
time:%.2fus.\n\n",
-   kvm->total_count, kvm->total_time / 1e3);
+   kvm->total_count, kvm->total_time / (double)NSEC_PER_USEC);
 
if (kvm->lost_events)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);