aboutsummaryrefslogtreecommitdiffstats
path: root/block/blktrace.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-28 22:31:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-28 22:31:13 -0400
commit8e8ef2971b0fd6dcf1a66014fb74b41938eecb4e (patch)
tree3c451f9c21123046806724680a3a8aebd48e6247 /block/blktrace.c
parent933a6208d84c92d92f9264a2e28d0fc317d41fd1 (diff)
parent79685b8deea4541d18882d8c07d0e99e788292ab (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: docbook: add pipes, other fixes blktrace: use cpu_clock() instead of sched_clock() bsg: Fix build for CONFIG_BLOCK=n [patch] QUEUE_FLAG_READFULL QUEUE_FLAG_WRITEFULL comment fix
Diffstat (limited to 'block/blktrace.c')
-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}