mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2026-02-03 14:59:47 +00:00
gpu memory demo
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awpluginmatchergpumemorytotal.h"
|
||||
|
||||
#include "formatters/formatters.h"
|
||||
|
||||
|
||||
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherGPUMemoryTotal::keys(const QString &, const KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &) const
|
||||
{
|
||||
return {
|
||||
{"gputotmb", AWPluginFormatterMemoryMB::instance()},
|
||||
{"gputotgb", AWPluginFormatterMemoryGB::instance()},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool AWPluginMatcherGPUMemoryTotal::matches(const QString &_source) const
|
||||
{
|
||||
return _source == "gpu/all/totalVram";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "awpluginmatcher.h"
|
||||
|
||||
|
||||
class AWPluginMatcherGPUMemoryTotal : public AWPluginMatcher<AWPluginMatcherGPUMemoryTotal>
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &) const override;
|
||||
[[nodiscard]] bool matches(const QString &_source) const override;
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awpluginmatchergpumemorytotalcore.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "formatters/formatters.h"
|
||||
|
||||
|
||||
QHash<QString, AWPluginFormaterInterface *>
|
||||
AWPluginMatcherGPUMemoryTotalCore::keys(const QString &_source, const KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &_settings) const
|
||||
{
|
||||
auto index = AWPluginMatcher::index(_source, _settings.gpu);
|
||||
if (index == -1)
|
||||
return {};
|
||||
|
||||
return {
|
||||
{QString("gputotmb%1").arg(index), AWPluginFormatterMemoryMB::instance()},
|
||||
{QString("gputotgb%1").arg(index), AWPluginFormatterMemoryGB::instance()},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool AWPluginMatcherGPUMemoryTotalCore::matches(const QString &_source) const
|
||||
{
|
||||
static auto regexp = QRegularExpression("^gpu/gpu.*/totalVram$");
|
||||
return _source.contains(regexp);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "awpluginmatcher.h"
|
||||
|
||||
|
||||
class AWPluginMatcherGPUMemoryTotalCore : public AWPluginMatcher<AWPluginMatcherGPUMemoryTotalCore>
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
|
||||
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
|
||||
[[nodiscard]] bool matches(const QString &_source) const override;
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awpluginmatchergpumemoryused.h"
|
||||
|
||||
#include "formatters/formatters.h"
|
||||
|
||||
|
||||
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherGPUMemoryUsed::keys(const QString &, const KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &) const
|
||||
{
|
||||
return {
|
||||
{"gpuusedmb", AWPluginFormatterMemoryMB::instance()},
|
||||
{"gpuusedgb", AWPluginFormatterMemoryGB::instance()},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool AWPluginMatcherGPUMemoryUsed::matches(const QString &_source) const
|
||||
{
|
||||
return _source == "gpu/all/usedVram";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "awpluginmatcher.h"
|
||||
|
||||
|
||||
class AWPluginMatcherGPUMemoryUsed : public AWPluginMatcher<AWPluginMatcherGPUMemoryUsed>
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &) const override;
|
||||
[[nodiscard]] bool matches(const QString &_source) const override;
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awpluginmatchergpumemoryusedcore.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "formatters/formatters.h"
|
||||
|
||||
|
||||
QHash<QString, AWPluginFormaterInterface *>
|
||||
AWPluginMatcherGPUMemoryUsedCore::keys(const QString &_source, const KSysGuard::Unit,
|
||||
const AWPluginMatcherSettings &_settings) const
|
||||
{
|
||||
auto index = AWPluginMatcher::index(_source, _settings.gpu);
|
||||
if (index == -1)
|
||||
return {};
|
||||
|
||||
return {
|
||||
{QString("gpuusedmb%1").arg(index), AWPluginFormatterMemoryMB::instance()},
|
||||
{QString("gpuusedgb%1").arg(index), AWPluginFormatterMemoryGB::instance()},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool AWPluginMatcherGPUMemoryUsedCore::matches(const QString &_source) const
|
||||
{
|
||||
static auto regexp = QRegularExpression("^gpu/gpu.*/usedVram$");
|
||||
return _source.contains(regexp);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "awpluginmatcher.h"
|
||||
|
||||
|
||||
class AWPluginMatcherGPUMemoryUsedCore : public AWPluginMatcher<AWPluginMatcherGPUMemoryUsedCore>
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
|
||||
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
|
||||
[[nodiscard]] bool matches(const QString &_source) const override;
|
||||
};
|
||||
@@ -15,6 +15,8 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "awpluginmatcherac.h"
|
||||
#include "awpluginmatcherbattery.h"
|
||||
#include "awpluginmatcherbrightness.h"
|
||||
@@ -28,6 +30,10 @@
|
||||
#include "awpluginmatcherdesktopnumber.h"
|
||||
#include "awpluginmatchergpu.h"
|
||||
#include "awpluginmatchergpucore.h"
|
||||
#include "awpluginmatchergpumemorytotal.h"
|
||||
#include "awpluginmatchergpumemorytotalcore.h"
|
||||
#include "awpluginmatchergpumemoryused.h"
|
||||
#include "awpluginmatchergpumemoryusedcore.h"
|
||||
#include "awpluginmatchergputemperature.h"
|
||||
#include "awpluginmatcherhdd.h"
|
||||
#include "awpluginmatcherhddfree.h"
|
||||
@@ -80,6 +86,10 @@ static QList<AWPluginMatcherInterface *> matchers = {
|
||||
AWPluginMatcherDesktopNumber::instance(),
|
||||
AWPluginMatcherGPU::instance(),
|
||||
AWPluginMatcherGPUCore::instance(),
|
||||
AWPluginMatcherGPUMemoryTotal::instance(),
|
||||
AWPluginMatcherGPUMemoryTotalCore::instance(),
|
||||
AWPluginMatcherGPUMemoryUsed::instance(),
|
||||
AWPluginMatcherGPUMemoryUsedCore::instance(),
|
||||
AWPluginMatcherGPUTemperature::instance(),
|
||||
AWPluginMatcherHDD::instance(),
|
||||
AWPluginMatcherHDDFree::instance(),
|
||||
|
||||
Reference in New Issue
Block a user