Skip to content

Commit

Permalink
ACPI: C-States: accounting of sleep states
Browse files Browse the repository at this point in the history
Track the actual time spent in C-States (C2 upwards, we can't determine this
for C1), not only the number of invocations.  This is especially useful for
dynamic ticks / "tickless systems", but is also of interest on normal systems,
as any interrupt activity leads to C-States being exited, not only the timer
interrupt.

The time is being measured in PM timer ticks, so an increase by one equals 279
nanoseconds.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Dominik Brodowski authored and Len Brown committed Jun 28, 2006
1 parent 95b38b3 commit a3c6598
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ static void acpi_processor_idle(void)
cx = &pr->power.states[ACPI_STATE_C1];
#endif

cx->usage++;

/*
* Sleep:
* ------
Expand Down Expand Up @@ -430,6 +428,9 @@ static void acpi_processor_idle(void)
local_irq_enable();
return;
}
cx->usage++;
if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0))
cx->time += sleep_ticks;

next_state = pr->power.state;

Expand Down Expand Up @@ -1053,9 +1054,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
else
seq_puts(seq, "demotion[--] ");

seq_printf(seq, "latency[%03d] usage[%08d]\n",
seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n",
pr->power.states[i].latency,
pr->power.states[i].usage);
pr->power.states[i].usage,
pr->power.states[i].time);
}

end:
Expand Down
1 change: 1 addition & 0 deletions include/acpi/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct acpi_processor_cx {
u32 latency_ticks;
u32 power;
u32 usage;
u64 time;
struct acpi_processor_cx_policy promotion;
struct acpi_processor_cx_policy demotion;
};
Expand Down

0 comments on commit a3c6598

Please sign in to comment.