2
KSysGuard, the KDE System Guard
4
Copyright (c) 2001 Tobias Koenig <tokoe@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of version 2 of the GNU General Public
8
License as published by the Free Software Foundation.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#include "ksysguardd.h"
28
static double LoadAvg[3];
31
================================ public part =================================
35
initLoadAvg(struct SensorModul* sm)
37
if (updateLoadAvg() < 0)
40
registerMonitor("cpu/loadavg1", "float", printLoadAvg1,
41
printLoadAvg1Info, sm);
42
registerMonitor("cpu/loadavg5", "float", printLoadAvg5,
43
printLoadAvg5Info, sm);
44
registerMonitor("cpu/loadavg15", "float", printLoadAvg15,
45
printLoadAvg15Info, sm);
51
removeMonitor("cpu/loadavg1");
52
removeMonitor("cpu/loadavg5");
53
removeMonitor("cpu/loadavg15");
59
return getloadavg(LoadAvg, 3);
63
printLoadAvg1(const char* c)
65
fprintf(CurrentClient, "%f\n", LoadAvg[0]);
69
printLoadAvg1Info(const char* c)
71
fprintf(CurrentClient, "Load average 1 min\t0\t0\t\n");
75
printLoadAvg5(const char* c)
77
fprintf(CurrentClient, "%f\n", LoadAvg[1]);
81
printLoadAvg5Info(const char* c)
83
fprintf(CurrentClient, "Load average 5 min\t0\t0\t\n");
87
printLoadAvg15(const char* c)
89
fprintf(CurrentClient, "%f\n", LoadAvg[2]);
93
printLoadAvg15Info(const char* c)
95
fprintf(CurrentClient, "Load average 15 min\t0\t0\t\n");