How accurate is strace? (SOLVED)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
cat_n_mouse
Posts: 12
Joined: Thu 04 Aug 2011, 18:29
Location: /usr/bin/Paulo

How accurate is strace? (SOLVED)

#1 Post by cat_n_mouse »

Greetings,

Can anyone tell me if the time shown with "strace -T" for each system call
is at all representative of the actual time taken when the program executes that sys_call?

For example I write a program in C with a printf("hello"); then I do a strace
with the -T option, amongst other things it displays:

write(1,"hello") <0.000050>

does it mean that the program will take 0.000050 (or 50 microseconds) to execute the printf statement or is it just relevant to strace?

Thanks.
Last edited by cat_n_mouse on Sun 14 Aug 2011, 08:04, edited 1 time in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#2 Post by amigo »

I suspect that it has relevance only to strace, but you should probably ask somewhere else where there are more experienced users, like linuxquestions.org programming forum.

User avatar
cat_n_mouse
Posts: 12
Joined: Thu 04 Aug 2011, 18:29
Location: /usr/bin/Paulo

#3 Post by cat_n_mouse »

Thanks amigo, I will do so.

User avatar
cat_n_mouse
Posts: 12
Joined: Thu 04 Aug 2011, 18:29
Location: /usr/bin/Paulo

#4 Post by cat_n_mouse »

Solved.

I took amigos advice and this little pup went to play with the big dogs
over at linuxquestions.org

The answer lies with the kernel configuration options (CONFIG_HZ, CONFIG_NO_HZ, CONFIG_HIGH_RES_TIMERS) and hardware clocks precision.

Also running under any debugger/tracer (strace included) will incur a speed penalty,
I just didn't expect such an overhead (80uS in 100mS)

Post Reply