Hi All,
I am trying to measure the CPU time consumed by a function foo(), and here is
how I do it:
void foo(){
struct timespec tp1, tp2;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp);
//Computation goes here
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp2);
//The CPU time is given between the difference between tp2 and tp 1
}
The program is running on Ubuntu 10.10, and the kernel is 2.6.37 patched with
Xenomai 2.5.6
Here is what I observed:
1) If foo() is running in the Linux domain (i.e., called by a regular Linux
process), the CPU time obtained by the above method looks normal, and the mean
CPU time of 25000 invocations of foo() is 10 ms.
2) If foo() is running in the primary domain (i.e., called by a Xenomai task
spawned by rt_task_create() and rt_task_start()), then *most of the time*, the
CPU time also looks as normal as the result in 1), and the mean CPU time is
also about 10 ms. However, I also noticed that sometimes the CPU time obtained
by the above method is 0. This zero value did not appear often, and out of
25000 invocations of foo(), I noticed that there is only 1 invocation of foo()
where the CPU time is 0. BTW, the Xenomai task's priority is 99.
What causes this 0 CPU time in the primary domain? Is there something wrong
with my method to measure the CPU time?
Thanks,
Tom
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help