Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KSysGuard
Commits
552f2307
Commit
552f2307
authored
Oct 08, 2020
by
Arjen Hiemstra
Browse files
Add short names for all gpu sensors
parent
30588a3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/global/gpu/AllGpus.cpp
View file @
552f2307
...
...
@@ -14,6 +14,7 @@ AllGpus::AllGpus(SensorContainer *parent)
:
SensorObject
(
QStringLiteral
(
"all"
),
i18nc
(
"@title"
,
"All GPUs"
),
parent
)
{
m_usageSensor
=
new
AggregateSensor
(
this
,
QStringLiteral
(
"usage"
),
i18nc
(
"@title"
,
"All GPUs Usage"
));
m_usageSensor
->
setShortName
(
i18nc
(
"@title Short for 'All GPUs Usage'"
,
"Usage"
));
m_usageSensor
->
setMatchSensors
(
QRegularExpression
{
"^(?!all).*$"
},
QStringLiteral
(
"usage"
));
m_usageSensor
->
setAggregateFunction
([
this
](
const
QVariant
&
first
,
const
QVariant
&
second
)
{
auto
gpuCount
=
m_usageSensor
->
matchCount
();
...
...
@@ -22,10 +23,12 @@ AllGpus::AllGpus(SensorContainer *parent)
m_usageSensor
->
setUnit
(
KSysGuard
::
UnitPercent
);
m_totalVramSensor
=
new
AggregateSensor
(
this
,
QStringLiteral
(
"totalVram"
),
i18nc
(
"@title"
,
"All GPUs Total Memory"
));
m_totalVramSensor
->
setShortName
(
i18nc
(
"@title Short for 'All GPUs Total Memory'"
,
"Total"
));
m_totalVramSensor
->
setMatchSensors
(
QRegularExpression
{
"^(?!all).*$"
},
QStringLiteral
(
"totalVram"
));
m_totalVramSensor
->
setUnit
(
KSysGuard
::
UnitByte
);
m_usedVramSensor
=
new
AggregateSensor
(
this
,
QStringLiteral
(
"usedVram"
),
i18nc
(
"@title"
,
"All GPUs Used Memory"
));
m_usedVramSensor
->
setShortName
(
i18nc
(
"@title Short for 'All GPUs Used Memory'"
,
"Used"
));
m_usedVramSensor
->
setMatchSensors
(
QRegularExpression
{
"^(?!all).*$"
},
QStringLiteral
(
"usedVram"
));
m_usedVramSensor
->
setUnit
(
KSysGuard
::
UnitByte
);
m_usedVramSensor
->
setMax
(
m_totalVramSensor
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment