Re: [PATCH 3/3] perf tools: Introduce timestamp_in_usec()

From: Jiri Olsa
Date: Mon Oct 24 2016 - 12:46:29 EST


On Mon, Oct 24, 2016 at 11:02:45AM +0900, Namhyung Kim wrote:

SNIP

> +
> if (nanosecs)
> printf("%5lu.%09llu: ", secs, nsecs);
> else
> - printf("%5lu.%06lu: ", secs, usecs);
> + printf("%12s: ", timestamp_in_usec(buf, sz,
> + sample->time));
> }
> }
>
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 85c56800f17a..aa3e778989ce 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -433,6 +433,15 @@ int parse_nsec_time(const char *str, u64 *ptime)
> return 0;
> }
>
> +char *timestamp_in_usec(char *buf, size_t sz, u64 timestamp)
> +{

good idea.. 2 things:
- I've spot several other places by looking for NSEC_PER_USEC
but haven't checked deeply they could be also users for this function

- timestamp_usec__scnprint might fir better

thanks,
jirka