From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939739AbXGSSUd (ORCPT ); Thu, 19 Jul 2007 14:20:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759309AbXGSSUY (ORCPT ); Thu, 19 Jul 2007 14:20:24 -0400 Received: from brick.kernel.dk ([80.160.20.94]:18611 "EHLO kernel.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754165AbXGSSUX (ORCPT ); Thu, 19 Jul 2007 14:20:23 -0400 Date: Thu, 19 Jul 2007 20:20:07 +0200 From: Jens Axboe To: Jeremy Fitzhardinge Cc: Ingo Molnar , Andrew Morton , linux-kernel@vger.kernel.org, Linus Torvalds , stable@kernel.org, Greg KH , Chris Wright , Srivatsa Vaddagiri , Jan Glauber , Andi Kleen Subject: Re: [patch] sched: implement cpu_clock(cpu) high-speed time source, take #2 Message-ID: <20070719182007.GB11657@kernel.dk> References: <469F793E.6030006@goop.org> <20070719145058.GA11971@elte.hu> <469F7D7A.204@goop.org> <20070719150955.GA19373@elte.hu> <469F8179.2060802@goop.org> <20070719154254.GA24225@elte.hu> <20070719154449.GA28998@elte.hu> <469F8D28.1010304@goop.org> <20070719172403.GU11657@kernel.dk> <469FA908.8090804@goop.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <469FA908.8090804@goop.org> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 19 2007, Jeremy Fitzhardinge wrote: > Jens Axboe wrote: > > On Thu, Jul 19 2007, Jeremy Fitzhardinge wrote: > > > >>> Index: linux/block/blktrace.c > >>> =================================================================== > >>> --- linux.orig/block/blktrace.c > >>> +++ linux/block/blktrace.c > >>> @@ -41,7 +41,7 @@ static void trace_note(struct blk_trace > >>> const int cpu = smp_processor_id(); > >>> > >>> t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; > >>> - t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu); > >>> + t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); > >>> t->device = bt->dev; > >>> t->action = action; > >>> t->pid = pid; > >>> @@ -159,7 +159,7 @@ void __blk_add_trace(struct blk_trace *b > >>> > >>> t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; > >>> t->sequence = ++(*sequence); > >>> - t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu); > >>> + t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); > >>> > >>> > >> What's this measuring here? Time spend in IO? Wouldn't it be better > >> off with a measurement of real monotonic time? > >> > > > > It's not time spent in IO, it wants a nanosecond timestamp. > > > > What kind of nanoseconds? Real? Virtual? > > sched_clock() (and now cpu_clock()) measure the number of nanoseconds > available for running CPU instructions (regardless of whether it chooses > to use them or not), and so in a virtual environment doesn't include > time stolen by the hypervisor for other VCPUs. Real time, it's a timestamp that the user tools can use to see the time delta between A and B. So I guess blktrace currently doesn't work so well inside a gues... -- Jens Axboe