lininfo.h

Go to the documentation of this file.
00001 /*
00002 lkmonitor (Linux Kernel Monitor)
00003 
00004 Application for monitoring and tuning a Linux kernel.
00005 
00006 Copyright (C) 2005-2006  Fernando ApesteguĂ­a
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 */
00022 
00023 #include <glib.h>
00024 
00025 
00026 #define PROC_DIR        "/proc/"
00027 #define CPU_FILE        "/proc/cpuinfo"
00028 #define MEM_FILE        "/proc/meminfo"
00029 #define DEV_FILE        "/proc/devices"
00030 #define FILES           "/proc/sys/fs/file-nr"
00031 #define FILE_MAX        "/proc/sys/fs/file-max"
00032 #define INODES          "/proc/sys/fs/inode-nr"
00033 #define HOST_NAME       "/proc/sys/kernel/hostname"
00034 #define DOMAIN_NAME     "/proc/sys/kernel/domainname"
00035 #define P_MAX_Q         "/proc/sys/fs/mqueue/queues_max"
00036 #define P_MAX_M         "/proc/sys/fs/mqueue/msg_max"
00037 #define P_MAX_S         "/proc/sys/fs/mqueue/msgsize_max"
00038 #define PAGE_MAX        "/proc/sys/kernel/shmall"
00039 #define SEG_MAX         "/proc/sys/kernel/shmmni"
00040 #define SEG_SIZE        "/proc/sys/kernel/shmmax"
00041 #define THREADS_MAX     "/proc/sys/kernel/threads-max"
00042 #define SEM                     "/proc/sys/kernel/sem"
00043 #define STATS_FILE      "/proc/stat"
00044 #define BATT_STATE      "/proc/acpi/battery/BAT0/state"
00045 #define BATT_INFO       "/proc/acpi/battery/BAT0/info"
00046 #define BATT_STATE1     "/proc/acpi/battery/BAT1/state"
00047 #define BATT_INFO1      "/proc/acpi/battery/BAT1/info"
00048 #define TEMPERATURE "/proc/acpi/thermal_zone/THRM/temperature"
00049 #define TEMP_TRIP "/proc/acpi/thermal_zone/THRM/trip_points"
00050 
00051 #define MAX_FIELD_SZ  255
00052 #define FIELD_SZ  15
00053 
00059 struct settings_info
00060 {
00061         int fdmax;              
00062         int fdasig;             
00063         int fdfreed;    
00064         int inmax;              
00065         int inasig;             
00066         int posix_mq;   
00067         int posix_mpq;  
00068         int posix_ms;   
00069         GString *host;  
00070         GString *domain;
00071         int page_max;   
00072         int seg_max;    
00073         int seg_size;   
00074         int max_seminset;
00075         int max_semsys; 
00076         int max_opcall; 
00077         int max_semsets;
00078         int threads;    
00079 };
00080 
00085 struct dev_info
00086 {
00087         GString *characters;    
00088         GString *blocks;                
00089 };
00090 
00096 struct cpu_info
00097 {
00098   char processor[FIELD_SZ];     
00099   char vendor_id[2 * FIELD_SZ]; 
00100   char cpu_family[2 * FIELD_SZ];
00101   char model[FIELD_SZ];         
00102   char model_name[5 * FIELD_SZ];        
00103   char stepping[FIELD_SZ];
00104   char Mhz[FIELD_SZ];
00105   char cache[FIELD_SZ];
00106   char fpu[FIELD_SZ / 2];
00107   char fpu_exception[FIELD_SZ / 2];
00108   char cpuid_level[FIELD_SZ / 2];
00109   char wp[FIELD_SZ / 2];        
00110   char flags[50 * FIELD_SZ];
00111   char bogomips[FIELD_SZ];
00112 };
00113 
00118 struct mem_info
00119 {
00120   char total[2*FIELD_SZ];       
00121   char free[FIELD_SZ];  
00122   char shared[FIELD_SZ]; 
00123   char buffers[FIELD_SZ]; 
00124   char cached[FIELD_SZ];  
00125   char swap_cached[FIELD_SZ]; 
00126   char active[FIELD_SZ];  
00127   char inactive[FIELD_SZ]; 
00128   char dirty[FIELD_SZ];  
00129   char high_total[FIELD_SZ];  
00130   char high_free[FIELD_SZ];  
00131   char low_total[2*FIELD_SZ];  
00132   char low_free[FIELD_SZ];   
00133   char swap_total[FIELD_SZ]; 
00134   char swap_free[FIELD_SZ];   
00135   char hugepages_total[FIELD_SZ]; 
00136   char hugepages_free[FIELD_SZ];  
00137   char hugepages_size[FIELD_SZ];  
00138 };
00139 
00145 struct stats_info
00146 {
00147   GString *cpu;         
00148   GString *cpu0;        
00149   GString *cpu1;        
00150   GString *ctxt;        
00151 };
00152 
00158 struct battery_info
00159 {
00160         GString *rem;                   
00161         GString *cap;                   
00162         GString *last_cap;              
00163         GString *type;                  
00164         GString *cap_warning;   
00165         GString *cap_low;               
00166 };
00167 
00168 
00173 struct acpi_info
00174 {
00175         GString *temp;                                  
00176         GString *temp_critical;                 
00177         struct battery_info battery;    
00178 };
00179 
00180 
00181 int get_cpu_info ();            
00182 int get_mhz_info();                     
00183 int get_mem_info ();            
00184 int get_devs_info();            
00185 int get_settings_info();        
00186 int get_stats_info ();          
00187 int get_acpi_info();            
00188 int get_battery_info();         

Generated on Sat Dec 2 11:27:51 2006 for lkmonitor by  doxygen 1.5.1