LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-15-2015, 04:16 AM   #1
rainman1985_2010
Member
 
Registered: Oct 2010
Posts: 47

Rep: Reputation: 0
How to get nanoseconds inside the kernel?


Hi, everyone

I've got a need to measure io latency in a kernel module in terms of nanoseconds. Is there any routine like clock_gettime in the user space that can get highly precise timestamps in kernel?

Thank you:-)
 
Old 07-15-2015, 05:18 AM   #2
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
this should help

https://lwn.net/Articles/167897/
 
Old 07-15-2015, 09:04 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Also ... "you'll never get nanoseconds." Especially when it comes to I/O latencies, which are almost exclusively ruled by the vagaries of hardware devices. About the best that you can hope for is a bunch of samples from which you can take means and standard-deviations. Millisecond accuracy is certainly good enough, due to the fact that a physical device is the ruling constraint, and I therefore would probably round them or truncate them to milliseconds, treating the rest as noise.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installing older kernel inside VMWare on top of new kernel suhail_yousaf Linux - Newbie 2 01-19-2009 04:59 AM
How to use kernel's crypto API inside the kernel to compute an MD5 hash ? linuxabhinav Linux - Kernel 2 05-28-2008 11:35 AM
¿IPC inside Kernel? (help) Ojp Programming 4 03-21-2006 02:35 PM
strcpy inside kernel space vishalbutte Programming 1 02-28-2006 06:34 PM
Kernel Inside Out unixbrain Linux - Newbie 6 09-23-2003 06:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration