A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
mc
/
RegionSnapshot.hpp
diff --git
a/src/mc/RegionSnapshot.hpp
b/src/mc/RegionSnapshot.hpp
index
f1007ac
..
30beff1
100644
(file)
--- a/
src/mc/RegionSnapshot.hpp
+++ b/
src/mc/RegionSnapshot.hpp
@@
-15,7
+15,7
@@
#include <xbt/base.h>
#include <xbt/base.h>
-#include "src/mc/
remote_p
tr.hpp"
+#include "src/mc/
RemoteP
tr.hpp"
#include "src/mc/PageStore.hpp"
#include "src/mc/AddressSpace.hpp"
#include "src/mc/ChunkedData.hpp"
#include "src/mc/PageStore.hpp"
#include "src/mc/AddressSpace.hpp"
#include "src/mc/ChunkedData.hpp"
@@
-37,37
+37,46
@@
enum class StorageType {
Privatized = 3
};
Privatized = 3
};
-class
b
uffer {
-p
ublic
:
+class
B
uffer {
+p
rivate
:
enum class Type {
Malloc,
Mmap
};
enum class Type {
Malloc,
Mmap
};
-private:
void* data_ = nullptr;
std::size_t size_;
Type type_ = Type::Malloc;
void* data_ = nullptr;
std::size_t size_;
Type type_ = Type::Malloc;
-public:
- buffer() {}
- buffer(std::size_t size, Type type = Type::Malloc);
- buffer(void* data, std::size_t size, Type type = Type::Malloc) :
+private:
+ Buffer(std::size_t size, Type type = Type::Malloc);
+ Buffer(void* data, std::size_t size, Type type = Type::Malloc) :
data_(data), size_(size), type_(type) {}
data_(data), size_(size), type_(type) {}
+public:
+ Buffer() {}
void clear() noexcept;
void clear() noexcept;
- ~buffer() noexcept { clear(); }
+ ~Buffer() noexcept { clear(); }
+
+ static Buffer malloc(std::size_t size)
+ {
+ return Buffer(size, Type::Malloc);
+ }
+ static Buffer mmap(std::size_t size)
+ {
+ return Buffer(size, Type::Mmap);
+ }
// No copy
// No copy
-
buffer(b
uffer const& buffer) = delete;
-
buffer& operator=(b
uffer const& buffer) = delete;
+
Buffer(B
uffer const& buffer) = delete;
+
Buffer& operator=(B
uffer const& buffer) = delete;
// Move
// Move
-
buffer(b
uffer&& that) noexcept
+
Buffer(B
uffer&& that) noexcept
: data_(that.data_), size_(that.size_), type_(that.type_)
{
that.data_ = nullptr;
that.size_ = 0;
that.type_ = Type::Malloc;
}
: data_(that.data_), size_(that.size_), type_(that.type_)
{
that.data_ = nullptr;
that.size_ = 0;
that.type_ = Type::Malloc;
}
-
buffer& operator=(b
uffer&& that) noexcept
+
Buffer& operator=(B
uffer&& that) noexcept
{
clear();
data_ = that.data_;
{
clear();
data_ = that.data_;
@@
-82,7
+91,6
@@
public:
void* get() { return data_; }
const void* get() const { return data_; }
std::size_t size() const { return size_; }
void* get() { return data_; }
const void* get() const { return data_; }
std::size_t size() const { return size_; }
- Type type() const { return type_; }
};
/** A copy/snapshot of a given memory region
};
/** A copy/snapshot of a given memory region
@@
-130,7
+138,7
@@
private:
* */
void *permanent_addr_;
* */
void *permanent_addr_;
-
b
uffer flat_data_;
+
B
uffer flat_data_;
ChunkedData page_numbers_;
std::vector<RegionSnapshot> privatized_regions_;
public:
ChunkedData page_numbers_;
std::vector<RegionSnapshot> privatized_regions_;
public:
@@
-204,15
+212,15
@@
public:
privatized_regions_.clear();
}
privatized_regions_.clear();
}
- void flat_data(
b
uffer data)
+ void flat_data(
B
uffer data)
{
storage_type_ = StorageType::Flat;
flat_data_ = std::move(data);
page_numbers_.clear();
privatized_regions_.clear();
}
{
storage_type_ = StorageType::Flat;
flat_data_ = std::move(data);
page_numbers_.clear();
privatized_regions_.clear();
}
- const
b
uffer& flat_data() const { return flat_data_; }
-
b
uffer& flat_data() { return flat_data_; }
+ const
B
uffer& flat_data() const { return flat_data_; }
+
B
uffer& flat_data() { return flat_data_; }
void page_data(ChunkedData page_data)
{
void page_data(ChunkedData page_data)
{
@@
-244,14
+252,14
@@
public:
// Other getters
// Other getters
-
remote_p
tr<void> start() const { return remote(start_addr_); }
-
remote_p
tr<void> end() const { return remote((char*)start_addr_ + size_); }
-
remote_p
tr<void> permanent_address() const { return remote(permanent_addr_); }
+
RemoteP
tr<void> start() const { return remote(start_addr_); }
+
RemoteP
tr<void> end() const { return remote((char*)start_addr_ + size_); }
+
RemoteP
tr<void> permanent_address() const { return remote(permanent_addr_); }
std::size_t size() const { return size_; }
StorageType storage_type() const { return storage_type_; }
RegionType region_type() const { return region_type_; }
std::size_t size() const { return size_; }
StorageType storage_type() const { return storage_type_; }
RegionType region_type() const { return region_type_; }
- bool contain(
remote_p
tr<void> p) const
+ bool contain(
RemoteP
tr<void> p) const
{
return p >= start() && p < end();
}
{
return p >= start() && p < end();
}