Time IO spent by processes

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

 



Hi folks,

   I'm trying to get the time spent in IO by a process.
   So, I need to know if there is any kind of implementation of this task in the kernel.
   I know that there is a struct that holds some statistics (include/linux/sched.h):
#ifdef CONFIG_SCHEDSTATS
struct sched_info {
        /* cumulative counters */
        unsigned long   cpu_time,       /* time spent on the cpu */
                        run_delay,      /* time spent waiting on a runqueue */
                        pcnt;           /* # of timeslices run on this cpu */

        /* timestamps */
        unsigned long   last_arrival,   /* when we last ran on a cpu */
                        last_queued;    /* when we were last queued to run */
};

extern struct file_operations proc_schedstat_operations;
#endif
   The task_struct has one sched_info field.
   But it does not have any reference of IO time spent by the process.
  
   I know that when a process sleeps it normaly uses a wait_queue. So, my
idea is create one field in the sched_info to hold the time spent in IO and
update this field value in the wait_queue manipulation functions (__add_wait_queue
and __remove_wait_queue). Or yet, update this field value in the active_task
and deactivate_task.
   Using activate_task/deactivate_task is still confusing for me. activate_task
uses another function: __activate_task. And the others kernel parts use more
__activate_task than activate_task.

0 sched.c try_to_wake_up 1108 activate_task(p, rq, cpu == this_cpu);
1 sched.c __migrate_task 4182 activate_task(p, rq_dest, 0);

0 sched.c activate_task       756 __activate_task(p, rq);
1 sched.c wake_up_new_task   1237 __activate_task(p, rq);
2 sched.c wake_up_new_task   1248 __activate_task(p, rq);
3 sched.c wake_up_new_task   1265 __activate_task(p, rq);
4 sched.c sched_setscheduler 3451 __activate_task(p, rq);
5 sched.c normalize_rt_tasks 5044 __activate_task(p, task_rq(p));

   So, I need to know:
1. Is there any implementation of this task (getting IO time of the processes) already done in the kernel?
2. If not, Is this idea correct? Adding a new field in the sched_info to hold IO spent and manipulate it in
functions like __add_wait_queue and __remove_wait_queue or active_task and deactivate_task.
3. How do activate_task and deactivate_task work?

   Does anyone know how to help me?


--
Eduardo Bezerra Valentin
Bacharelado em Ciência da Computação - DCC - UFAM
Laboratório de VoIP - GRSD - UFAM

[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