252
87
VALGRIND_PMC_EMIT_LOG("PMREORDER_TAG.END");
88
89
header->counter = 0;
90
for (uint8_t i = 0; i < 10; i++) {
91
header->counter++;
92
if (rand() % 2 == 0) {
93
snprintf(records[i].name, 63,
94
"record #%u", i + 1);
95
pop.persist(records[i].name, 63); // flush
96
records[i].valid = 2;
97
} else
98
records[i].valid = 1;
99
pop.persist(&(records[i].valid), 1); // flush
100
}
101
pop.persist(&(header->counter), 4); // flush
102
103
pop.close();
104
return 0;
105 }
Listing 12-39. Reading the data structure written by Listing 12-38 to persistent
memory
33 #include
34 #include
35 #include
36
37 using namespace std;
38 namespace pobj = pmem::obj;
39
40 struct header_t {
41
uint32_t counter;
42
uint8_t reserved[60];
43 };
Chapter 12 Debugging persistent MeMory appliCations
Précédent

- 276/457

Suivant