system_stats.h
What machine this is.
#include <sonore/system_stats.h>- 1type
- 8other declarations
- Guides: Platforms and formats
On this page
Design notes
Why a plugin wants it
logger.h gives a user something to send you. This is the first line of it. "It crashes on my machine" and "it crashes on Windows 11 24H2, Ryzen 7, 32 GB, no AVX-512" are different bug reports, and only one of them can be acted on without a conversation.
It is also the honest answer to "why is this slow on my laptop": core count and CPU model explain most of it, and neither is something a user can be asked to look up.
Runtime, not compile time
simd.h decides at COMPILE time which instruction set to use, which is right for it -- a plugin ships one binary and its DSP is whatever it was built with. This asks the CPU what it actually IS, which is a different question: a binary built for SSE2 running on a machine with AVX2 is a fact worth knowing when somebody reports the CPU meter reading twice what it should.
Nothing is guessed
Anything a platform will not say comes back empty or zero. A fabricated OS version in a bug report is worse than a blank one: it sends whoever reads it looking for a bug on a system nobody was using.
Types 1
What the CPU can do, as it is RIGHT NOW rather than as the binary was built. See the header for why the two are different questions.
Functions 8
- fn
inline CpuFeatures cpuFeatures()Asks the CPU at run time, with cpuid on x86. Where this build cannot ask, everything but neon is false.system_stats.h:100 - fn
inline std::string cpuVendor()"GenuineIntel", "AuthenticAMD", or empty where the question does not apply.system_stats.h:147 - fn
inline std::string cpuModel()The processor's own name string, or empty.system_stats.h:162 - fn
inline int numLogicalCpus()Logical processors -- what a thread pool would divide by. Zero where the platform will not say.system_stats.h:185 - fn
inline int memorySizeMb()Physical memory in megabytes, or 0.system_stats.h:197 - fn
inline std::string osName()"Windows", "macOS", "Linux" or "Unknown": the platform this was built for. osVersion() has the version.system_stats.h:218 - fn
inline std::string osVersion()The OS version, as a string, or empty.system_stats.h:239More
On Windows through RtlGetVersion rather than GetVersionEx. That one LIES by design: since Windows 8.1 it reports 6.2 to any process without a matching compatibility manifest, and a plugin is loaded into a host whose manifest is not ours to control. So a plugin using it reports "Windows 8" on every machine, forever, and the bug report is worthless.
- fn
inline std::string machineDescription()One line for a bug report or the top of a log.system_stats.h:270More
Everything that fits on a line and nothing that does not. A user pasting this into an email is the entire point, so it has to survive being pasted into an email.