/home/fernape/Projects/lkmonitor/src/lininfo.h

Go to the documentation of this file.
00001 
00002 /*
00003         lkmonitor (Linux Kernel Monitor)
00004 
00005         Application for monitoring and tuning a Linux kernel.
00006 
00007         Copyright (C) 2005-2008  Fernando ApesteguĂ­a
00008 
00009         This program is free software; you can redistribute it and/or
00010         modify it under the terms of the GNU General Public License
00011         as published by the Free Software Foundation; either version 2
00012         of the License, or (at your option) any later version.
00013 
00014         This program is distributed in the hope that it will be useful,
00015         but WITHOUT ANY WARRANTY; without even the implied warranty of
00016         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017         GNU General Public License for more details.
00018 
00019         You should have received a copy of the GNU General Public License
00020         along with this program; if not, write to the Free Software
00021         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022 */
00023 
00024 #include <glib.h>
00025 
00026 #define PROC_DIR        "/proc/"
00027 #define CPU_FILE        "/proc/cpuinfo"
00028 #define CMD_FILE "/proc/cmdline"
00029 #define VER_FILE "/proc/version"
00030 #define LOAD_FILE "/proc/loadavg"
00031 #define IOMEM_FILE "/proc/iomem"
00032 #define IOPORTS_FILE "/proc/ioports"
00033 #define DMA_FILE "/proc/dma"
00034 #define MEM_FILE        "/proc/meminfo"
00035 #define DEV_FILE        "/proc/devices"
00036 #define FILES           "/proc/sys/fs/file-nr"
00037 #define FILE_MAX        "/proc/sys/fs/file-max"
00038 #define INODES          "/proc/sys/fs/inode-nr"
00039 #define HOST_NAME       "/proc/sys/kernel/hostname"
00040 #define DOMAIN_NAME     "/proc/sys/kernel/domainname"
00041 #define P_MAX_Q         "/proc/sys/fs/mqueue/queues_max"
00042 #define P_MAX_M         "/proc/sys/fs/mqueue/msg_max"
00043 #define P_MAX_S         "/proc/sys/fs/mqueue/msgsize_max"
00044 #define PAGE_MAX        "/proc/sys/kernel/shmall"
00045 #define SEG_MAX         "/proc/sys/kernel/shmmni"
00046 #define SEG_SIZE        "/proc/sys/kernel/shmmax"
00047 #define THREADS_MAX     "/proc/sys/kernel/threads-max"
00048 #define SEM                     "/proc/sys/kernel/sem"
00049 #define STATS_FILE      "/proc/stat"
00050 #define BATT_STATE      "/proc/acpi/battery/BAT0/state"
00051 #define BATT_INFO       "/proc/acpi/battery/BAT0/info"
00052 #define BATT_STATE1     "/proc/acpi/battery/BAT1/state"
00053 #define BATT_INFO1      "/proc/acpi/battery/BAT1/info"
00054 #define TEMPERATURE "/proc/acpi/thermal_zone/THRM/temperature"
00055 #define TEMP_TRIP "/proc/acpi/thermal_zone/THRM/trip_points"
00056 #define NET_DEVS "/proc/net/dev"
00057 #define NET_PROTOCOLS   "/proc/net/protocols"
00058 #define FS_FILE  "/proc/filesystems"
00059 #define MOD_FILE        "/proc/modules"
00060 
00061 #define MAX_FIELD_SZ  255
00062 #define FIELD_SZ  15
00063 
00064 
00065 #define TV_DEVS 0
00066 #define TV_MODS 1
00067 
00072 struct modules_info{
00073   GString *contents;
00074 };
00075 
00082 struct fs_info{
00083   GString *devs;
00084   GString *nodevs;
00085 };
00086 
00093 struct net_dev_info{
00094         unsigned long long int bytes[2];                
00095         unsigned long int packets[2];   
00096         int errs[2];            
00097         int drop[2];            
00098         int fifo[2];            
00099         int r_frame;            
00100         int t_colls;            
00101         int compressed[2];
00102         int r_multicast;        
00103         int t_carrier;          
00104 };
00105 
00111 struct settings_info
00112 {
00113         int fdmax;              
00114         int fdasig;             
00115         int fdfreed;    
00116         int inmax;              
00117         int inasig;             
00118         int posix_mq;   
00119         int posix_mpq;  
00120         int posix_ms;   
00121         GString *host;  
00122         GString *domain;
00123         int page_max;   
00124         int seg_max;    
00125         int seg_size;   
00126         int max_seminset;
00127         int max_semsys; 
00128         int max_opcall; 
00129         int max_semsets;
00130         int threads;    
00131 };
00132 
00137 struct dev_info
00138 {
00139         GString *characters;    
00140         GString *blocks;                
00141 };
00142 
00148 struct cpu_info
00149 {
00150   char processor[FIELD_SZ];     
00151   char vendor_id[2 * FIELD_SZ]; 
00152   char cpu_family[2 * FIELD_SZ];
00153   char model[FIELD_SZ];         
00154   char model_name[5 * FIELD_SZ];        
00155   char stepping[FIELD_SZ];
00156   char Mhz[FIELD_SZ];
00157   char cache[FIELD_SZ];
00158   char fpu[FIELD_SZ / 2];
00159   char fpu_exception[FIELD_SZ / 2];
00160   char cpuid_level[FIELD_SZ / 2];
00161   char wp[FIELD_SZ / 2];        
00162   char flags[50 * FIELD_SZ];
00163   char bogomips[FIELD_SZ];
00164 };
00165 
00170 struct mem_info
00171 {
00172   char total[2*FIELD_SZ];       
00173   char free[FIELD_SZ];  
00174   char shared[FIELD_SZ]; 
00175   char buffers[FIELD_SZ]; 
00176   char cached[FIELD_SZ];  
00177   char swap_cached[FIELD_SZ]; 
00178   char active[FIELD_SZ];  
00179   char inactive[FIELD_SZ]; 
00180   char dirty[FIELD_SZ];  
00181   char high_total[FIELD_SZ];  
00182   char high_free[FIELD_SZ];  
00183   char low_total[2*FIELD_SZ];  
00184   char low_free[FIELD_SZ];   
00185   char swap_total[FIELD_SZ]; 
00186   char swap_free[FIELD_SZ];   
00187   char hugepages_total[FIELD_SZ]; 
00188   char hugepages_free[FIELD_SZ];  
00189   char hugepages_size[FIELD_SZ];  
00190 };
00191 
00197 struct stats_info
00198 {
00199   GString *cpu;         
00200   GString *cpu0;        
00201   GString *cpu1;        
00202   GString *ctxt;        
00203 };
00204 
00210 struct battery_info
00211 {
00212         GString *rem;           
00213         GString *cap;           
00214         GString *last_cap;      
00215         GString *type;          
00216         GString *cap_warning;   
00217         GString *cap_low;       
00218 };
00219 
00220 
00225 struct acpi_info
00226 {
00227         GString *temp;                  
00228         GString *temp_critical;         
00229         struct battery_info battery;    
00230 };
00231 
00237 struct cmd_ver
00238 {
00239   GString *cmd;
00240   GString *version;
00241   GString *loadavg;
00242 };
00243 
00244 
00250 struct channels_info{
00251   GString *ioports;
00252   GString *iomem;
00253   GString *dma; 
00254 };
00255 
00256 int get_cpu_info ();            
00257 int get_mhz_info();             
00258 int get_mem_info ();            
00259 int get_devs_info();            
00260 int get_settings_info();        
00261 int get_stats_info ();          
00262 int get_acpi_info();            
00263 int get_battery_info();         
00264 int get_cmd_ver_info();         
00265 int get_loadavg_info();         
00266 int get_channels_info();        
00267 int get_net_info();             
00268 int get_fs_info();              
00269 int get_mod_info();

Generated on Tue Apr 1 22:52:52 2008 for lkmonitor by  doxygen 1.5.1