Re: How do we profile our code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I also use clock():
Where is clock() defined?

check out man clock(3).

       #include <time.h>

       clock_t clock(void);



I just wanted to confirm this:
Using gettimeofday() will never give me a correct result because:
It is a user space app. which the scheduler can kick out anytime. Right? Anything else ?

Yep. you want the time consumed by your app. not how much time passed in real world.

Secondly, the resolution that i get thru gettimeofday() after conversion can be upto microseconds. But I fear that is fake ? A resolution upto millisecond is correct? This has something to do with the sys clock / timing issues I read somewhere.

I don't know about that.

You might also try the times(2) sys-call, to get time spent in user/system for the calling process.

Hayim.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux