LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-13-2011, 04:33 PM   #1
cat_n_mouse
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Rep: Reputation: Disabled
How accurate is strace?


Greetings all,

Anyone know how accurate strace is when displaying the time taken to execute a system call?

The reason I ask is if I use nanosleep(100000) in a program then compile it
and do a "strace -T" is shows 0.100080 which is an error of 80uS (a lifetime on a 1.7GHz PC).

In most situations such a small error is of no consequence but there are times
when it does make a difference.

Is the error in strace or in nanosleep?

B.T.W. a printf("some_text") takes 50uS to execute on the same computer according to strace.

Thanking you in advance.
 
Old 08-13-2011, 06:29 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Just a hypothetical answer: executing a program under strace (or
anything other than a hardware debugger) would naturally incur
a performance penalty?


Cheers,
Tink
 
Old 08-13-2011, 06:41 PM   #3
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,252

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
The accurate of nanosleep() depends on kernel version, kernel configuration options (CONFIG_HZ, CONFIG_NO_HZ, CONFIG_HIGH_RES_TIMERS) and hardware clocks precision.
 
Old 08-13-2011, 11:09 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
I use strace more for functionality rather than precision - I often just use relative timing. But for comparison, not absolute timings.
Maybe have a look at perf stats or (kernel) function tracing.

Last edited by syg00; 08-14-2011 at 02:26 AM. Reason: typo
 
Old 08-14-2011, 03:55 AM   #5
cat_n_mouse
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you all for your comments and guidance.

I did expect an overhead running strace I just didn't expect 80uS worth.
I will investigate the kernel config. options and look at perf stats.

Thanks once again.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
strace palisetty_suman Linux - Newbie 2 07-01-2012 09:24 AM
strace option mohit_parihar Linux - General 4 01-27-2010 12:39 AM
strace app RajRed Linux - Software 1 12-03-2005 01:39 AM
Usage of strace mdb84 Linux - Software 1 03-25-2005 03:13 AM
strace useradd phoenix_fei Programming 1 11-29-2004 11:32 AM


All times are GMT -5. The time now is 07:00 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration