Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 81100
b: refs/heads/master
c: 53024fe
h: refs/heads/master
v: v3
  • Loading branch information
Milton Miller authored and Paul Mackerras committed Dec 20, 2007
1 parent 74b5057 commit 7fd2631
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db3801a858e97adee0f3b4c732e6ff325d95e0a5
refs/heads/master: 53024fe250a0f044b114844a01456902bce40ade
21 changes: 13 additions & 8 deletions trunk/arch/powerpc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ static u64 read_purr(void)
*/
static u64 read_spurr(u64 purr)
{
if (cpu_has_feature(CPU_FTR_SPURR))
/*
* cpus without PURR won't have a SPURR
* We already know the former when we use this, so tell gcc
*/
if (cpu_has_feature(CPU_FTR_PURR) && cpu_has_feature(CPU_FTR_SPURR))
return mfspr(SPRN_SPURR);
return purr;
}
Expand All @@ -230,29 +234,30 @@ static u64 read_spurr(u64 purr)
*/
void account_system_vtime(struct task_struct *tsk)
{
u64 now, nowscaled, delta, deltascaled;
u64 now, nowscaled, delta, deltascaled, sys_time;
unsigned long flags;

local_irq_save(flags);
now = read_purr();
delta = now - get_paca()->startpurr;
get_paca()->startpurr = now;
nowscaled = read_spurr(now);
delta = now - get_paca()->startpurr;
deltascaled = nowscaled - get_paca()->startspurr;
get_paca()->startpurr = now;
get_paca()->startspurr = nowscaled;
if (!in_interrupt()) {
/* deltascaled includes both user and system time.
* Hence scale it based on the purr ratio to estimate
* the system time */
sys_time = get_paca()->system_time;
if (get_paca()->user_time)
deltascaled = deltascaled * get_paca()->system_time /
(get_paca()->system_time + get_paca()->user_time);
delta += get_paca()->system_time;
deltascaled = deltascaled * sys_time /
(sys_time + get_paca()->user_time);
delta += sys_time;
get_paca()->system_time = 0;
}
account_system_time(tsk, 0, delta);
get_paca()->purrdelta = delta;
account_system_time_scaled(tsk, deltascaled);
get_paca()->purrdelta = delta;
get_paca()->spurrdelta = deltascaled;
local_irq_restore(flags);
}
Expand Down

0 comments on commit 7fd2631

Please sign in to comment.