From e4a6d299a978dc829b58f1adc4b97376b815cc79 Mon Sep 17 00:00:00 2001 From: srstack Date: Fri, 10 Dec 2021 15:54:31 +0800 Subject: [PATCH 1/2] add CPU frequency check output --- pkg/cluster/operation/check.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/pkg/cluster/operation/check.go b/pkg/cluster/operation/check.go index 032f5b20e4..8dda4e19ec 100644 --- a/pkg/cluster/operation/check.go +++ b/pkg/cluster/operation/check.go @@ -224,11 +224,26 @@ func checkCPU(opt *CheckOptions, cpuInfo *sysinfo.CPU) []*CheckResult { } // check for CPU frequency governor - if cpuInfo.Governor != "" && cpuInfo.Governor != "performance" { - results = append(results, &CheckResult{ - Name: CheckNameCPUGovernor, - Err: fmt.Errorf("CPU frequency governor is %s, should use performance", cpuInfo.Governor), - }) + if cpuInfo.Governor != "" { + if cpuInfo.Governor != "performance" { + results = append(results, &CheckResult{ + Name: CheckNameCPUGovernor, + Err: fmt.Errorf("CPU frequency governor is %s, should use performance", cpuInfo.Governor), + }) + } else { + results = append(results, &CheckResult{ + Name: CheckNameCPUGovernor, + Msg: fmt.Sprintf("CPU frequency governor is %s", cpuInfo.Governor), + }) + } + } else { + if cpuInfo.Governor == "" { + results = append(results, &CheckResult{ + Name: CheckNameCPUGovernor, + Err: fmt.Errorf("Unable to determine current CPU frequency governor policy"), + Warn: true, + }) + } } return results From a17e3451fc8402a111aef1bca1ee3dfd21bb32aa Mon Sep 17 00:00:00 2001 From: srstack Date: Fri, 10 Dec 2021 16:57:17 +0800 Subject: [PATCH 2/2] add CPU frequency check output --- pkg/cluster/operation/check.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/cluster/operation/check.go b/pkg/cluster/operation/check.go index 8dda4e19ec..903c540563 100644 --- a/pkg/cluster/operation/check.go +++ b/pkg/cluster/operation/check.go @@ -237,13 +237,11 @@ func checkCPU(opt *CheckOptions, cpuInfo *sysinfo.CPU) []*CheckResult { }) } } else { - if cpuInfo.Governor == "" { - results = append(results, &CheckResult{ - Name: CheckNameCPUGovernor, - Err: fmt.Errorf("Unable to determine current CPU frequency governor policy"), - Warn: true, - }) - } + results = append(results, &CheckResult{ + Name: CheckNameCPUGovernor, + Err: fmt.Errorf("Unable to determine current CPU frequency governor policy"), + Warn: true, + }) } return results