00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_SysResource.h ( UT Library, C++) 00015 * 00016 * COMMENTS: SysResource class to retrieve system specific information 00017 */ 00018 00019 #ifndef __UT_SysResource__ 00020 #define __UT_SysResource__ 00021 00022 #include "UT_API.h" 00023 #include <SYS/SYS_Types.h> 00024 00025 class UT_API UT_SysResource { 00026 public: 00027 UT_SysResource(); 00028 ~UT_SysResource(); 00029 00030 // Do not update the CPU idle if you're calling this from a static 00031 // construction code path or else it will hang houdini on Windows! 00032 void update( bool skip_update_idle = false ); 00033 00034 // Return information about memory on the system. All results are Kb. 00035 int64 getPhysMemory() const { return myPhysMemory; } 00036 int64 getFreeMemory() const { return myFreeMemory; } 00037 00038 // If not supported, returns 0 00039 int64 getTotalSwap() const { return myTotalSwap; } 00040 int64 getFreeSwap() const { return myFreeSwap; } 00041 00042 // This is a number between 0 (fully loaded) and 1 (fully idle). 00043 // If not supported, returns -1 00044 fpreal getCPUIdle() const { return myCPUIdle; } 00045 00046 const char *getSystemName() const { return mySystemName; } 00047 00048 private: 00049 int64 myPhysMemory; 00050 int64 myFreeMemory; 00051 int64 myTotalSwap; 00052 int64 myFreeSwap; 00053 const char *mySystemName; 00054 00055 float myCPUIdle; 00056 }; 00057 00058 #endif
1.5.9