linux/include/asm-ppc
Paul Mackerras c6622f63db powerpc: Implement accurate task and CPU time accounting
This implements accurate task and cpu time accounting for 64-bit
powerpc kernels.  Instead of accounting a whole jiffy of time to a
task on a timer interrupt because that task happened to be running at
the time, we now account time in units of timebase ticks according to
the actual time spent by the task in user mode and kernel mode.  We
also count the time spent processing hardware and software interrupts
accurately.  This is conditional on CONFIG_VIRT_CPU_ACCOUNTING.  If
that is not set, we do tick-based approximate accounting as before.

To get this accurate information, we read either the PURR (processor
utilization of resources register) on POWER5 machines, or the timebase
on other machines on

* each entry to the kernel from usermode
* each exit to usermode
* transitions between process context, hard irq context and soft irq
  context in kernel mode
* context switches.

On POWER5 systems with shared-processor logical partitioning we also
read both the PURR and the timebase at each timer interrupt and
context switch in order to determine how much time has been taken by
the hypervisor to run other partitions ("steal" time).  Unfortunately,
since we need values of the PURR on both threads at the same time to
accurately calculate the steal time, and since we can only calculate
steal time on a per-core basis, the apportioning of the steal time
between idle time (time which we ceded to the hypervisor in the idle
loop) and actual stolen time is somewhat approximate at the moment.

This is all based quite heavily on what s390 does, and it uses the
generic interfaces that were added by the s390 developers,
i.e. account_system_time(), account_user_time(), etc.

This patch doesn't add any new interfaces between the kernel and
userspace, and doesn't change the units in which time is reported to
userspace by things such as /proc/stat, /proc/<pid>/stat, getrusage(),
times(), etc.  Internally the various task and cpu times are stored in
timebase units, but they are converted to USER_HZ units (1/100th of a
second) when reported to userspace.  Some precision is therefore lost
but there should not be any accumulating error, since the internal
accumulation is at full precision.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-02-24 14:05:56 +11:00
..
8xx_immap.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amigahw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amigaints.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amigappc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amigayle.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amipcmcia.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ans-lcd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bootinfo.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bootx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
btext.h [PATCH] powerpc: Unify udbg (#2) 2006-01-09 14:49:54 +11:00
commproc.h [PATCH] ppc32 8xx: Fix harmless warning in 8xx_io/commproc.c 2005-11-03 16:57:07 +11:00
cpm2.h [PATCH] ppc32: add missing define for fs_enet Ethernet driver 2005-11-18 07:49:45 -08:00
delay.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
floppy.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gg2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gt64260.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gt64260_defs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
harrier.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
hawk.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hawk_defs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
highmem.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hydra.h [PATCH] ppc trivial iomem annotations: chrp 2005-04-24 14:58:08 -07:00
ibm4xx.h [PATCH] powerpc: Add support for Xilinx ML403 reference design 2006-02-07 22:36:01 +11:00
ibm44x.h [PATCH] powerpc: generalize PPC44x_PIN_SIZE 2006-01-20 16:13:50 +11:00
ibm403.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ibm405.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ibm_ocp.h [PATCH] ppc32: remove "jumbo" member from ocp_func_emac_data 2006-01-06 08:33:30 -08:00
ibm_ocp_pci.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
immap_85xx.h [PATCH] Update email address for Kumar 2005-11-13 18:14:10 -08:00
immap_cpm2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
io.h [PATCH] ppc32 8xx: Added setbitsXX/clrbitsXX macro for read-modify-write operations 2006-01-20 16:13:29 +11:00
kgdb.h [PATCH] ppc: Fix ARCH=ppc build with xmon 2005-11-08 11:19:48 +11:00
m48t35.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
m8260_pci.h [PATCH] ppc32: Support for 82xx PQII on-chip PCI bridge 2005-05-28 16:46:15 -07:00
machdep.h [PATCH] powerpc: remove duplicate exports 2006-02-20 10:44:31 +11:00
md.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mk48t59.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu.h [PATCH] ppc32: Add support for Freescale e200 (Book-E) core 2005-06-25 16:24:26 -07:00
mmu_context.h [PATCH] powerpc: merged asm/cputable.h 2005-09-28 15:42:53 +10:00
mpc8xx.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
mpc10x.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
mpc52xx.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
mpc52xx_psc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mpc83xx.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
mpc85xx.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
mpc8260.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
mpc8260_pci9.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mv64x60.h [PATCH] missing platform_device.h includes 2005-11-01 21:50:01 -08:00
mv64x60_defs.h [PATCH] ppc32: mv64x60 updates & enhancements 2005-09-05 00:06:00 -07:00
ocp.h [PATCH] ppc32: Remove FSL OCP support 2005-06-25 16:24:27 -07:00
ocp_ids.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
open_pic.h powerpc/ppc/ppc64: Various compile fixes. 2005-10-20 21:10:09 +10:00
page.h [PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel 2005-11-11 22:25:39 +11:00
pc_serial.h [PATCH] Serial: Split 8250 port table (part 2) 2005-06-29 18:45:19 +01:00
pci-bridge.h [PATCH] powerpc: pci_address_to_pio fix 2006-01-09 15:05:56 +11:00
pci.h [PATCH] ppc: make phys_mem_access_prot() work with pfns instead of addresses 2005-10-29 14:25:49 +10:00
pgalloc.h [PATCH] powerpc: replace page_to_virt() with lowmem_page_address() for Book-E 2005-11-16 13:52:12 +11:00
pgtable.h [PATCH] powerpc: generalize PPC44x_PIN_SIZE 2006-01-20 16:13:50 +11:00
pnp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ppc4xx_dma.h [PATCH] ppc: ppc4xx_dma DMA_MODE_{READ,WRITE} fix 2005-12-16 14:43:05 -08:00
ppc4xx_pic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ppc_sys.h [PATCH] ppc32: Make platform devices being able to assign functions 2006-02-10 16:52:46 +11:00
ppcboot.h [PATCH] ppc32: cleanup AMCC PPC40x eval boards to support U-Boot 2005-11-07 07:53:26 -08:00
prep_nvram.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
prom.h [PATCH] ppc: Remove powermac support from ARCH=ppc 2006-01-15 17:30:44 +11:00
raven.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
reg_booke.h [PATCH] ppc32: Add support for Freescale e200 (Book-E) core 2005-06-25 16:24:26 -07:00
residual.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rheap.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rio.h [PATCH] RapidIO support: ppc32 2005-11-07 07:53:47 -08:00
rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial.h [PATCH] ppc32: Remove board support for MCPN765 2005-09-05 00:05:54 -07:00
smp.h powerpc: 32-bit CHRP SMP fixes 2005-10-27 22:42:04 +10:00
spinlock.h [PATCH] powerpc: Fix building of power3 config on ppc32 2005-09-25 22:38:45 +10:00
suspend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge 2006-01-12 10:21:22 -08:00
time.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
todc.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
traps.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
zorro.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00