Main Page | Data Structures | File List | Data Fields | Globals

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 MAX_FIELD_SZ  255
00030 #define FIELD_SZ  10
00031 
00032 
00038 struct cpu_info
00039 {
00040   char processor[FIELD_SZ];     
00041   char vendor_id[2 * FIELD_SZ]; 
00042   char cpu_family[2 * FIELD_SZ];
00043   char model[FIELD_SZ];         
00044   char model_name[5 * FIELD_SZ];        
00045   char stepping[FIELD_SZ];
00046   char Mhz[FIELD_SZ];
00047   char cache[FIELD_SZ];
00048   char fpu[FIELD_SZ / 2];
00049   char fpu_exception[FIELD_SZ / 2];
00050   char cpuid_level[FIELD_SZ / 2];
00051   char wp[FIELD_SZ / 2];
00052   char flags[50 * FIELD_SZ];
00053   char bogomips[FIELD_SZ];
00054 };
00055 
00060 struct mem_info
00061 {
00062   char total[FIELD_SZ]; 
00063   char free[FIELD_SZ];  
00064   char shared[FIELD_SZ]; 
00065   char buffers[FIELD_SZ]; 
00066   char cached[FIELD_SZ];  
00067   char swap_cached[FIELD_SZ]; 
00068   char active[FIELD_SZ];  
00069   char inactive[FIELD_SZ]; 
00070   char dirty[FIELD_SZ];  
00071   char high_total[FIELD_SZ];  
00072   char high_free[FIELD_SZ];  
00073   char low_total[FIELD_SZ];  
00074   char low_free[FIELD_SZ];   
00075   char swap_total[FIELD_SZ]; 
00076   char swap_free[FIELD_SZ];   
00077   char hugepages_total[FIELD_SZ]; 
00078   char hugepages_free[FIELD_SZ];  
00079   char hugepages_size[FIELD_SZ];  
00080 };
00081 
00082 
00083 void update_cpu ();             
00084 void update_mem ();             
00085 
00086 int get_cpu_info ();            
00087 int get_mem_info ();            

Generated on Wed Feb 15 11:24:01 2006 for lkmonitor by  doxygen 1.3.9.1