Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757985AbcJXQqZ (ORCPT ); Mon, 24 Oct 2016 12:46:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42570 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757951AbcJXQqX (ORCPT ); Mon, 24 Oct 2016 12:46:23 -0400 Date: Mon, 24 Oct 2016 18:46:14 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Joonwoo Park Subject: Re: [PATCH 3/3] perf tools: Introduce timestamp_in_usec() Message-ID: <20161024164614.GB31643@krava> References: <20161024020246.14928-1-namhyung@kernel.org> <20161024020246.14928-3-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161024020246.14928-3-namhyung@kernel.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 24 Oct 2016 16:46:18 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 837 Lines: 33 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