Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksysguard / ksysguardd / Irix / LoadAvg.c
blobfa2e4a39e150e9196f85132d9afadba1534e04fe
1 /*
2 KSysGuard, the KDE System Guard
4 Copyright (c) 1999, 2000 Chris Schlaeger <cs@kde.org>
6 Irix support by Carsten Kroll <CKroll@pinnaclesys.com>
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of version 2 of the GNU General Public
10 License as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <unistd.h>
26 #include <sys/stat.h>
27 #include <sys/swap.h>
29 #include "config.h"
31 #include "ksysguardd.h"
32 #include "Command.h"
33 #include "LoadAvg.h"
35 double loadavg1 = 0.0;
36 double loadavg5 = 0.0;
37 double loadavg15 = 0.0;
39 void initLoadAvg(struct SensorModul* sm ) {
40 registerMonitor( "cpu/system/loadavg1", "float", printLoadAvg1, printLoadAvg1Info, sm );
41 registerMonitor( "cpu/system/loadavg5", "float", printLoadAvg5, printLoadAvg5Info, sm );
42 registerMonitor( "cpu/system/loadavg15", "float", printLoadAvg15, printLoadAvg15Info, sm );
44 /* Monitor names changed from kde3 => kde4. Remain compatible with legacy requests when possible. */
45 registerLegacyMonitor( "cpu/loadavg1", "float", printLoadAvg1, printLoadAvg1Info, sm );
46 registerLegacyMonitor( "cpu/loadavg5", "float", printLoadAvg5, printLoadAvg5Info, sm );
47 registerLegacyMonitor( "cpu/loadavg15", "float", printLoadAvg15, printLoadAvg15Info, sm );
50 void exitLoadAvg( void ) {
51 removeMonitor("cpu/system/loadavg1");
52 removeMonitor("cpu/system/loadavg5");
53 removeMonitor("cpu/system/loadavg15");
55 /* These were registered as legacy monitors */
56 removeMonitor("cpu/loadavg1");
57 removeMonitor("cpu/loadavg5");
58 removeMonitor("cpu/loadavg15");
61 int updateLoadAvg( void ) {
63 return( 0 );
66 void printLoadAvg1Info( const char *cmd ) {
67 fprintf(CurrentClient, "avnrun 1min\t0\t0\n" );
70 void printLoadAvg1( const char *cmd ) {
71 fprintf(CurrentClient, "%f\n", loadavg1 );
74 void printLoadAvg5Info( const char *cmd ) {
75 fprintf(CurrentClient, "avnrun 5min\t0\t0\n" );
78 void printLoadAvg5( const char *cmd ) {
79 fprintf(CurrentClient, "%f\n", loadavg5 );
82 void printLoadAvg15Info( const char *cmd ) {
83 fprintf(CurrentClient, "avnrun 15min\t0\t0\n" );
86 void printLoadAvg15( const char *cmd ) {
87 fprintf(CurrentClient, "%f\n", loadavg15 );