Em Fri, Aug 23, 2019 at 02:03:37PM -0700, Andi Kleen escreveu: > From: Andi Kleen <[email protected]> > > Use timestamp__scnprintf_nsec to print nanoseconds for the time > sort key, instead of open coding.
Thanks, tested and applied. - Arnaldo > Signed-off-by: Andi Kleen <[email protected]> > --- > tools/perf/util/sort.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > index f9a38a1dd4d1..0985e9072db0 100644 > --- a/tools/perf/util/sort.c > +++ b/tools/perf/util/sort.c > @@ -668,17 +668,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)); > -- > 2.20.1 -- - Arnaldo

