00001 #ifndef _DIVINE_SYSINFO_HH_
00002 #define _DIVINE_SYSINFO_HH_
00003
00004 #include <iostream>
00005
00006
00007 #include <unistd.h>
00008 #include <sys/types.h>
00009 #include <sys/stat.h>
00010 #include <sys/time.h>
00011 #include <sys/resource.h>
00012 #ifdef __APPLE__
00013 #include <mach/task.h>
00014 #include <mach/mach_init.h>
00015 #include <mach/shared_memory_server.h>
00016 #endif
00017 #include <fcntl.h>
00018 #include <stdio.h>
00019
00020
00021 #include <vector>
00022
00023
00024 #include <stdlib.h>
00025
00027 class vminfo_t {
00028 protected:
00029 bool statm;
00030 int pid;
00031 char filename[100];
00032
00033 int lineskip;
00034
00035 public:
00036 int vmsize,vmlck,vmrss,vmdata,vmstk,vmexe,vmlib;
00037
00038 vminfo_t();
00039 ~vminfo_t();
00040 void scan();
00041 int getvmsize();
00042 int getvmrss();
00043 int getvmdata();
00044 void print();
00045 };
00046
00048 class timeinfo_t
00049 {
00050 protected:
00051 timeval stored;
00052 long tv_sec;
00053 long tv_usec;
00054 void print_time(long,long);
00055 public:
00056 timeinfo_t();
00057 timeinfo_t(double);
00058 timeinfo_t(long,long);
00059 void settimeout(long,long);
00060 void settimeout(double);
00061 void reset();
00062 bool testtimeout();
00063 #if !defined(ORIG_TIMEOUT)
00064 bool testtimeout(timeval&);
00065 #endif
00066 double gettime();
00067 void print();
00068 };
00069
00070 class timeprofiler_t {
00071 private:
00072 std::vector<timeval> timevalues;
00073 timeval lasttick,firsttick;
00074 int focus;
00075 public:
00076 timeprofiler_t(int = 100);
00077 void profile_on(int);
00078 void profile_off();
00079 long get_time_on(int);
00080 long get_global_time();
00081 };
00082
00083
00084 class loadinfo_t {
00085 public:
00086 int getload();
00087 };
00088
00089 #endif
00090
00091