Sierra Toolkit  Version of the Day
Platform.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2003, 2008 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef STK_UTIL_DIAG_Platform_h
10 #define STK_UTIL_DIAG_Platform_h
11 
12 #include <iosfwd>
13 #include <stk_util/stk_config.h>
14 #if defined( STK_HAS_MPI )
15 #include <mpi.h>
16 #endif
17 
18 #include <stk_util/util/FeatureTest.hpp>
19 #include <stk_util/diag/Env.hpp>
20 #include <stk_util/diag/String.hpp>
21 #include <stk_util/diag/Option.hpp>
22 #include <stk_util/environment/RegisterProduct.hpp>
23 
24 namespace sierra {
25 namespace Env {
26 
31 
38 
39 
48 std::string hostname();
49 
50 
59 std::string domainname();
60 
61 
70 std::string username();
71 
72 
82 std::string hardware();
83 
84 
94 std::string osname();
95 
96 
106 std::string osversion();
107 
108 
117 int pid();
118 
119 
128 int pgrp();
129 
130 
142 void get_heap_info(size_t &heap_size, size_t &largest_free);
143 
144 
152 inline size_t get_heap_usage() {
153  size_t heap_size;
154  size_t largest_free;
155  get_heap_info(heap_size, largest_free);
156 
157  return heap_size;
158 }
159 
166 size_t get_available_memory();
167 
168 
181 void get_memory_info(size_t &memory_usage, size_t &faults);
182 
183 
193 bool path_exists(const std::string &path);
194 
195 
210 bool path_access(const std::string &path, int mode);
211 
212 
224 bool path_read_access(const std::string &path);
225 
237 bool path_write_access(const std::string &path);
238 
239 
250 bool read_lock(int fd);
251 
252 
263 bool write_lock(int fd);
264 
265 
277 bool append_lock(int fd);
278 
279 
291 bool release_lock(int fd);
292 
296 
297 } // namespace Env
298 } // namespace sierra
299 
300 #endif // STK_UTIL_DIAG_Platform_h
size_t get_available_memory()
Function get_available_memory returns an estimation of the amount of memory available to the process...
Definition: Platform.cpp:358
std::string osversion()
Function osversion returns the hardware type of the host running the application. ...
Definition: Platform.cpp:541
Definition: Env.cpp:53
int pid()
Function pid returns the process id of the process running the application.
Definition: Platform.cpp:557
void get_memory_info(size_t &memory_usage, size_t &faults)
Function get_memory_info returns the total memory usage of the process and the number of page faults ...
Definition: Platform.cpp:386
bool path_write_access(const std::string &name)
Function path_write_access returns true if the process has write access to the path.
Definition: Platform.cpp:601
void startup_preparallel_platform()
Function startup_preparallel_platform ...
Definition: Platform.cpp:255
bool release_lock(int fd)
Function release_lock returns true if the process was able to release a lock previously palced on the...
Definition: Platform.cpp:640
void get_heap_info(size_t &heap_size, size_t &largest_free)
Member function get_heap_info returns the amount of heap memory used in bytes and the largest free bl...
Definition: Platform.cpp:295
bool write_lock(int fd)
Function write_lock returns true if the process was able to place an exclusive lock on the specified ...
Definition: Platform.cpp:628
size_t get_heap_usage()
Function get_heap_usage returns the number of bytes used by the heap.
Definition: Platform.hpp:152
bool append_lock(int fd)
Function append_lock returns true if the process was able to place an exclusive lock on the end of th...
Definition: Platform.cpp:660
bool path_access(const std::string &name, int mode)
Function path_access returns true if the process has permission to access path with the specified mod...
Definition: Platform.cpp:575
std::string hardware()
Function hardware returns the hardware type of the host running the application.
Definition: Platform.cpp:509
std::string domainname()
Function domainname returns the domainname of the domain running the application. ...
Definition: Platform.cpp:463
bool read_lock(int fd)
Function read_lock returns true if the process was able to place a shared lock on the specified file ...
Definition: Platform.cpp:652
bool path_exists(const std::string &name)
Function path_exists returns true if the path exists.
Definition: Platform.cpp:585
std::string username()
Function username returns the username of the user running the application.
Definition: Platform.cpp:493
bool path_read_access(const std::string &name)
Function path_read_access returns true if the process has read access to the path.
Definition: Platform.cpp:593
int pgrp()
Function pgrp returns the process group id of the process running the application.
Definition: Platform.cpp:564
std::string osname()
Function osname returns the operating system nameof the host running the application.
Definition: Platform.cpp:525
std::string hostname()
Function hostname returns the hostname of the host running the application.
Definition: Platform.cpp:454