From: "john stultz" <johnstul@us.ibm.com>
To: "George Nychis" <gnychis@cmu.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: printing current system time from kernel space
Date: Mon, 22 Sep 2008 13:28:17 -0700 [thread overview]
Message-ID: <1f1b08da0809221328v19f84fb9n7c535f6f01157ba@mail.gmail.com> (raw)
In-Reply-To: <48D72AAD.3000805@cmu.edu>
On Sun, Sep 21, 2008 at 10:18 PM, George Nychis <gnychis@cmu.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.
Let me know if I misunderstood.
thanks
-john
next prev parent reply other threads:[~2008-09-22 20:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-22 5:18 George Nychis
2008-09-22 7:07 ` Sitsofe Wheeler
2008-09-22 15:11 ` George Nychis
2008-09-22 20:28 ` john stultz [this message]
2008-09-22 20:30 ` john stultz
2008-09-22 20:33 ` George Nychis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f1b08da0809221328v19f84fb9n7c535f6f01157ba@mail.gmail.com \
--to=johnstul@us.ibm.com \
--cc=gnychis@cmu.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®