lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 22 Sep 2008 16:33:43 -0400
From:	George Nychis <gnychis@....edu>
To:	john stultz <johnstul@...ibm.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: printing current system time from kernel space



john stultz wrote:
> On Mon, Sep 22, 2008 at 1:28 PM, john stultz <johnstul@...ibm.com> wrote:
>> On Sun, Sep 21, 2008 at 10:18 PM, George Nychis <gnychis@....edu> wrote:
>>> I am looking to measure the latency of USB data between kernel space and
>>> user space.  The user space driver uses a URB to get data from the device to
>>> the kernel and finally to user space.
>>>
>>> To measure this latency, I was thinking of printing the current system time
>>> when a read occurs/succeeds in drivers/usb/core/devio.c at the function
>>> usbdev_read(), and then again in user space when the URB succeeds in
>>> reading.  Then, I could subtract the two times to get the latency.
>>>
>>> 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 it is not possible to read the current system time, is there some other
>>> shared clock between kernel and user space that I could use for this?
>> Kernel: getnstimeofday()
>> Userland: clock_gettime(CLOCK_MONOTONIC, ...)
>>
>> Those two should give you the same data. So printing timespecs from
>> kernel space that come from getnstimeofday() and comparing it to
>> userland clock_gettime(CLOCK_MONOTONIC,...) hopefully will give you
>> what you want.
> 
> Gah! Typed too fast. The above is wrong. You want to use
> clock_gettime(CLOCK_REALTIME,...)  not CLOCK_MONOTONIC with
> getnstimeofday().
> 
> Sorry for the confusion.
> -john
> 

Thanks John!

This is exactly what I am looking for.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ