|
Sierra Toolkit
Version of the Day
|
00001 /*--------------------------------------------------------------------*/ 00002 /* Copyright 2003, 2008 Sandia Corporation. */ 00003 /* Under the terms of Contract DE-AC04-94AL85000, there is a */ 00004 /* non-exclusive license for use of this work by or on behalf */ 00005 /* of the U.S. Government. Export of this program may require */ 00006 /* a license from the United States Government. */ 00007 /*--------------------------------------------------------------------*/ 00008 00009 #ifndef STK_UTIL_DIAG_Platform_h 00010 #define STK_UTIL_DIAG_Platform_h 00011 00012 #include <iosfwd> 00013 #include <stk_util/stk_config.h> 00014 #if defined( STK_HAS_MPI ) 00015 #include <mpi.h> 00016 #endif 00017 00018 #include <stk_util/util/FeatureTest.hpp> 00019 #include <stk_util/diag/Env.hpp> 00020 #include <stk_util/diag/String.hpp> 00021 #include <stk_util/diag/Option.hpp> 00022 #include <stk_util/environment/RegisterProduct.hpp> 00023 00024 namespace sierra { 00025 namespace Env { 00026 00031 00037 void startup_preparallel_platform(); 00038 00039 00048 std::string hostname(); 00049 00050 00059 std::string domainname(); 00060 00061 00070 std::string username(); 00071 00072 00082 std::string hardware(); 00083 00084 00094 std::string osname(); 00095 00096 00106 std::string osversion(); 00107 00108 00117 int pid(); 00118 00119 00128 int pgrp(); 00129 00130 00142 void get_heap_info(size_t &heap_size, size_t &largest_free); 00143 00144 00152 inline size_t get_heap_usage() { 00153 size_t heap_size; 00154 size_t largest_free; 00155 get_heap_info(heap_size, largest_free); 00156 00157 return heap_size; 00158 } 00159 00166 size_t get_available_memory(); 00167 00168 00181 void get_memory_info(size_t &memory_usage, size_t &faults); 00182 00183 00193 bool path_exists(const std::string &path); 00194 00195 00210 bool path_access(const std::string &path, int mode); 00211 00212 00224 bool path_read_access(const std::string &path); 00225 00237 bool path_write_access(const std::string &path); 00238 00239 00250 bool read_lock(int fd); 00251 00252 00263 bool write_lock(int fd); 00264 00265 00277 bool append_lock(int fd); 00278 00279 00291 bool release_lock(int fd); 00292 00296 00297 } // namespace Env 00298 } // namespace sierra 00299 00300 #endif // STK_UTIL_DIAG_Platform_h