1 /*
2  Uptime Client v5.0 beta
3 
4  $Id: stats.h,v 1.24 2002/12/18 00:01:19 carstenklapp Exp $
5 
6  Logs system uptime and statistics with Uptimes Project servers
7 
8  Copyright (C) 1999-2002 Martijn Broenland, Alex C. de Haas, Carsten Klapp
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 
24  Carsten Klapp <carstenklapp@users.sourceforge.net>
25  Alex C. de Haas <alex@uptimes.net>
26  Martijn Broenland <tgm@uptimes.net>
27  */
28 
29 /**
30  * @filename    stats.h
31  */
32 
33 #if !defined STATS_H
34 #define STATS_H 1
35 
36 #if defined PLATFORM_BSD || defined PLATFORM_SOLARIS
37 #   include <time.h>
38 #endif /* PLATFORM_BSD || PLATFORM_SOLARIS */
39 
40 extern void getstats(unsigned long *uptimeminutes, double *UsagePercent,
41                      double *IdlePercent, char *osname, char *osversion,
42                      char *cpu, double *loadavg);
43 
44 #if defined PLATFORM_BSD || defined PLATFORM_SOLARIS
45 time_t initBoottime(void);
46 #endif /* PLATFORM_BSD || PLATFORM_SOLARIS */
47 
48 #if defined PLATFORM_BSD || defined PLATFORM_SOLARIS || defined PLATFORM_LINUX || defined PLATFORM_BEOS
49 void   getUptime(unsigned long *uptimeminutes);
50 void   getLoadIdle(double *UsagePercent, double *IdlePercent);
51 void   getLoadavg(double *loadavg);
52 void   initOS(char *os, char *osversion);
53 void   initCPU(char *cpu);
54 void   logcalc(char *whatwascalculateddesc, char *value);
55 
56 #endif /* PLATFORM_BSD || PLATFORM_SOLARIS || PLATFORM_LINUX || PLATFORM_BEOS */
57 
58 /* Char array sizes */
59 #define OS_SIZE        16       /* As required by the Uptimes Protocol */
60 #define OSVERSION_SIZE 64       /* Protocol is not clear on this one */
61 #define CPU_SIZE       64       /* Protocol is not clear on this one either */
62 
63 #endif /* !STATS_H */
64