Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
SystemStatsReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3#pragma once
4
5#include <PhosphorShell/phosphorshell_export.h>
6#include <QByteArray>
7#include <QVariantMap>
8#include <memory>
9
10namespace PhosphorShell {
11// A synchronous Linux collector. Run on a worker thread; paths may point to a
12// proc/sys snapshot. Unavailable numeric fields use -1, never a fabricated zero.
13class PHOSPHORSHELL_EXPORT SystemStatsReader
14{
15public:
16 explicit SystemStatsReader(const QString& procRoot = QStringLiteral("/proc"),
17 const QString& sysRoot = QStringLiteral("/sys"));
19 QVariantMap sample();
20 void resetRates();
21 static QVariantMap memoryFrom(const QByteArray& content);
22 static double counterRate(quint64 previous, quint64 current, double seconds);
23
24private:
25 struct Private;
26 std::unique_ptr<Private> d;
27};
28}
static QVariantMap memoryFrom(const QByteArray &content)
SystemStatsReader(const QString &procRoot=QStringLiteral("/proc"), const QString &sysRoot=QStringLiteral("/sys"))
static double counterRate(quint64 previous, quint64 current, double seconds)
Definition Environment.h:11