- timerclear(&p->p_ru->ru_utime);
- timerclear(&p->p_ru->ru_stime);
-
- if (task) {
- task_basic_info_32_data_t tinfo;
- task_thread_times_info_data_t ttimesinfo;
- task_events_info_data_t teventsinfo;
- mach_msg_type_number_t task_info_stuff, task_ttimes_stuff;
- mach_msg_type_number_t task_events_stuff;
- struct timeval ut,st;
-
- task_info_stuff = TASK_BASIC_INFO_32_COUNT;
- task_info(task, TASK_BASIC2_INFO_32,
- (task_info_t)&tinfo, &task_info_stuff);
- p->p_ru->ru_utime.tv_sec = tinfo.user_time.seconds;
- p->p_ru->ru_utime.tv_usec = tinfo.user_time.microseconds;
- p->p_ru->ru_stime.tv_sec = tinfo.system_time.seconds;
- p->p_ru->ru_stime.tv_usec = tinfo.system_time.microseconds;
-
- p->p_ru->ru_maxrss = tinfo.resident_size;
-
- task_ttimes_stuff = TASK_THREAD_TIMES_INFO_COUNT;
- task_info(task, TASK_THREAD_TIMES_INFO,
- (task_info_t)&ttimesinfo, &task_ttimes_stuff);
-
- ut.tv_sec = ttimesinfo.user_time.seconds;
- ut.tv_usec = ttimesinfo.user_time.microseconds;
- st.tv_sec = ttimesinfo.system_time.seconds;
- st.tv_usec = ttimesinfo.system_time.microseconds;
- timeradd(&ut,&p->p_ru->ru_utime,&p->p_ru->ru_utime);
- timeradd(&st,&p->p_ru->ru_stime,&p->p_ru->ru_stime);
-
- task_events_stuff = TASK_EVENTS_INFO_COUNT;
- task_info(task, TASK_EVENTS_INFO,
- (task_info_t)&teventsinfo, &task_events_stuff);
-
- p->p_ru->ru_minflt = (teventsinfo.faults -
- teventsinfo.pageins);
- p->p_ru->ru_majflt = teventsinfo.pageins;
- p->p_ru->ru_nivcsw = (teventsinfo.csw -
- p->p_ru->ru_nvcsw);
- if (p->p_ru->ru_nivcsw < 0)
- p->p_ru->ru_nivcsw = 0;
- }