ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
ckpt.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <mm/buddy/buddy.h>
12 
14 struct buddy_checkpoint { // todo only log longest[] if changed, or incrementally
16  const struct buddy_state *orig;
20  // this tracks writes to the allocation tree...
21  (1 << (B_TOTAL_EXP - 2 * B_BLOCK_EXP + 1)) +
22  // ...while this tracks writes to the actual memory buffer
23  (1 << (B_TOTAL_EXP - B_BLOCK_EXP))
24  )
25  ];
27  uint8_t longest[(1U << (B_TOTAL_EXP - B_BLOCK_EXP + 1))];
29  unsigned char base_mem[];
30 };
31 
32 static_assert(
33  offsetof(struct buddy_checkpoint, longest) ==
34  offsetof(struct buddy_checkpoint, base_mem) -
35  sizeof(((struct buddy_checkpoint *)0)->longest),
36  "longest and base_mem are not contiguous, this will break incremental checkpointing");
37 
38 extern struct buddy_checkpoint *checkpoint_full_take(const struct buddy_state *self, struct buddy_checkpoint *data);
39 extern const struct buddy_checkpoint *checkpoint_full_restore(struct buddy_state *self, const struct buddy_checkpoint *data);
40 extern struct buddy_checkpoint *checkpoint_incremental_take(const struct buddy_state *self, struct buddy_checkpoint *data);
41 extern const struct buddy_checkpoint * checkpoint_incremental_restore(struct buddy_state *self, const struct buddy_checkpoint *ckp);
unsigned char block_bitmap
The type of a generic bitmap.
Definition: bitmap.h:22
#define bitmap_required_size(requested_bits)
Computes the required size of a bitmap.
Definition: bitmap.h:63
A Buddy System implementation.
A restorable checkpoint of the memory context of a single buddy system.
Definition: ckpt.h:14
uint8_t longest[(1U<<(B_TOTAL_EXP - B_BLOCK_EXP+1))]
The checkpointed binary tree representing the buddy system.
Definition: ckpt.h:27
unsigned char base_mem[]
The checkpointed memory buffer assigned to the model.
Definition: ckpt.h:29
const struct buddy_state * orig
The buddy system to which this checkpoint applies. TODO: reengineer the multi-checkpointing approach.
Definition: ckpt.h:16
block_bitmap dirty[bitmap_required_size((1<<(B_TOTAL_EXP - 2 *B_BLOCK_EXP+1))+(1<<(B_TOTAL_EXP - B_BLOCK_EXP)))]
The checkpoint of the dirty bitmap.
Definition: ckpt.h:25
The checkpointable memory context of a single buddy system.
Definition: buddy.h:30
uint8_t longest[(1U<<(B_TOTAL_EXP - B_BLOCK_EXP+1))]
The checkpointed binary tree representing the buddy system.
Definition: buddy.h:33
unsigned char base_mem[1U<< B_TOTAL_EXP]
The memory buffer served to the model.
Definition: buddy.h:35