aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blktrace.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/block/blktrace.c b/block/blktrace.c
index 20c3e22587b5..20fa034ea4a2 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -41,7 +41,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action,
41 const int cpu = smp_processor_id(); 41 const int cpu = smp_processor_id();
42 42
43 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 43 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
44 t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu); 44 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
45 t->device = bt->dev; 45 t->device = bt->dev;
46 t->action = action; 46 t->action = action;
47 t->pid = pid; 47 t->pid = pid;
@@ -159,7 +159,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
159 159
160 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 160 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
161 t->sequence = ++(*sequence); 161 t->sequence = ++(*sequence);
162 t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu); 162 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
163 t->sector = sector; 163 t->sector = sector;
164 t->bytes = bytes; 164 t->bytes = bytes;
165 t->action = what; 165 t->action = what;
@@ -488,17 +488,17 @@ void blk_trace_shutdown(struct request_queue *q)
488} 488}
489 489
490/* 490/*
491 * Average offset over two calls to sched_clock() with a gettimeofday() 491 * Average offset over two calls to cpu_clock() with a gettimeofday()
492 * in the middle 492 * in the middle
493 */ 493 */
494static void blk_check_time(unsigned long long *t) 494static void blk_check_time(unsigned long long *t, int this_cpu)
495{ 495{
496 unsigned long long a, b; 496 unsigned long long a, b;
497 struct timeval tv; 497 struct timeval tv;
498 498
499 a = sched_clock(); 499 a = cpu_clock(this_cpu);
500 do_gettimeofday(&tv); 500 do_gettimeofday(&tv);
501 b = sched_clock(); 501 b = cpu_clock(this_cpu);
502 502
503 *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000; 503 *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
504 *t -= (a + b) / 2; 504 *t -= (a + b) / 2;
@@ -510,16 +510,16 @@ static void blk_check_time(unsigned long long *t)
510static void blk_trace_check_cpu_time(void *data) 510static void blk_trace_check_cpu_time(void *data)
511{ 511{
512 unsigned long long *t; 512 unsigned long long *t;
513 int cpu = get_cpu(); 513 int this_cpu = get_cpu();
514 514
515 t = &per_cpu(blk_trace_cpu_offset, cpu); 515 t = &per_cpu(blk_trace_cpu_offset, this_cpu);
516 516
517 /* 517 /*
518 * Just call it twice, hopefully the second call will be cache hot 518 * Just call it twice, hopefully the second call will be cache hot
519 * and a little more precise 519 * and a little more precise
520 */ 520 */
521 blk_check_time(t); 521 blk_check_time(t, this_cpu);
522 blk_check_time(t); 522 blk_check_time(t, this_cpu);
523 523
524 put_cpu(); 524 put_cpu();
525} 525}