diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-10-15 12:26:54 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-10-15 12:26:54 +0000 |
commit | 035545c70eaa2271f0cee296801c46fbe45ebefc (patch) | |
tree | cde563e9712a15e559916350b8567a0d060bbc4b | |
parent | a61771a7ded48811b10f380890c0972ab00e1cc3 (diff) |
Fix runtime calculation. Assiging ts to spc_runtime does not work if ts
is modified.
OK tb@ jca@
-rw-r--r-- | sys/kern/kern_resource.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index bd2c5468fba..56dc366f5e5 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -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); } |