From 092804ae092fc6097348f5c09b62cde040717aa1 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Fri, 23 Aug 2019 14:03:37 -0700 Subject: 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 Cc: Jiri Olsa Link: http://lkml.kernel.org/r/20190823210338.12360-1-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/sort.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'tools/perf/util') 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) static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, size_t size, unsigned int width) { - unsigned long secs; - unsigned long long nsecs; char he_time[32]; - nsecs = he->time; - secs = nsecs / NSEC_PER_SEC; - nsecs -= secs * NSEC_PER_SEC; - if (symbol_conf.nanosecs) - snprintf(he_time, sizeof he_time, "%5lu.%09llu: ", - secs, nsecs); + timestamp__scnprintf_nsec(he->time, he_time, + sizeof(he_time)); else timestamp__scnprintf_usec(he->time, he_time, sizeof(he_time)); -- cgit v1.2.3-59-g8ed1b