/home/coin/SVN-release/Bcp-1.2.1/Bcp/src/include/BCP_os.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef _BCP_OS_H
00004 #define _BCP_OS_H
00005 
00006 #include <cstdio>
00007 #include "BcpConfig.h"
00008 
00009 //-----------------------------------------------------------------------------
00010 #ifdef HAVE_SYS_RESOURCE_H
00011 #  include <sys/resource.h>
00012 #else
00013 #  define setpriority(x,y,z)
00014 #endif
00015 //-----------------------------------------------------------------------------
00016 #ifdef HAVE_UNISTD_H
00017 #  include <unistd.h>
00018 #endif
00019 
00020 #ifdef HAVE_PROCESS_H
00021 #  include <process.h>
00022 #endif
00023 
00024 #ifndef HAVE_GETHOSTNAME
00025 #  define gethostname(x,y)
00026 #endif
00027 
00028 #ifdef HAVE_GETPID
00029 #  define GETPID (getpid())
00030 #else
00031 #  define GETPID (0)
00032 #endif
00033 //-----------------------------------------------------------------------------
00034 
00035 #ifdef HAVE_SYS_SYSINFO_H
00036 #include <sys/sysinfo.h>
00037 #endif
00038 static inline long BCP_free_mem()
00039 {
00040 #ifdef HAVE_SYSINFO
00041   struct sysinfo info;
00042   sysinfo(&info);
00043   return info.mem_unit*info.freeram;
00044 #else
00045   return -1;
00046 #endif
00047 }
00048 //-----------------------------------------------------------------------------
00049 
00050 #ifdef HAVE_MALLINFO
00051 #include <malloc.h>
00052 #endif
00053 
00054 static inline long BCP_used_heap()
00055 {
00056 #ifdef HAVE_MALLINFO
00057   struct mallinfo info = mallinfo();
00058   return info.usmblks + info.uordblks;;
00059 #else
00060   return -1;
00061 #endif
00062 }
00063 //-----------------------------------------------------------------------------
00064 
00065 #endif

Generated on Thu Jan 15 03:00:58 2009 for coin-Bcp by  doxygen 1.4.7