8#include "iokitprocessor.h"
9#include "iokitdevice.h"
14#include <sys/sysctl.h>
17#include "../shared/cpufeatures.h"
20extern bool q_sysctlbyname(
const char *name,
QString &result);
22using namespace Solid::Backends::IOKit;
24Processor::Processor(IOKitDevice *device)
25 : DeviceInterface(device)
30Processor::~Processor()
34int Processor::number()
const
39int Processor::maxSpeed()
const
42 size_t size =
sizeof(freq);
44 if (sysctlbyname(
"hw.cpufrequency", &freq, &size,
nullptr, 0) < 0) {
45 qWarning() <<
"sysctl error reading hw.cpufrequency:" << strerror(errno);
48 return int(freq / 1000000);
52bool Processor::canChangeFrequency()
const
54 uint64_t minFreq = 0, maxFreq = 0;
55 size_t size =
sizeof(uint64_t);
57 if (sysctlbyname(
"hw.cpufrequency_min", &minFreq, &size,
nullptr, 0) == 0
58 && sysctlbyname(
"hw.cpufrequency_max", &maxFreq, &size,
nullptr, 0) == 0) {
59 return maxFreq > minFreq;
75 q_sysctlbyname(
"machdep.cpu.vendor", qVendor);
82 q_sysctlbyname(
"machdep.cpu.brand_string", product);
86#include "moc_iokitprocessor.cpp"
int toInt(bool *ok) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:22 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.