LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LinuxQuestions.org Member Intro (https://www.linuxquestions.org/questions/linuxquestions-org-member-intro-24/)
-   -   Adding a profiler to linux kernel scheduler (https://www.linuxquestions.org/questions/linuxquestions-org-member-intro-24/adding-a-profiler-to-linux-kernel-scheduler-236331/)

svi_ya 09-28-2004 04:18 PM

Adding a profiler to linux kernel scheduler
 
Please help me......

I need to build a profiler for the Linux kernel scheduler.
I need to add code to the existing
Linux kernel's schedule() function so that upon every 1000th call, a sequence of information is
printed to the system log _le (/var/log/messages). This information should include:
_ the PID of the process currently running on the CPU being scheduled for,
_ the total number of tasks in the active runqueue,
_ the total number of tasks in the expired runqueue,
_ the total number of tasks waiting for I/O,
_ for each possible priority:
{ if there are no processes with this priority, do nothing
{ if there are processes with this priority, then print out:
_ the priority value,
_ for each active process of this priority:
_ the process ID,
_ the executable name,
_ the time slice left,
_ the static priority,
_ the dynamic priority,
_ the interactivity count.
_ the same for each expired process of this priority.

Example Output
After booting your kernel, sections similar to this should show up in /var/log/messages:
Sep 13 15:14:42 bluehen kernel: ~~~~~~~~~ BEGIN SCHEDULER PROFILE ~~~~~~~~~
Sep 13 15:14:42 bluehen kernel: The pid running right now is 4633
Sep 13 15:14:42 bluehen kernel: The number of active tasks is 3
Sep 13 15:14:42 bluehen kernel: The number of expired tasks is 6
Sep 13 15:14:42 bluehen kernel: The number of tasks waiting on I/O is 0
Sep 13 15:14:42 bluehen kernel: =====PRIORITY: 115====
Sep 13 15:14:42 bluehen kernel: 4633(netscape-bin), TSL=106, PRS=120, PRD=115, I
C=101
Sep 13 15:14:42 bluehen kernel: ------
Sep 13 15:14:42 bluehen kernel: =====PRIORITY: 125====
Sep 13 15:14:42 bluehen kernel: ------
Sep 13 15:14:42 bluehen kernel: 4573(a.out), TSL=102, PRS=120, PRD=125, IC=-101,
Sep 13 15:14:42 bluehen kernel: 4572(a.out), TSL=102, PRS=120, PRD=125, IC=-101
Sep 13 15:14:42 bluehen kernel: =====PRIORITY: 135====
Sep 13 15:14:42 bluehen kernel: ------
Sep 13 15:14:42 bluehen kernel: 4560(a.out), TSL=53, PRS=130, PRD=135, IC=-101


thanks

-v

Aussie 09-29-2004 07:31 AM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php


All times are GMT -5. The time now is 08:05 PM.