Reputation: 2538
I want to compare scheduling latency between two linux kernel versions. Here is what I have tried so far:
However, wakeup shows results of only highest priority process and not my c program. I tried using nice and capturing it from the trace. Still it shows log for other equally high process. Am I missing some other step here to capture log of my process? Is there a better way to set priority of my process to highest by modifying the source code of my program instead of using nice when launching it?
The next step I tried was disabling the wakeup tracer and just enabling the sched events. The log that I got looks something like this
0 1dNh3 3us+: sched wakeup : task hald : 1952 [120] success=1
−0 1d..3 7us! : sched switch : task swapper : 0 [140] (R) ==>
hald : 1952 [120]
The +
and !
shows delay (referred ftrace kernel doc to know the number). Does it mean that sched wakeup has a latency of '+' and sched witch '!' microseconds respectively?
Are there other ways of comparing linux scheduling latency?
Upvotes: 1
Views: 1824
Reputation: 59
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main2() {
int a;
while(1) {
if (read(0, &a, 4)!=4) exit(1);
if (a==-1) exit(0);
write(1,"01"+(!(a&63) && (a&1023)),1);
}}
int main(int ac, char** av) {
int i,j,k = (ac>1 ? atoi(av[1]) : 10) << 10;
int pipe0[2], pipe1[2];
pipe(pipe0); pipe(pipe1);
int pid = fork(); switch(pid) {
case -1: perror("fork"); return 1;
case 0:
close(0); dup2(pipe1[0], 0);
close(1); dup2(pipe0[1], 1);
return main2();
default: break;
}
int sum = 0; char c;
for (i=0; i<k; i++) {
write(pipe1[1], &i, 4);
read(pipe0[0], &c, 1); sum += c&1;
}
i=-1; write(pipe1[1], &i, 4);
printf("%d %d\n", k, sum);
}
Upvotes: 1