MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / postCheckpoint

Method postCheckpoint

src/dmtcpworker.cpp:456–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456void
457DmtcpWorker::postCheckpoint()
458{
459 // Send ckpt maps to coordinator.
460 string workerPath("/worker/" + ProcessInfo::instance().upidStr());
461
462 jalib::JAllocArena *arenas;
463 int numArenas = 0;
464 {
465 jalib::JAlloc::getAllocArenas(&arenas, &numArenas);
466 ostringstream o;
467 for (int i = 0; i < numArenas; i++) {
468 if (arenas[i].startAddr != NULL) {
469 o << std::hex << (uint64_t) arenas[i].startAddr
470 << "-" << (uint64_t) arenas[i].endAddr
471 << " " << ((uint64_t)arenas[i].endAddr - (uint64_t)arenas[i].startAddr) << "\n";
472 }
473 }
474
475 kvdb::set(workerPath, "ProcSelfMaps_JAllocArenas", o.str());
476 }
477
478#ifndef FORKED_CHECKPOINTING
479 {
480 kvdb::set(
481 workerPath,
482 "ProcSelfMaps_Ckpt",
483 procSelfMaps->getData());
484 }
485#endif
486
487 WorkerState::setCurrentState(WorkerState::CHECKPOINTED);
488
489 // TODO: Merge this barrier with the previous `sendCkptFilename` msg.
490 JTRACE("Waiting for Write-Ckpt barrier");
491 CoordinatorAPI::waitForBarrier("DMT:WriteCkpt");
492
493 // NOTE: If FORKED_CHECKPOINTING, the grandchild may still be checkpointing.
494 // Grandchild process will do renaming and inform coordinator.
495 if (getenv(ENV_VAR_FORKED_CKPT) == NULL) {
496 /* Now that temp checkpoint file is complete, rename it over old permanent
497 * checkpoint file. Uses rename() syscall, which doesn't change i-nodes.
498 * So, gzip process can continue to write to file even after renaming.
499 */
500 JASSERT(rename(ProcessInfo::instance().getTempCkptFilename().c_str(),
501 ProcessInfo::instance().getCkptFilename().c_str()) == 0);
502 CoordinatorAPI::sendCkptFilename();
503 } else { // else FORKED CHECKPOINTING. Write temp name; grandchild not done.
504 string ckptFilename = ProcessInfo::instance().getCkptFilename();
505 ProcessInfo::instance().setCkptFilename(
506 ProcessInfo::instance().getTempCkptFilename().c_str());
507 CoordinatorAPI::sendCkptFilename();
508 ProcessInfo::instance().setCkptFilename(ckptFilename.c_str());
509 }
510
511 if (exitAfterCkpt) {
512 JTRACE("Asked to exit after checkpoint. Exiting!");
513 _exit(0);

Callers

nothing calls this directly

Calls 10

setCurrentStateFunction · 0.85
waitForBarrierFunction · 0.85
sendCkptFilenameFunction · 0.85
eventHookFunction · 0.85
sendMsgToCoordinatorFunction · 0.85
getDataMethod · 0.80
getTempCkptFilenameMethod · 0.80
setCkptFilenameMethod · 0.80
setFunction · 0.70
strMethod · 0.45

Tested by

no test coverage detected