Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755567AbbBLK21 (ORCPT ); Thu, 12 Feb 2015 05:28:27 -0500 Received: from casper.infradead.org ([85.118.1.10]:43240 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752518AbbBLK20 (ORCPT ); Thu, 12 Feb 2015 05:28:26 -0500 Date: Thu, 12 Feb 2015 11:28:14 +0100 From: Peter Zijlstra To: Adrian Hunter Cc: Pawel Moll , ajh mls , Richard Cochran , Steven Rostedt , Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , John Stultz , Masami Hiramatsu , Christopher Covington , Namhyung Kim , David Ahern , Thomas Gleixner , Tomeu Vizoso , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" Subject: Re: [PATCH v5] perf: Use monotonic clock as a source for timestamps Message-ID: <20150212102814.GK2896@worktop.programming.kicks-ass.net> References: <1415292718-19785-2-git-send-email-pawel.moll@arm.com> <1421872037-12559-1-git-send-email-pawel.moll@arm.com> <1422895966.4944.25.camel@arm.com> <1422955245.4944.26.camel@arm.com> <20150211161256.GH2896@worktop.programming.kicks-ass.net> <54DC7AC6.5010605@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54DC7AC6.5010605@intel.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1059 Lines: 28 On Thu, Feb 12, 2015 at 12:04:54PM +0200, Adrian Hunter wrote: > On 11/02/15 18:12, Peter Zijlstra wrote: > > > > How about something like the below? I _think_ it should mostly work for > > x86, where the tsc is a 64bit wide cycle counter. > > It would have to be based on CLOCK_MONOTONIC_RAW not CLOCK_MONOTONIC Why? > and you would have to check the clocksource is TSC. It implicitly does that; it has that sched_clock_stable() thing, but yeah I suppose someone could change the clocksource even though the tsc is stable. Not using TSC when its available is quite crazy though.. but sure. > Why is CLOCK_MONOTONIC preferred anyway - I would have thought any > adjustment would skew performance timings? Because you can do inter-machine stuff with MONOTONIC and that's entirely impossible with MONO_RAW. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/