X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0d8026e21b557c69dfdb23f8b6fddb6d277e28df..a6683a1cd7515c04a74364c9f991d55d9329a7c5:/src/mc/ChunkedData.hpp diff --git a/src/mc/ChunkedData.hpp b/src/mc/ChunkedData.hpp index ae6efb13e5..076e607560 100644 --- a/src/mc/ChunkedData.hpp +++ b/src/mc/ChunkedData.hpp @@ -19,10 +19,19 @@ namespace simgrid { namespace mc { -/** A byte-string represented as a sequence of chunks from a PageStor */ +/** A byte-string represented as a sequence of chunks from a PageStore + * + * In order to save memory when taking memory snapshots, a given byte-string + * is split in fixed-size chunks. Identical chunks (either from the same + * snapshot or more probably from different snpashots) share the same memory + * storage. + * + * Thus a chunked is represented as a sequence of indices of each chunk. + */ class ChunkedData { + /** This is where we store the chunks */ PageStore* store_ = nullptr; - /** Indices of the chunks */ + /** Indices of the chunks in the `PageStore` */ std::vector pagenos_; public: @@ -72,10 +81,16 @@ public: return *this; } + /** How many pages are used */ std::size_t page_count() const { return pagenos_.size(); } + + /** Get a chunk index */ std::size_t pageno(std::size_t i) const { return pagenos_[i]; } + + /** Get a view of the chunk indices */ const std::size_t* pagenos() const { return pagenos_.data(); } + /** Get a a pointer to a chunk */ const void* page(std::size_t i) const { return store_->get_page(pagenos_[i]);