From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eugeniu Rosca Date: Wed, 16 Oct 2019 19:51:25 +0200 Subject: [U-Boot] [PATCH] lib: time: Add microsecond timer In-Reply-To: <20191016174309.GA13618@vmlxhi-102.adit-jv.com> References: <20191015204341.23613-1-marek.vasut+renesas@gmail.com> <20191016171112.GA12409@vmlxhi-102.adit-jv.com> <20191016174309.GA13618@vmlxhi-102.adit-jv.com> Message-ID: <20191016175125.GA14968@vmlxhi-102.adit-jv.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Oct 16, 2019 at 07:43:09PM +0200, Eugeniu Rosca wrote: > On Wed, Oct 16, 2019 at 07:26:44PM +0200, Marek Vasut wrote: > > On 10/16/19 7:11 PM, Eugeniu Rosca wrote: > > > On Tue, Oct 15, 2019 at 10:43:41PM +0200, Marek Vasut wrote: > > >> Add get_timer_us(), which is useful e.g. when we need higher > > >> precision timestamps. > > > > > > FWIW, I agree with Simon that bootstage [1] can be an awesome tool for > > > profiling and boot time measurements. With a bit of instrumentation and > > > host-side scripting, it allows to produce accurate bootcharts like [2]. > > > > > > [1] https://patchwork.ozlabs.org/patch/1177393/#2281091 > > > [2] https://i.ibb.co/mG6Xc1p/2019-10-16-190251.png > > > > I don't need that though, I really only need to know how long the code > > spent between two points in code. > > It can be accomplished in N ways. A quick and dirty way to use > "bootstage" would be to add below instrumentation: > > ----------8<---------- > bootstage_mark_name(BOOTSTAGE_ID_ALLOC, "count/time from here"); > /* > * my-precious-code > */ > bootstage_mark_name(BOOTSTAGE_ID_ALLOC, "duration of my-precious-code"); > ----------8<---------- > > It's likely orthogonal to what's being proposed in your patch. Bottom line is "bootstage" already makes use of timer_get_boot_us(), so it's not entirely clear to me why another us-resolution timer API would be needed. -- Best Regards, Eugeniu