lkml.org 
[lkml]   [2007]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch] sched: implement cpu_clock(cpu) high-speed time source, take #2
    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.

    J
    -
    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/

    \
     
     \ /
      Last update: 2007-07-19 20:13    [W:0.097 / U:0.184 seconds]
    ©2003-2014 Jasper Spaans. hosted at Digital Ocean