Re: Time statistics of process

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

 



Hello.... :)

> This is a structure that contains information about scheduling, for a
> single process, by the look of it.

correct, this is for single process / thread. IIRC, these fields can be 
accessed on /proc/<pid> schedstat. Make sure you have compiled your 
kernel with CONFIG_SCHEDSTATS=y

check Documentation/sched-stats.txt for further informations :)

> cpu_time gives a measure of the amount of time the process has spent
> running on the given cpu (Presumably there's one of these structures
> for each cpu, for each process).  That's probably given in jiffies or
> something, I dunnno =)

IIRC this cpu_time field is cumulative time for a process being executed 
throughout all the available processor.... 

I also saw this sched_info structure is also assigned on runqueue 
definition....so each CPU is also tracking how long it has executed all 
the runnable processes since booting....

> run_delay gives the amount of time spent waiting for access to the
> given cpu, in order to run (in a blocked/sleeping state, as it were)
> - That means, run_delay + cpu_time gives the total real time that
> process has existed, presumably.

IMO, this is wrong. run_delay is the interval between a task inserted on 
a runqueue and marked as TASK_RUNNING until it is actually running 
(executed on a processor), so the previous state isn't blocked 
(TASK_STOPPED) or sleep (TASK_INTERRUPTIBLE / TASK_UNINTERRUPTIBLE).
Follow the enqueue_task() function and you will see what I truly mean :)

> pcnt gives the number of timeslices that the process has had on the
> cpu (A timeslice is a period of time that a process is allowed to
> run, before surrendering the CPU to another process.. The amount of
> time is given by the TIMESLICE constant, and it's implemented by
> using a timer IRQ set to that amount of time).

maybe, to avoid confusion, I prefer to interpret "pcnt" as the "how many 
times a certain task has been executed until this very moment". 

>Similarly,
> last_queued gives a measure of how long it's been since the process
> was queued for the CPU.  I don't know what this value would be when
> the process is waiting for IO; It may just equal the last time the
> process was waiting, and perhaps it would be updated once the IO
> completes, ready to run the process again.

no, last_queued is a timestamp, so this is not an interval :) the 
complete defintion is "the time a task enters a runqueue and thus 
marked as TASK_RUNNING".  And yes, it is measured in jiffies :)

to Mike: not bad, man.... :) you receive A grade IMHO :)

regards

Mulyadi


--
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