* Removed unused code
* Use cclog for logging
* Wrap errors so that they can be unwrapped
* Revert wrong use of slices.Delete()
* Fix derivative values should be float
* Suggestions from the gocritic linter
* Fixed: interface method AddChannel must have all named params (inamedparam)
* Enable linter: errorlint
* Replace fmt.Sprintf("%d", i)) by strconv.Itoa(i) for improved performance
* Correct misspelled words
* Break up very long lines into multiple lines
* lp.NewMessage -> lp.NewMetric
* Preallocate slices of known length
This commit is contained in:
Holger Obermaier
2026-02-13 09:36:14 +01:00
committed by GitHub
parent b69281dae6
commit 9908d76aac
29 changed files with 311 additions and 395 deletions

View File

@@ -51,14 +51,13 @@ var cache struct {
func fileToInt(path string) int {
buffer, err := os.ReadFile(path)
if err != nil {
log.Print(err)
cclogger.ComponentError("ccTopology", "fileToInt", "Reading", path, ":", err.Error())
cclogger.ComponentError("ccTopology", fmt.Sprintf("fileToInt(): Reading \"%s\": %v", path, err))
return -1
}
stringBuffer := strings.TrimSpace(string(buffer))
id, err := strconv.Atoi(stringBuffer)
if err != nil {
cclogger.ComponentError("ccTopology", "fileToInt", "Parsing", path, ":", stringBuffer, err.Error())
cclogger.ComponentError("ccTopology", fmt.Sprintf("fileToInt(): Parsing \"%s\": %v", stringBuffer, err))
return -1
}
return id
@@ -304,20 +303,19 @@ func GetTypeList(topology_type string) []int {
}
func GetTypeId(hwt HwthreadEntry, topology_type string) (int, error) {
var err error = nil
switch topology_type {
case "node":
return 0, err
return 0, nil
case "socket":
return hwt.Socket, err
return hwt.Socket, nil
case "die":
return hwt.Die, err
return hwt.Die, nil
case "memoryDomain":
return hwt.NumaDomain, err
return hwt.NumaDomain, nil
case "core":
return hwt.Core, err
return hwt.Core, nil
case "hwthread":
return hwt.CpuID, err
return hwt.CpuID, nil
}
return -1, fmt.Errorf("unknown topology type '%s'", topology_type)
}

View File

@@ -21,7 +21,7 @@ type multiChanTicker struct {
type MultiChanTicker interface {
Init(duration time.Duration)
AddChannel(chan time.Time)
AddChannel(channel chan time.Time)
Close()
}