File indexing completed on 2024-05-12 17:00:15
0001 /* 0002 SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "memory.h" 0008 0009 #include "backend.h" 0010 #if defined Q_OS_LINUX 0011 #include "linuxbackend.h" 0012 #elif defined Q_OS_FREEBSD 0013 #include "freebsdbackend.h" 0014 #endif 0015 0016 #include <systemstats/SensorContainer.h> 0017 0018 #include <KLocalizedString> 0019 #include <KPluginFactory> 0020 0021 MemoryPlugin::MemoryPlugin(QObject *parent, const QVariantList &args) 0022 : SensorPlugin(parent, args) 0023 { 0024 auto container = new KSysGuard::SensorContainer(QStringLiteral("memory"), i18nc("@title", "Memory"), this); 0025 #if defined Q_OS_LINUX 0026 m_backend = std::make_unique<LinuxMemoryBackend>(container); 0027 #elif defined Q_OS_FREEBSD 0028 m_backend = std::make_unique<FreeBsdMemoryBackend>(container); 0029 #endif 0030 m_backend->initSensors(); 0031 } 0032 0033 MemoryPlugin::~MemoryPlugin() = default; 0034 0035 void MemoryPlugin::update() 0036 { 0037 m_backend->update(); 0038 } 0039 0040 K_PLUGIN_CLASS_WITH_JSON(MemoryPlugin, "metadata.json") 0041 #include "memory.moc"