Skip to content
GitLab
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
3359c6fb
Commit
3359c6fb
authored
Oct 07, 2020
by
David Redondo
🏎
Browse files
Do no work if no objects are subscribed
parent
926ec8a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
plugins/global/cpu/freebsdcpuplugin.cpp
View file @
3359c6fb
...
...
@@ -50,6 +50,10 @@ FreeBsdCpuObject::FreeBsdCpuObject(const QString &id, const QString &name, Senso
void
FreeBsdCpuObject
::
update
(
long
system
,
long
user
,
long
idle
)
{
if
(
!
isSubscribed
())
{
return
;
}
// No wait usage on FreeBSD
m_usageComputer
.
setTicks
(
system
,
user
,
0
,
idle
);
...
...
@@ -96,6 +100,10 @@ FreeBsdCpuPluginPrivate::FreeBsdCpuPluginPrivate(CpuPlugin* q)
void
FreeBsdCpuPluginPrivate
::
update
()
{
auto
isSubscribed
=
[]
(
const
SensorObject
*
o
)
{
return
o
->
isSubscribed
();};
if
(
std
::
none_of
(
m_container
->
objects
().
cbegin
(),
m_container
->
objects
().
cend
(),
isSubscribed
))
{
return
;
}
auto
updateCpu
=
[]
(
auto
*
cpu
,
long
*
cp_time
){
cpu
->
update
(
cp_time
[
CP_SYS
+
CP_INTR
],
cp_time
[
CP_USER
]
+
cp_time
[
CP_NICE
],
cp_time
[
CP_IDLE
]);
};
...
...
plugins/global/cpu/linuxcpu.cpp
View file @
3359c6fb
...
...
@@ -57,6 +57,10 @@ void LinuxCpuObject::setTemperatureSensor(const sensors_chip_name * const chipNa
void
LinuxCpuObject
::
update
(
unsigned
long
long
system
,
unsigned
long
long
user
,
unsigned
long
long
wait
,
unsigned
long
long
idle
)
{
if
(
!
isSubscribed
())
{
return
;
}
// First update usages
m_usageComputer
.
setTicks
(
system
,
user
,
wait
,
idle
);
...
...
plugins/global/cpu/linuxcpuplugin.cpp
View file @
3359c6fb
...
...
@@ -73,6 +73,11 @@ LinuxCpuPluginPrivate::LinuxCpuPluginPrivate(CpuPlugin *q)
void
LinuxCpuPluginPrivate
::
update
()
{
auto
isSubscribed
=
[]
(
const
SensorObject
*
o
)
{
return
o
->
isSubscribed
();};
if
(
std
::
none_of
(
m_container
->
objects
().
cbegin
(),
m_container
->
objects
().
cend
(),
isSubscribed
))
{
return
;
}
// Parse /proc/stat to get usage values. The format is described at
// https://www.kernel.org/doc/html/latest/filesystems/proc.html#miscellaneous-kernel-statistics-in-proc-stat
QFile
stat
(
"/proc/stat"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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