2024-01-29 10:00:51 +00:00
|
|
|
// Copyright (C) 2024 The Qt Company Ltd.
|
2024-03-15 10:30:53 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
2024-01-29 10:00:51 +00:00
|
|
|
|
|
|
|
|
#include "cpuusageupdater.h"
|
|
|
|
|
|
|
|
|
|
CpuUsageUpdater::CpuUsageUpdater(QObject *parent) {}
|
|
|
|
|
|
|
|
|
|
double CpuUsageUpdater::update()
|
|
|
|
|
{
|
|
|
|
|
return m_processorInfo.updateTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal CpuUsageUpdater::usage() const
|
|
|
|
|
{
|
|
|
|
|
return m_usage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CpuUsageUpdater::setUsage(qreal newUsage)
|
|
|
|
|
{
|
|
|
|
|
if (m_usage == newUsage)
|
|
|
|
|
return;
|
|
|
|
|
m_usage = newUsage;
|
|
|
|
|
emit usageChanged();
|
|
|
|
|
}
|