mirror of
https://github.com/openbsd/src.git
synced 2026-04-24 14:14:37 +00:00
Fix runtime calculation. Assiging ts to spc_runtime does not work if ts
is modified. OK tb@ jca@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: kern_resource.c,v 1.91 2024/10/08 11:57:59 claudio Exp $ */
|
||||
/* $OpenBSD: kern_resource.c,v 1.92 2024/10/15 12:26:53 claudio Exp $ */
|
||||
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
|
||||
|
||||
/*-
|
||||
@@ -448,7 +448,7 @@ tuagg_add_runtime(void)
|
||||
{
|
||||
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
|
||||
struct proc *p = curproc;
|
||||
struct timespec ts;
|
||||
struct timespec ts, delta;
|
||||
|
||||
/*
|
||||
* Compute the amount of time during which the current
|
||||
@@ -463,14 +463,14 @@ tuagg_add_runtime(void)
|
||||
(long long)spc->spc_runtime.tv_sec,
|
||||
spc->spc_runtime.tv_nsec);
|
||||
#endif
|
||||
timespecclear(&ts);
|
||||
timespecclear(&delta);
|
||||
} else {
|
||||
timespecsub(&ts, &spc->spc_runtime, &ts);
|
||||
timespecsub(&ts, &spc->spc_runtime, &delta);
|
||||
}
|
||||
/* update spc_runtime */
|
||||
spc->spc_runtime = ts;
|
||||
tu_enter(&p->p_tu);
|
||||
timespecadd(&p->p_tu.tu_runtime, &ts, &p->p_tu.tu_runtime);
|
||||
timespecadd(&p->p_tu.tu_runtime, &delta, &p->p_tu.tu_runtime);
|
||||
tu_leave(&p->p_tu);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user