* Update the rusage_ext structure and fetch a valid aggregate rusage * for proc p if storage for one is supplied. */
| 1162 | * for proc p if storage for one is supplied. |
| 1163 | */ |
| 1164 | void |
| 1165 | rufetch(struct proc *p, struct rusage *ru) |
| 1166 | { |
| 1167 | struct thread *td; |
| 1168 | |
| 1169 | PROC_STATLOCK_ASSERT(p, MA_OWNED); |
| 1170 | |
| 1171 | *ru = p->p_ru; |
| 1172 | if (p->p_numthreads > 0) { |
| 1173 | FOREACH_THREAD_IN_PROC(p, td) { |
| 1174 | ruxagg(p, td); |
| 1175 | rucollect(ru, &td->td_ru); |
| 1176 | } |
| 1177 | } |
| 1178 | } |
| 1179 | |
| 1180 | /* |
| 1181 | * Atomically perform a rufetch and a calcru together. |
no test coverage detected