diff options
author | Andi Kleen <ak@linux.intel.com> | 2019-08-23 17:03:37 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-26 10:58:29 -0400 |
commit | 092804ae092fc6097348f5c09b62cde040717aa1 (patch) | |
tree | 635d87b9e73a8283566ee4fa46e66d4c06997a09 | |
parent | b4de344b25b9fbd4db7b84da43808a6b7daac887 (diff) |
perf report: Use timestamp__scnprintf_nsec() for time sort key
Use timestamp__scnprintf_nsec() to print nanoseconds for the time sort
key, instead of open coding.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20190823210338.12360-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/sort.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index c522bdde3f71..83eb3fa6f941 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -670,17 +670,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right) | |||
670 | static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, | 670 | static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, |
671 | size_t size, unsigned int width) | 671 | size_t size, unsigned int width) |
672 | { | 672 | { |
673 | unsigned long secs; | ||
674 | unsigned long long nsecs; | ||
675 | char he_time[32]; | 673 | char he_time[32]; |
676 | 674 | ||
677 | nsecs = he->time; | ||
678 | secs = nsecs / NSEC_PER_SEC; | ||
679 | nsecs -= secs * NSEC_PER_SEC; | ||
680 | |||
681 | if (symbol_conf.nanosecs) | 675 | if (symbol_conf.nanosecs) |
682 | snprintf(he_time, sizeof he_time, "%5lu.%09llu: ", | 676 | timestamp__scnprintf_nsec(he->time, he_time, |
683 | secs, nsecs); | 677 | sizeof(he_time)); |
684 | else | 678 | else |
685 | timestamp__scnprintf_usec(he->time, he_time, | 679 | timestamp__scnprintf_usec(he->time, he_time, |
686 | sizeof(he_time)); | 680 | sizeof(he_time)); |