Skip to content

Revert "remove turbo enable/disable from report due to inaccuracy" #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/report/table_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ func cpuTableValues(outputs map[string]script.ScriptOutput) []Field {
{Name: "L3 Cache", Values: []string{l3FromOutput(outputs)}},
{Name: "L3 per Core", Values: []string{l3PerCoreFromOutput(outputs)}},
{Name: "Memory Channels", Values: []string{channelsFromOutput(outputs)}},
{Name: "Intel Turbo Boost", Values: []string{turboEnabledFromOutput(outputs)}},
{Name: "Virtualization", Values: []string{valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^Virtualization:\s*(.+)$`)}},
{Name: "PPINs", Values: []string{ppinsFromOutput(outputs)}},
}
Expand Down Expand Up @@ -1883,6 +1884,7 @@ func systemSummaryTableValues(outputs map[string]script.ScriptOutput) []Field {
{Name: "Sockets", Values: []string{valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^Socket\(s\):\s*(.+)$`)}},
{Name: "Hyperthreading", Values: []string{hyperthreadingFromOutput(outputs)}},
{Name: "CPUs", Values: []string{valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^CPU\(s\):\s*(.+)$`)}},
{Name: "Intel Turbo Boost", Values: []string{turboEnabledFromOutput(outputs)}},
{Name: "Base Frequency", Values: []string{baseFrequencyFromOutput(outputs)}},
{Name: "All-core Maximum Frequency", Values: []string{allCoreMaxFrequencyFromOutput(outputs)}},
{Name: "Maximum Frequency", Values: []string{maxFrequencyFromOutput(outputs)}},
Expand Down
38 changes: 34 additions & 4 deletions internal/report/table_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,27 @@ func channelsFromOutput(outputs map[string]script.ScriptOutput) string {
return fmt.Sprintf("%d", cpu.MemoryChannelCount)
}

func turboEnabledFromOutput(outputs map[string]script.ScriptOutput) string {
vendor := valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^Vendor ID:\s*(.+)$`)
switch vendor {
case "GenuineIntel":
val := valFromRegexSubmatch(outputs[script.CpuidScriptName].Stdout, `^Intel Turbo Boost Technology\s*= (.+?)$`)
if val == "true" {
return "Enabled"
}
if val == "false" {
return "Disabled"
}
return "" // unknown value
case "AuthenticAMD":
val := valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^Frequency boost.*:\s*(.+?)$`)
if val != "" {
return val + " (AMD Frequency Boost)"
}
}
return ""
}

func isPrefetcherEnabled(msrValue string, bit int) (bool, error) {
if msrValue == "" {
return false, fmt.Errorf("msrValue is empty")
Expand Down Expand Up @@ -1813,9 +1834,9 @@ func cveSummaryFromOutput(outputs map[string]script.ScriptOutput) string {
}

func systemSummaryFromOutput(outputs map[string]script.ScriptOutput) string {
// BASELINE: 1-node, 2x Intel® Xeon® <SKU, processor>, xx cores, 100W TDP, HT On/Off?, Total Memory xxx GB (xx slots/ xx GB/ xxxx MHz [run @ xxxx MHz] ), <BIOS version>, <ucode version>, <OS Version>, <kernel version>. Test by Intel as of <mm/dd/yy>.
template := "1-node, %sx %s, %s cores, %s TDP, HT %s, Total Memory %s, BIOS %s, microcode %s, %s, %s, %s, %s. Test by Intel as of %s."
var socketCount, cpuModel, coreCount, tdp, htOnOff, installedMem, biosVersion, uCodeVersion, nics, disks, operatingSystem, kernelVersion, date string
// BASELINE: 1-node, 2x Intel® Xeon® <SKU, processor>, xx cores, 100W TDP, HT On/Off?, Turbo On/Off?, Total Memory xxx GB (xx slots/ xx GB/ xxxx MHz [run @ xxxx MHz] ), <BIOS version>, <ucode version>, <OS Version>, <kernel version>. Test by Intel as of <mm/dd/yy>.
template := "1-node, %sx %s, %s cores, %s TDP, HT %s, Turbo %s, Total Memory %s, BIOS %s, microcode %s, %s, %s, %s, %s. Test by Intel as of %s."
var socketCount, cpuModel, coreCount, tdp, htOnOff, turboOnOff, installedMem, biosVersion, uCodeVersion, nics, disks, operatingSystem, kernelVersion, date string

// socket count
socketCount = valFromRegexSubmatch(outputs[script.LscpuScriptName].Stdout, `^Socket\(s\):\s*(\d+)$`)
Expand All @@ -1840,6 +1861,15 @@ func systemSummaryFromOutput(outputs map[string]script.ScriptOutput) string {
default:
htOnOff = "?"
}
// turbo
turboOnOff = turboEnabledFromOutput(outputs)
if strings.Contains(strings.ToLower(turboOnOff), "enabled") {
turboOnOff = "On"
} else if strings.Contains(strings.ToLower(turboOnOff), "disabled") {
turboOnOff = "Off"
} else {
turboOnOff = "?"
}
// memory
installedMem = installedMemoryFromOutput(outputs)
// BIOS
Expand All @@ -1857,7 +1887,7 @@ func systemSummaryFromOutput(outputs map[string]script.ScriptOutput) string {
// date
date = strings.TrimSpace(outputs[script.DateScriptName].Stdout)
// put it all together
return fmt.Sprintf(template, socketCount, cpuModel, coreCount, tdp, htOnOff, installedMem, biosVersion, uCodeVersion, nics, disks, operatingSystem, kernelVersion, date)
return fmt.Sprintf(template, socketCount, cpuModel, coreCount, tdp, htOnOff, turboOnOff, installedMem, biosVersion, uCodeVersion, nics, disks, operatingSystem, kernelVersion, date)
}

// getSectionsFromOutput parses output into sections, where the section name
Expand Down