Question: I have written a c program which shows voluntary and involuntary context switches but when I run the program, it gives 0 now i want
I have written a c program which shows voluntary and involuntary context switches but when I run the program, it gives 0
now i want to print three values
Pid : 123 nr_voluntary_switches : 10 nr_involuntary_switches : 12
I have to modify the struct named task_struct, to get desired values, modify this struct along with INIT_TASK macro;
but I have not much skills to modify these values and also help me to modify this program
#include
struct rusage ru; getrusage(RUSAGE_SELF, &ru); printf(" voluntary context switches %ld,involuntary context switches %ld ", ru.ru_nvcsw,ru.ru_nivcsw);
}
plz help me
thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
