0

I'm trying to modify schedule.c file ( /usr/src/minix/servers/sched/schedule.c ) in Minix 3. For every process that used up it's quantum, I want to see how much sys time passed. So I want to add following lines to do_noquantum():

...
rmp = &schedproc[proc_nr_n];
minix_time_type curr_time = minix_function_to_get_curr_time();
minix_time_type time_passed = curr_time - last_time[proc_nr_n];
//last_time[NR_PROCS] is a global array
last_time[proc_nr_n] = curr_time;
do_something_with_this_knowledge(time_passed);
...

But I don't know the proper types and functions. Also - maybe there's another, better way to do it.

Jecke
  • 239
  • 2
  • 13

1 Answers1

2

You can use the sys_times() function from syslib.h in MINIX. It has the following declaration:

int sys_times(endpoint_t proc_ep, clock_t* user_time, clock_t* sys_time, clock_t* uptime, clock_t* boottime)

You feed it the endpoint of the process and pointers to the clock_t parameters that you are interested in and it fills the pointers with the correct information.

Martin K
  • 43
  • 6