226
To conclude this section, we fix the code and rerun the analysis with Persistence
Inspector. The code in Listing 12-19 adds the necessary flushes to Listing 12-14.
Listing 12-19. Example of writing to persistent memory with a write
dependency. The code flushes both writes
33 #include
34 #include
35 #include
36 #include
37 #include
38 #include
39
40 void flush(const void *addr, size_t len) {
41
uintptr_t flush_align = 64, uptr;
42
for (uptr = (uintptr_t)addr & ~(flush_align - 1);
43
uptr < (uintptr_t)addr + len;
44
uptr += flush_align)
Figure 12-4. GUI of Intel Inspector showing results for Listing 12-20 (diagnostic #2)
Chapter 12 Debugging persistent MeMory appliCations
To conclude this section, we fix the code and rerun the analysis with Persistence
Inspector. The code in Listing 12-19 adds the necessary flushes to Listing 12-14.
Listing 12-19. Example of writing to persistent memory with a write
dependency. The code flushes both writes
33 #include
34 #include
35 #include
36 #include
37 #include
38 #include
39
40 void flush(const void *addr, size_t len) {
41
uintptr_t flush_align = 64, uptr;
42
for (uptr = (uintptr_t)addr & ~(flush_align - 1);
43
uptr < (uintptr_t)addr + len;
44
uptr += flush_align)
Figure 12-4. GUI of Intel Inspector showing results for Listing 12-20 (diagnostic #2)
Chapter 12 Debugging persistent MeMory appliCations
