Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


  Search this Thread
Old 11-08-2012, 04:58 PM   #1
Registered: Aug 2012
Posts: 76

Rep: Reputation: Disabled
hypercall to get time

Hi all I have two virtual machines, and I'm running two c code on them. I want to calculate the time each code has taken to run on each VM. I know I have to get time at the beginning and at end of program. Finally compares the differences. Is it right?
How can I get time(I know how to get time in C, I mean is that enough, if I want to be really precise)? should I make any hypercall?
Old 11-10-2012, 05:10 AM   #2
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252

Assuming you don't need insane granularity (like fractions of a second), I'd just stick to capturing the epoch before and after your code ran, then getting the difference.
 date +%s
Old 11-18-2012, 12:49 AM   #3
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
Taking time measurements inside a VM can never be extremely precise, VMs are not meant to run RTOS after all, and miniscule timedrifts can always happen. If you're not too concerned about microseconds, then it should be OK though. Just make sure the host's CPU is not overcommitted, because that's what usually causes timedrift


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
user time, system time, real time .. reg chaitanyajun12 Linux - Newbie 7 03-14-2016 05:43 PM
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 10:10 AM
PAM time restrictions - changing Time.conf so it gets time from sql table noodlesoffire Linux - Newbie 1 04-04-2010 04:41 PM
System time vs Hardware time and Daylight Savings Time Toadman Linux - Networking 6 03-16-2007 07:14 PM > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 09:34 PM.

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