-/* Shared allocations are handled through shared memory segments.
- * Associated data and metadata are used as follows:
- *
- * mmap #1
- * `allocs' dict ---- -.
- * ---------- shared_data_t shared_metadata_t / | | |
- * .->| <name> | ---> -------------------- <--. ----------------- | | | |
- * | ---------- | fd of <name> | | | size of mmap | --| | | |
- * | | count (2) | |-- | data | \ | | |
- * `----------------- | <name> | | ----------------- ---- |
- * -------------------- | ^ |
- * | | |
- * | | `allocs_metadata' dict |
- * | | ---------------------- |
- * | `-- | <addr of mmap #1> |<-'
- * | .-- | <addr of mmap #2> |<-.
- * | | ---------------------- |
- * | | |
- * | | |
- * | | |
- * | | mmap #2 |
- * | v ---- -'
- * | shared_metadata_t / | |
- * | ----------------- | | |
- * | | size of mmap | --| | |
- * `-- | data | | | |
- * ----------------- | | |
- * \ | |
- * ----
- */
-
-#define PTR_STRLEN (2 + 2 * sizeof(void*) + 1)
-
-xbt_dict_t samples = NULL; /* Allocated on first use */
-xbt_dict_t calls = NULL; /* Allocated on first use */
-
-double smpi_cpu_threshold;
-double smpi_running_power;
-
-int smpi_loaded_page = -1;
-char* smpi_start_data_exe = NULL;
-int smpi_size_data_exe = 0;
-int smpi_privatize_global_variables;
-double smpi_total_benched_time = 0;
-smpi_privatisation_region_t smpi_privatisation_regions;
-
-namespace {
-
-/** Some location in the source code
- *
- * This information is used by SMPI_SHARED_MALLOC to allocate some shared memory for all simulated processes.
- */
-class smpi_source_location {
-public:
- smpi_source_location(const char* filename, int line)
- : filename(filename), filename_length(strlen(filename)), line(line) {}
-
- /** Pointer to a static string containing the file name */
- const char* filename = nullptr;
- int filename_length = 0;
- int line = 0;
-
- bool operator==(smpi_source_location const& that) const
- {
- return filename_length == that.filename_length
- && line == that.line
- && std::memcmp(filename, that.filename, filename_length) == 0;
- }
- bool operator!=(smpi_source_location const& that) const
- {
- return !(*this == that);
- }
-};
-
-}
-
-namespace std {
-
-template<>
-class hash<smpi_source_location> {
-public:
- typedef smpi_source_location argument_type;
- typedef std::size_t result_type;
- result_type operator()(smpi_source_location const& loc) const
- {
- return xbt_str_hash_ext(loc.filename, loc.filename_length)
- ^ xbt_str_hash_ext((const char*) &loc.line, sizeof(loc.line));
- }
-};