Loading Documentation/cpu-freq/cpufreq-stats.txt 0 → 100644 +128 −0 Original line number Original line Diff line number Diff line CPU frequency and voltage scaling statictics in the Linux(TM) kernel L i n u x c p u f r e q - s t a t s d r i v e r - information for users - Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Contents 1. Introduction 2. Statistics Provided (with example) 3. Configuring cpufreq-stats 1. Introduction cpufreq-stats is a driver that provices CPU frequency statistics for each CPU. This statistics is provided in /sysfs as a bunch of read_only interfaces. This interface (when configured) will appear in a seperate directory under cpufreq in /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU. Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver. 2. Statistics Provided (with example) cpufreq stats provides following statistics (explained in detail below). - time_in_state - total_trans - trans_table All the statistics will be from the time the stats driver has been inserted to the time when a read of a particular statistic is done. Obviously, stats driver will not have any information about the the frequcny transitions before the stats driver insertion. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l total 0 drwxr-xr-x 2 root root 0 May 14 16:06 . drwxr-xr-x 3 root root 0 May 14 15:58 .. -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state -r--r--r-- 1 root root 4096 May 14 16:06 total_trans -r--r--r-- 1 root root 4096 May 14 16:06 trans_table -------------------------------------------------------------------------------- - time_in_state This gives the amount of time spent in each of the frequencies supported by this CPU. The cat output will have "<frequency> <time>" pair in each line, which will mean this CPU spent <time> usertime units of time at <frequency>. Output will have one line for each of the supported freuencies. usertime units here is 10mS (similar to other time exported in /proc). -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state 3600000 2089 3400000 136 3200000 34 3000000 67 2800000 172488 -------------------------------------------------------------------------------- - total_trans This gives the total number of frequency transitions on this CPU. The cat output will have a single count which is the total number of frequency transitions. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans 20 -------------------------------------------------------------------------------- - trans_table This will give a fine grained information about all the CPU frequency transitions. The cat output here is a two dimensional matrix, where an entry <i,j> (row i, column j) represents the count of number of transitions from Freq_i to Freq_j. Freq_i is in descending order with increasing rows and Freq_j is in descending order with increasing columns. The output here also contains the actual freq values for each row and column for better readability. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table From : To : 3600000 3400000 3200000 3000000 2800000 3600000: 0 5 0 0 0 3400000: 4 0 2 0 0 3200000: 0 1 0 2 0 3000000: 0 0 1 0 3 2800000: 0 0 0 2 0 -------------------------------------------------------------------------------- 3. Configuring cpufreq-stats To configure cpufreq-stats in your kernel Config Main Menu Power management options (ACPI, APM) ---> CPU Frequency scaling ---> [*] CPU Frequency scaling <*> CPU frequency translation statistics [*] CPU frequency translation statistics details "CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure cpufreq-stats. "CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides the basic statistics which includes time_in_state and total_trans. "CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS) provides fine grained cpufreq stats by trans_table. The reason for having a seperate config option for trans_table is: - trans_table goes against the traditional /sysfs rule of one value per interface. It provides a whole bunch of value in a 2 dimensional matrix form. Once these two options are enabled and your CPU supports cpufrequency, you will be able to see the CPU frequency statistics in /sysfs. MAINTAINERS +8 −2 Original line number Original line Diff line number Diff line Loading @@ -239,6 +239,12 @@ L: linux-usb-devel@lists.sourceforge.net W: http://www.linux-usb.org/SpeedTouch/ W: http://www.linux-usb.org/SpeedTouch/ S: Maintained S: Maintained ALI1563 I2C DRIVER P: Rudolf Marek M: r.marek@sh.cvut.cz L: sensors@stimpy.netroedge.com S: Maintained ALPHA PORT ALPHA PORT P: Richard Henderson P: Richard Henderson M: rth@twiddle.net M: rth@twiddle.net Loading Loading @@ -1023,8 +1029,8 @@ W: http://www.ia64-linux.org/ S: Maintained S: Maintained SN-IA64 (Itanium) SUB-PLATFORM SN-IA64 (Itanium) SUB-PLATFORM P: Jesse Barnes P: Greg Edwards M: jbarnes@sgi.com M: edwardsg@sgi.com L: linux-altix@sgi.com L: linux-altix@sgi.com L: linux-ia64@vger.kernel.org L: linux-ia64@vger.kernel.org W: http://www.sgi.com/altix W: http://www.sgi.com/altix Loading arch/h8300/kernel/process.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ asmlinkage void ret_from_fork(void); void default_idle(void) void default_idle(void) { { while(1) { while(1) { if (need_resched()) { if (!need_resched()) { local_irq_enable(); local_irq_enable(); __asm__("sleep"); __asm__("sleep"); local_irq_disable(); local_irq_disable(); Loading arch/i386/kernel/cpu/cpufreq/Kconfig +13 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ config X86_ACPI_CPUFREQ If in doubt, say N. If in doubt, say N. config ELAN_CPUFREQ config ELAN_CPUFREQ tristate "AMD Elan" tristate "AMD Elan SC400 and SC410" select CPU_FREQ_TABLE select CPU_FREQ_TABLE depends on X86_ELAN depends on X86_ELAN ---help--- ---help--- Loading @@ -38,6 +38,18 @@ config ELAN_CPUFREQ If in doubt, say N. If in doubt, say N. config SC520_CPUFREQ tristate "AMD Elan SC520" select CPU_FREQ_TABLE depends on X86_ELAN ---help--- This adds the CPUFreq driver for AMD Elan SC520 processor. For details, take a look at <file:Documentation/cpu-freq/>. If in doubt, say N. config X86_POWERNOW_K6 config X86_POWERNOW_K6 tristate "AMD Mobile K6-2/K6-3 PowerNow!" tristate "AMD Mobile K6-2/K6-3 PowerNow!" select CPU_FREQ_TABLE select CPU_FREQ_TABLE Loading arch/i386/kernel/cpu/cpufreq/Makefile +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,7 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o obj-$(CONFIG_X86_LONGHAUL) += longhaul.o obj-$(CONFIG_X86_LONGHAUL) += longhaul.o obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o obj-$(CONFIG_X86_LONGRUN) += longrun.o obj-$(CONFIG_X86_LONGRUN) += longrun.o obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o Loading Loading
Documentation/cpu-freq/cpufreq-stats.txt 0 → 100644 +128 −0 Original line number Original line Diff line number Diff line CPU frequency and voltage scaling statictics in the Linux(TM) kernel L i n u x c p u f r e q - s t a t s d r i v e r - information for users - Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Contents 1. Introduction 2. Statistics Provided (with example) 3. Configuring cpufreq-stats 1. Introduction cpufreq-stats is a driver that provices CPU frequency statistics for each CPU. This statistics is provided in /sysfs as a bunch of read_only interfaces. This interface (when configured) will appear in a seperate directory under cpufreq in /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU. Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver. 2. Statistics Provided (with example) cpufreq stats provides following statistics (explained in detail below). - time_in_state - total_trans - trans_table All the statistics will be from the time the stats driver has been inserted to the time when a read of a particular statistic is done. Obviously, stats driver will not have any information about the the frequcny transitions before the stats driver insertion. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l total 0 drwxr-xr-x 2 root root 0 May 14 16:06 . drwxr-xr-x 3 root root 0 May 14 15:58 .. -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state -r--r--r-- 1 root root 4096 May 14 16:06 total_trans -r--r--r-- 1 root root 4096 May 14 16:06 trans_table -------------------------------------------------------------------------------- - time_in_state This gives the amount of time spent in each of the frequencies supported by this CPU. The cat output will have "<frequency> <time>" pair in each line, which will mean this CPU spent <time> usertime units of time at <frequency>. Output will have one line for each of the supported freuencies. usertime units here is 10mS (similar to other time exported in /proc). -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state 3600000 2089 3400000 136 3200000 34 3000000 67 2800000 172488 -------------------------------------------------------------------------------- - total_trans This gives the total number of frequency transitions on this CPU. The cat output will have a single count which is the total number of frequency transitions. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans 20 -------------------------------------------------------------------------------- - trans_table This will give a fine grained information about all the CPU frequency transitions. The cat output here is a two dimensional matrix, where an entry <i,j> (row i, column j) represents the count of number of transitions from Freq_i to Freq_j. Freq_i is in descending order with increasing rows and Freq_j is in descending order with increasing columns. The output here also contains the actual freq values for each row and column for better readability. -------------------------------------------------------------------------------- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table From : To : 3600000 3400000 3200000 3000000 2800000 3600000: 0 5 0 0 0 3400000: 4 0 2 0 0 3200000: 0 1 0 2 0 3000000: 0 0 1 0 3 2800000: 0 0 0 2 0 -------------------------------------------------------------------------------- 3. Configuring cpufreq-stats To configure cpufreq-stats in your kernel Config Main Menu Power management options (ACPI, APM) ---> CPU Frequency scaling ---> [*] CPU Frequency scaling <*> CPU frequency translation statistics [*] CPU frequency translation statistics details "CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure cpufreq-stats. "CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides the basic statistics which includes time_in_state and total_trans. "CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS) provides fine grained cpufreq stats by trans_table. The reason for having a seperate config option for trans_table is: - trans_table goes against the traditional /sysfs rule of one value per interface. It provides a whole bunch of value in a 2 dimensional matrix form. Once these two options are enabled and your CPU supports cpufrequency, you will be able to see the CPU frequency statistics in /sysfs.
MAINTAINERS +8 −2 Original line number Original line Diff line number Diff line Loading @@ -239,6 +239,12 @@ L: linux-usb-devel@lists.sourceforge.net W: http://www.linux-usb.org/SpeedTouch/ W: http://www.linux-usb.org/SpeedTouch/ S: Maintained S: Maintained ALI1563 I2C DRIVER P: Rudolf Marek M: r.marek@sh.cvut.cz L: sensors@stimpy.netroedge.com S: Maintained ALPHA PORT ALPHA PORT P: Richard Henderson P: Richard Henderson M: rth@twiddle.net M: rth@twiddle.net Loading Loading @@ -1023,8 +1029,8 @@ W: http://www.ia64-linux.org/ S: Maintained S: Maintained SN-IA64 (Itanium) SUB-PLATFORM SN-IA64 (Itanium) SUB-PLATFORM P: Jesse Barnes P: Greg Edwards M: jbarnes@sgi.com M: edwardsg@sgi.com L: linux-altix@sgi.com L: linux-altix@sgi.com L: linux-ia64@vger.kernel.org L: linux-ia64@vger.kernel.org W: http://www.sgi.com/altix W: http://www.sgi.com/altix Loading
arch/h8300/kernel/process.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ asmlinkage void ret_from_fork(void); void default_idle(void) void default_idle(void) { { while(1) { while(1) { if (need_resched()) { if (!need_resched()) { local_irq_enable(); local_irq_enable(); __asm__("sleep"); __asm__("sleep"); local_irq_disable(); local_irq_disable(); Loading
arch/i386/kernel/cpu/cpufreq/Kconfig +13 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ config X86_ACPI_CPUFREQ If in doubt, say N. If in doubt, say N. config ELAN_CPUFREQ config ELAN_CPUFREQ tristate "AMD Elan" tristate "AMD Elan SC400 and SC410" select CPU_FREQ_TABLE select CPU_FREQ_TABLE depends on X86_ELAN depends on X86_ELAN ---help--- ---help--- Loading @@ -38,6 +38,18 @@ config ELAN_CPUFREQ If in doubt, say N. If in doubt, say N. config SC520_CPUFREQ tristate "AMD Elan SC520" select CPU_FREQ_TABLE depends on X86_ELAN ---help--- This adds the CPUFreq driver for AMD Elan SC520 processor. For details, take a look at <file:Documentation/cpu-freq/>. If in doubt, say N. config X86_POWERNOW_K6 config X86_POWERNOW_K6 tristate "AMD Mobile K6-2/K6-3 PowerNow!" tristate "AMD Mobile K6-2/K6-3 PowerNow!" select CPU_FREQ_TABLE select CPU_FREQ_TABLE Loading
arch/i386/kernel/cpu/cpufreq/Makefile +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,7 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o obj-$(CONFIG_X86_LONGHAUL) += longhaul.o obj-$(CONFIG_X86_LONGHAUL) += longhaul.o obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o obj-$(CONFIG_X86_LONGRUN) += longrun.o obj-$(CONFIG_X86_LONGRUN) += longrun.o obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o Loading