diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2006-02-07 21:22:02 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2006-02-07 21:22:02 +0000 |
commit | 5b1a8eb397992f3b5992da7b26c999c410c9e5f0 (patch) | |
tree | 95918de865b5c6e707ecd4ce458d058d287406e9 /sys/sparc64 | |
parent | 9bfe35c80d28ed1fcb74b0ecf0a812afeafed6b1 (diff) | |
download | src-5b1a8eb397992f3b5992da7b26c999c410c9e5f0.tar.gz src-5b1a8eb397992f3b5992da7b26c999c410c9e5f0.zip |
Modify the way we account for CPU time spent (step 1)
Keep track of time spent by the cpu in various contexts in units of
"cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t
only when somebody wants to inspect the numbers.
For now "cputicks" are still derived from the current timecounter
and therefore things should by definition remain sensible also on
SMP machines. (The main reason for this first milestone commit is
to verify that hypothesis.)
On slower machines, the avoided multiplications to normalize timestams
at every context switch, comes out as a 5-7% better score on the
unixbench/context1 microbenchmark. On more modern hardware no change
in performance is seen.
Notes
Notes:
svn path=/head/; revision=155444
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/mp_machdep.c | 2 | ||||
-rw-r--r-- | sys/sparc64/sparc64/tick.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sys/sparc64/sparc64/mp_machdep.c b/sys/sparc64/sparc64/mp_machdep.c index ff2a0d4bd55d..e4e8280bfc44 100644 --- a/sys/sparc64/sparc64/mp_machdep.c +++ b/sys/sparc64/sparc64/mp_machdep.c @@ -361,7 +361,7 @@ cpu_mp_bootstrap(struct pcpu *pc) /* ok, now grab sched_lock and enter the scheduler */ mtx_lock_spin(&sched_lock); spinlock_exit(); - binuptime(PCPU_PTR(switchtime)); + PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); cpu_throw(NULL, choosethread()); /* doesn't return */ } diff --git a/sys/sparc64/sparc64/tick.c b/sys/sparc64/sparc64/tick.c index 09ba1f124198..6f9f1a81601a 100644 --- a/sys/sparc64/sparc64/tick.c +++ b/sys/sparc64/sparc64/tick.c @@ -65,6 +65,20 @@ SYSCTL_INT(_machdep_tick, OID_AUTO, adjust_ticks, CTLFLAG_RD, &adjust_ticks, static void tick_hardclock(struct trapframe *); +static uint64_t +tick_cputicks(void) +{ + + return (rd(tick)); +} + +static uint64_t +tick_cputickrate(void) +{ + + return (tick_freq); +} + void cpu_initclocks(void) { @@ -156,6 +170,9 @@ tick_init(u_long clock) * handled. */ tick_stop(); + + cpu_ticks = tick_cputicks; + cpu_tickrate = tick_cputickrate; } void |