Skip to content
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

Features:
* Added CPU name and frequency detection support on SPARC. (CPU, Linux)

# 2.68.1

Changes:
Expand Down
7 changes: 7 additions & 0 deletions src/detection/cpu/cpu_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ static const char* parseCpuInfo(
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
#elif __sh__
(cpu->name.length == 0 && ffParsePropLine(line, "cpu type :", &cpu->name)) ||
#elif __sparc__ || __sparc
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
(cpuMHz->length == 0 && ffParsePropLine(line, "Cpu0ClkTck :", cpuMHz)) ||
#else
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
(cpu->name.length == 0 && ffParsePropLine(line, "model :", &cpu->name)) ||
Expand Down Expand Up @@ -1101,6 +1104,10 @@ static const char* detectPhysicalCores(FFCPUResult* cpu) {
if (cpu->name.length) {
ffStrbufPrependS(&cpu->name, "Machine ");
}
#elif __sparc__ || __sparc
// Cpu0ClkTck is in Hz, printed as "%016lx" by sparc64 and "%ld" by sparc32. A 32-bit userland can run
// on a 64-bit kernel, so take the base from the width of the value rather than from our own bitness.
cpu->frequencyBase = (uint32_t) (strtoull(cpuMHz.chars, nullptr, cpuMHz.length == 16 ? 16 : 10) / 1000000);
#endif
}

Expand Down
Loading