Skip to content

Commit 092804a

Browse files
Andi Kleenacmel
authored andcommitted
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>
1 parent b4de344 commit 092804a

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎tools/perf/util/sort.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -670,17 +670,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right)
670670
static int hist_entry__time_snprintf(struct hist_entry *he, char *bf,
671671
size_t size, unsigned int width)
672672
{
673-
unsigned long secs;
674-
unsigned long long nsecs;
675673
char he_time[32];
676674

677-
nsecs = he->time;
678-
secs = nsecs / NSEC_PER_SEC;
679-
nsecs -= secs * NSEC_PER_SEC;
680-
681675
if (symbol_conf.nanosecs)
682-
snprintf(he_time, sizeof he_time, "%5lu.%09llu: ",
683-
secs, nsecs);
676+
timestamp__scnprintf_nsec(he->time, he_time,
677+
sizeof(he_time));
684678
else
685679
timestamp__scnprintf_usec(he->time, he_time,
686680
sizeof(he_time));

0 commit comments

Comments
 (0)