2017-05-11 6 views
0

私はMinix 3でschedule.cファイル(/usr/src/minix/servers/sched/schedule.c)を修正しようとしています。量子を使い切ったすべてのプロセスについて、どのくらいのsys時間が経過したかを知りたい。 do_noquantum()に次の行を追加したいと思います。Minixスケジューラ - システム時間をチェックするには?

... 
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); 
... 

しかし、私は適切なタイプと機能についてはわかりません。また、別の、より良い方法があります。

答えて

2

MINIXのsyslib.hのsys_times()関数を使用できます。 これは、次の宣言がある:

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

あなたはそれをあなたが興味を持っているし、それが正しい情報でポインタを埋めclock_tパラメータへのプロセスとポインタの終点を養います。

関連する問題