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>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
b4de344b25
commit
092804ae09
@@ -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,
|
static int hist_entry__time_snprintf(struct hist_entry *he, char *bf,
|
||||||
size_t size, unsigned int width)
|
size_t size, unsigned int width)
|
||||||
{
|
{
|
||||||
unsigned long secs;
|
|
||||||
unsigned long long nsecs;
|
|
||||||
char he_time[32];
|
char he_time[32];
|
||||||
|
|
||||||
nsecs = he->time;
|
|
||||||
secs = nsecs / NSEC_PER_SEC;
|
|
||||||
nsecs -= secs * NSEC_PER_SEC;
|
|
||||||
|
|
||||||
if (symbol_conf.nanosecs)
|
if (symbol_conf.nanosecs)
|
||||||
snprintf(he_time, sizeof he_time, "%5lu.%09llu: ",
|
timestamp__scnprintf_nsec(he->time, he_time,
|
||||||
secs, nsecs);
|
sizeof(he_time));
|
||||||
else
|
else
|
||||||
timestamp__scnprintf_usec(he->time, he_time,
|
timestamp__scnprintf_usec(he->time, he_time,
|
||||||
sizeof(he_time));
|
sizeof(he_time));
|
||||||
|
|||||||
Reference in New Issue
Block a user