LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-01-2017, 12:37 PM   #1
cxu
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Rep: Reputation: Disabled
clock_gettime(MONOTONIC) lagging 13 sec from gettimeofday() in a HyperV VM (ubuntu)


Our code runs on a ubuntu 16.04 VM (under HyperV of Windows Server 2016). We have periodic timer to print trace information every 30 seconds. Each trace is composed of a timestamp retrieved via clock_gettime(MONOTONIC), the process id, thread id, and the message. For some messages, we also print the wall clock using gettimeofday(). There was an occurrence that clock_gettime(MONOTONIC) apparently lagged for 13 second, while gettimeofday() was still getting the correct time.

We are pretty sure that the gettimeofday() is correctly representing the real world time: Since we are also tracing the network-receive from another machine who sends packets every 15 second; during the above abnormal period, the two timestamps of the message-receive traces showed an time interval of 2 seconds only.

Is there any theory explaining this, or what could possibly cause it, say, the host is suspending the VM or the host is overloaded? Our code heavily depends on the correctness of MONOTONIC, so needs to find the cause and work around.

I understand that in kernel, gettimeofday() is just another layer on top of MONOTONIC, and assume they should be always consistent.
 
Old 03-01-2017, 02:42 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
When you say "periodic timer to print traceinfo", what clock is that based on?
 
Old 03-01-2017, 02:54 PM   #3
cxu
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
We used timer_create(CLOCK_MONOTONIC..), and real-time signal for delivering timer expiration.
 
  


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
iozone - how to to specify output in MB/sec isntead of KB/sec? Red Squirrel Linux - Server 4 02-09-2016 06:51 PM
Help-Need to access files in crashed Ubuntu running in Windows 2008 Server HyperV tearsforhari Linux - Newbie 4 05-13-2015 08:18 AM
can't boot to ubuntu: session lasted less than 10 sec. mhg Linux - Newbie 25 06-07-2007 05:01 PM
Mandrake 10 Internet very slow (<1kb/sec) while windows got 50k/sec SafeTechs Mandriva 13 09-01-2006 04:07 PM
hdparm 64MB in 19.68 sec=3.25 MB/sec illtbagu Linux - General 11 06-26-2003 07:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:37 PM.

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