diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-10-25 20:17:39 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-10-25 20:17:39 +0200 |
commit | 3fce94e7850ab80d14fa15f2f393ae71259376e5 (patch) | |
tree | c9eb3d2b3b52130690c1fcce43afabd4e9adfcdd /sys/src/9/pc/main.c | |
parent | 83865180a29d7feba2a1f460abf17315562141c3 (diff) |
fix _tos->pcycles, make _tos->kcycles actually count cycles executing kernel code on behalf of the process
Diffstat (limited to 'sys/src/9/pc/main.c')
-rw-r--r-- | sys/src/9/pc/main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/src/9/pc/main.c b/sys/src/9/pc/main.c index ff928af2e..0172de1de 100644 --- a/sys/src/9/pc/main.c +++ b/sys/src/9/pc/main.c @@ -580,11 +580,14 @@ mathinit(void) * set up floating point for a new process */ void -procsetup(Proc*p) +procsetup(Proc *p) { p->fpstate = FPinit; fpoff(); + cycles(&p->kentry); + p->pcycles = -p->kentry; + memset(p->gdt, 0, sizeof(p->gdt)); p->ldt = nil; p->nldt = 0; @@ -593,6 +596,9 @@ procsetup(Proc*p) void procfork(Proc *p) { + p->kentry = up->kentry; + p->pcycles = -p->kentry; + /* inherit user descriptors */ memmove(p->gdt, up->gdt, sizeof(p->gdt)); @@ -611,7 +617,9 @@ procrestore(Proc *p) if(p->kp) return; + cycles(&t); + p->kentry += t; p->pcycles -= t; } @@ -624,7 +632,9 @@ procsave(Proc *p) uvlong t; cycles(&t); + p->kentry -= t; p->pcycles += t; + if(p->fpstate == FPactive){ if(p->state == Moribund) fpclear(); |