]> git.baikalelectronics.ru Git - kernel.git/commit
platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into...
authorHarry Pan <harry.pan@intel.com>
Wed, 19 Jun 2019 08:28:01 +0000 (16:28 +0800)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 3 Jul 2019 12:44:42 +0000 (15:44 +0300)
commit8d5219533f47952adde5f87acc40d1bba2dcfad2
tree48613d55f71fe163978a2bcf2712fdb99a9de0d5
parentcbd4e2ef8051bcb7650dcd7c85cc5db55315ba4a
platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microseconds

Refer to the Intel SDM Vol.4, the package C-state residency counters
of modern IA micro-architecture are all ticking in TSC frequency,
hence we can apply simple math to transform the ticks into microseconds.
i.e.,
residency (ms) = count / tsc_khz
residency (us) = count / tsc_khz * 1000

This also aligns to other sysfs debug entries of residency counter in
the same metric in microseconds, benefits reading and scripting.

v2: restore the accidentally deleted newline, no function change.
v3: apply kernel do_div() macro to calculate division

Signed-off-by: Harry Pan <harry.pan@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/intel_pmc_core.c