Skip to content

Commit 6176483

Browse files
committed
tools/power turbostat: Dump hypervisor name
Sometimes useful to know which hypervisor is running beneath us... Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 00b9e2a commit 6176483

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8772,6 +8772,27 @@ void probe_pstates(void)
87728772
for_all_cpus(print_epb, ODD_COUNTERS);
87738773
for_all_cpus(print_perf_limit, ODD_COUNTERS);
87748774
}
8775+
void dump_word_chars(unsigned int word)
8776+
{
8777+
int i;
8778+
8779+
for (i = 0; i < 4; ++i)
8780+
fprintf(outf, "%c", (word >> (i * 8)) & 0xFF);
8781+
}
8782+
void dump_cpuid_hypervisor(void)
8783+
{
8784+
unsigned int ebx = 0;
8785+
unsigned int ecx = 0;
8786+
unsigned int edx = 0;
8787+
8788+
__cpuid(0x40000000, max_extended_level, ebx, ecx, edx);
8789+
8790+
fprintf(outf, "Hypervisor: ");
8791+
dump_word_chars(ebx);
8792+
dump_word_chars(ecx);
8793+
dump_word_chars(edx);
8794+
fprintf(outf, "\n");
8795+
}
87758796

87768797
void process_cpuid()
87778798
{
@@ -8839,6 +8860,8 @@ void process_cpuid()
88398860
edx_flags & (1 << 5) ? "" : "No-",
88408861
edx_flags & (1 << 22) ? "" : "No-", edx_flags & (1 << 28) ? "" : "No-", edx_flags & (1 << 29) ? "" : "No-");
88418862
}
8863+
if (!quiet && cpuid_has_hv)
8864+
dump_cpuid_hypervisor();
88428865

88438866
probe_platform_features(family, model);
88448867

0 commit comments

Comments
 (0)