Re: printing current system time from kernel space

From: George Nychis
Date: Mon Sep 22 2008 - 11:11:25 EST




Sitsofe Wheeler wrote:
George Nychis wrote:
I spent some time googling, but could not find out how or if it is possible to read the current system time in kernel space. I could insert a printk() somewhere in usbdev_read() then.

If that's what you want to do could you not turn on timestamps on printk (CONFIG_PRINTK_TIME in the kernel hacking menu)?


Thanks for the response!

You might be misunderstanding my goal. I need a common clock between kernel and user space, so that I can say:

Event1 happened at time X in the kernel
Event2 happened at time X+Y in user space
The time between Event1 and Event2 was Y-X

So, turning off timestamps does not help anything here :)

What might be useful is if user space can read the current timestamp value that printk uses, that way I can just do a printk in the kernel and then read the value and print in user space.

Is this possible?

Thanks!
George
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/