Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299076
b: refs/heads/master
c: cb85a6e
h: refs/heads/master
v: v3
  • Loading branch information
Martin Schwidefsky authored and Thomas Gleixner committed Mar 30, 2012
1 parent c7b5c5a commit cd13edc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 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: aa2bf9bc6414b6972b9e51903c1ce7b1f057aee2
refs/heads/master: cb85a6ed67e979c59a29b7b4e8217e755b951cf4
34 changes: 28 additions & 6 deletions trunk/fs/proc/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,39 @@
#ifndef arch_irq_stat
#define arch_irq_stat() 0
#endif
#ifndef arch_idle_time
#define arch_idle_time(cpu) 0
#endif

#ifdef arch_idle_time

static cputime64_t get_idle_time(int cpu)
{
cputime64_t idle;

idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
idle += arch_idle_time(cpu);
return idle;
}

static cputime64_t get_iowait_time(int cpu)
{
cputime64_t iowait;

iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
if (cpu_online(cpu) && nr_iowait_cpu(cpu))
iowait += arch_idle_time(cpu);
return iowait;
}

#else

static u64 get_idle_time(int cpu)
{
u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL);

if (idle_time == -1ULL) {
if (idle_time == -1ULL)
/* !NO_HZ so we can rely on cpustat.idle */
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
idle += arch_idle_time(cpu);
} else
else
idle = usecs_to_cputime64(idle_time);

return idle;
Expand All @@ -49,6 +69,8 @@ static u64 get_iowait_time(int cpu)
return iowait;
}

#endif

static int show_stat(struct seq_file *p, void *v)
{
int i, j;
Expand Down

0 comments on commit cd13edc

Please sign in to comment.