Hi... On Tuesday 14 March 2006 05:06, Mauricio Lin wrote: > I am trying to measure the CPU time accurately used by a process in > the schedule function through sched_info_depart() and > sched_info_arrive(), but most of time the calculated CPU time is > zero. Where do you get the total CPU time spent by the process? from t->sched_info.cpu_time ? > As in one tick (jiffy increments) many processes are scheduled, it > is not able to measure accurately the CPU time used by the all > scheduled process since the measurement time is based on jiffies > incrementation. if you mean "scheduled" as "marked as runnable", then yes, many processes might be scheduled in one tick interval. But, only one process is selected to actually run on a single CPU core. So in my opinion, the kernel can still track the CPU time pretty accurately (by 1/HZ precision) > Most output got from relayfs shows that CPU time is zero as: > > PID : Name: Jiffies : CPU Time > 4353 : Xorg: 152680 : 0 > 4521 : artsd: 152680 : 0 > 4353 : Xorg: 152680 : 0 Maybe because those processes are mostly in sleeping state? BTW, can you paste your code so we can analyze how do you do the time accounting? regards Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/