20 default_workspace_store = default_workspace_store_in;
25 return default_workspace_store;
30 if( workspace_store ) {
32 <<
"\n*** Statistics for autmatic array workspace:"
33 <<
"\n Number of megabytes of preallocated workspace = "
35 <<
"\n Number of megabytes needed = "
37 <<
"\n Number of allocations using preallocated workspace = "
39 <<
"\n Number of dynamic allocations beyond preallocated workspace = "
45 <<
"\n*** Statistics for autmatic array workspace:"
46 <<
"\n No workspace storage was allocated!\n";
55 : workspace_begin_(NULL)
56 , workspace_end_(NULL)
58 , num_static_allocations_(0)
59 , num_dyn_allocations_(0)
60 , num_current_bytes_total_(0)
61 , num_max_bytes_needed_(0)
75 ,
"WorkspaceStore::set_workspace_size(...) : Error, "
76 "You can not reset the workspace size when any RawWorkspace objects "
77 "are using workspace!" );
133 ,
"RawWorkspace::~RawWorkspace(...): Error, "
134 "Invalid usage of RawWorkspace class, corrupted WorspaceStore object!" );
140 #ifdef __PGI // Should not have to define this since it should not be called!
141 void* RawWorkspace::operator
new(size_t)
WorkspaceStore * workspace_store_
size_t num_current_bytes_total_
TEUCHOSCORE_LIB_DLL_EXPORT void set_default_workspace_store(const Teuchos::RCP< WorkspaceStore > &default_workspace_store)
Set pointer to global workspace object.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
size_t num_bytes() const
Return the number of bytes of raw workspace.
~RawWorkspace()
Deallocate workspace.
int num_static_allocations_
size_t num_max_bytes_needed_
WorkspaceStore(size_t num_bytes)
Workspace encapsulation class.
size_t num_max_bytes_needed() const
Return the maximum storage in bytes needed. This is the maximum total amount of * storage that was ne...
int num_dyn_allocations() const
Return the number of dynamic memory allocations granted thus far. This is the number of memory alloca...
#define TEUCHOS_TEST_FOR_TERMINATION(terminate_test, msg)
This macro is to be used instead of TEUCHOS_TEST_FOR_EXCEPTION() to report an error in situations whe...
int num_static_allocations() const
Return the number of static memory allocations granted thus far. This is the number of memory allocat...
Smart reference counting pointer class for automatic garbage collection.
void protected_initialize(size_t num_bytes)
size_t num_bytes_remaining() const
Return the number of bytes remaining currently.
size_t num_bytes_total() const
Return the total number of bytes that where initially allocated.
TEUCHOSCORE_LIB_DLL_EXPORT void print_memory_usage_stats(const WorkspaceStore *workspace_store, std::ostream &out)
Print statistics on memory usage.
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Get the global workspace object set by set_default_workspace_store().