| 454 | } |
| 455 | |
| 456 | void |
| 457 | DmtcpWorker::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); |
nothing calls this directly
no test coverage detected