| 155 | |
| 156 | /// \cond DOXYGEN_IGNORE |
| 157 | struct CacheStats |
| 158 | { |
| 159 | int size{0}; //!< current size: nbuild - nerase |
| 160 | int maxsize{0}; //!< highest water mark of size |
| 161 | Long maxuse{0}; //!< max # of uses of a cached item |
| 162 | Long nuse{0}; //!< # of uses of the whole cache |
| 163 | Long nbuild{0}; //!< # of build operations |
| 164 | Long nerase{0}; //!< # of erase operations |
| 165 | Long bytes{0}; |
| 166 | Long bytes_hwm{0}; |
| 167 | std::string name; //!< name of the cache |
| 168 | explicit CacheStats (std::string name_) |
| 169 | : name(std::move(name_)) {} |
| 170 | void recordBuild () noexcept { |
| 171 | ++size; |
| 172 | ++nbuild; |
| 173 | maxsize = std::max(maxsize, size); |
| 174 | } |
| 175 | void recordErase (Long n) noexcept { |
| 176 | // n: how many times the item to be deleted has been used. |
| 177 | --size; |
| 178 | ++nerase; |
| 179 | maxuse = std::max(maxuse, n); |
| 180 | } |
| 181 | void recordUse () noexcept { ++nuse; } |
| 182 | void print () const { |
| 183 | amrex::Print(Print::AllProcs) << "### " << name << " ###\n" |
| 184 | << " tot # of builds : " << nbuild << "\n" |
| 185 | << " tot # of erasures: " << nerase << "\n" |
| 186 | << " tot # of uses : " << nuse << "\n" |
| 187 | << " max cache size : " << maxsize << "\n" |
| 188 | << " max # of uses : " << maxuse << "\n"; |
| 189 | } |
| 190 | }; |
| 191 | /// \endcond |
| 192 | //! Used by a bunch of routines when communicating via MPI. |
| 193 | struct CopyComTag |