Giulio Moro via Xenomai <[email protected]> writes:
> Hi everyone, > From /proc/xenomai/sched/stat I infer there must be an internal struct > somewhere keeping track of how much CPU time is actually used by each > thread. Is there any way to access this kind of statistics from a > running Xenomai user space program without leaving primary mode and > without attempting to read this file? I am implementing an > infrastructure to measure the CPU time of a given block of > code. Currently I am using Cobalt's clock_gettime(), but this only > works reliably if the task does not get preempted or otherwise > rescheduled between the two calls. > > I have run this kind of tests offline before and that's all nice and good, > but I am looking for a lightweight and non invasive way of benchmarking > particular sections of large-ish programs with minimal modifications. > > Thanks, > Giulio For xenomai3, you may want to have a look at cobalt_thread_stat() from the internal API (sys/cobalt.h). The field of interest returned in struct cobalt_threadstat would be 'xtime' (nsecs). -- Philippe.
