performance measurements

I was looking for a simple way to measure time spent in various routines of
my program (multiple processes) and was thinking about using slogf and
outputing a timestamp and location at key points. Since I am running under
multiple processes, I was looking for a timestamp in the millisecond range
that would be common accross processes. I understand there is a single
counter per cpu (and we only have one). However, then I handle if it rolls
over (maybe multiple times?) between snapshots.

Is there a better single time routine that has better than second resolution
to use for the time stamp?

I’ve had good luck using ‘hogs’.
I usually execute something like
$ hogs -n -%1 -p40

Jay Witherspoon wrote:

I was looking for a simple way to measure time spent in various routines of
my program (multiple processes) and was thinking about using slogf and
outputing a timestamp and location at key points. Since I am running under
multiple processes, I was looking for a timestamp in the millisecond range
that would be common accross processes. I understand there is a single
counter per cpu (and we only have one). However, then I handle if it rolls
over (maybe multiple times?) between snapshots.

Is there a better single time routine that has better than second resolution
to use for the time stamp?

Jay Witherspoon <spoon@scubadiving.com> wrote:

I was looking for a simple way to measure time spent in various routines of
my program (multiple processes) and was thinking about using slogf and
outputing a timestamp and location at key points. Since I am running under
multiple processes, I was looking for a timestamp in the millisecond range
that would be common accross processes. I understand there is a single
counter per cpu (and we only have one). However, then I handle if it rolls
over (maybe multiple times?) between snapshots.

Is there a better single time routine that has better than second resolution
to use for the time stamp?

clock_gettime() will give you 32 bit seconds, 32 bit nanoseconds since
last second. Resolution is your ticksize (normally about 1ms).

ClockCycles() will give 64-bit value of free running counter. Resolution
is SYSPAGE_ENTRY(qtime)->cycles_per_sec.

(On x86, for example, ClockCycles() is based on the pentium and above
rtdsc opcode, which updates at the core frequency, that is, on a
1GHz machine, it would have a resolution of 1ns.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.