SST  14.0.0
StructuralSimulationToolkit
mempoolAccessor.h
1 // Copyright 2009-2024 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2024, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_MEMPOOL_ACCESSOR_H
13 #define SST_CORE_MEMPOOL_ACCESSOR_H
14 
15 
16 namespace SST {
17 
18 namespace Core {
19 
20 // Class to access stats/data about the mempools. This is here to
21 // limit exposure to the USE_MEMPOOL #define, which will only be in
22 // core .cc files.
24 {
25 public:
26  // Gets the arena size for the specified pool size on the current
27  // thread. If mempools aren't enabled, it will return 0.
28  static size_t getArenaSize(size_t size);
29 
30  // Gets the number of arenas allocated for the specified pool size
31  // on the current thread. If mempools aren't enabled, it will
32  // return 0.
33  static size_t getNumArenas(size_t size);
34 
35  // Gets the total bytes used for the specified pool size on the
36  // current thread. If mempools aren't enabled, it will return 0.
37  static uint64_t getBytesMemUsedBy(size_t size);
38 
39  // Gets the total mempool usage for the rank. Returns both the
40  // bytes and the number of active entries. Bytes and entries are
41  // added to the value passed into the function. If mempools
42  // aren't enabled, then nothing will be counted.
43  static void getMemPoolUsage(int64_t& bytes, int64_t& active_entries);
44 
45  // Initialize the global mempool data structures
46  static void initializeGlobalData(int num_threads, bool cache_align = false);
47 
48  // Initialize the per thread mempool ata structures
49  static void initializeLocalData(int thread);
50 
51  static void printUndeletedMemPoolItems(const std::string& header, Output& out);
52 };
53 
54 } // namespace Core
55 } // namespace SST
56 
57 #endif // SST_CORE_MEMPOOL_ACCESSOR_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:53
Definition: action.cc:18
Definition: mempoolAccessor.h:23