MCPcopy Create free account
hub / github.com/3rdparty/libprocess / create

Method create

src/memory_profiler.cpp:627–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625
626
627Try<MemoryProfiler::DiskArtifact> MemoryProfiler::DiskArtifact::create(
628 const string& filename,
629 time_t timestamp,
630 std::function<Try<Nothing>(const string&)> generator)
631{
632 Try<Path> tmpdir = getTemporaryDirectoryPath();
633 if (tmpdir.isError()) {
634 return Error("Could not determine target path: " + tmpdir.error());
635 }
636
637 const string path = path::join(tmpdir.get(), filename);
638
639 Try<Nothing> result = generator(path);
640
641 if (result.isError()) {
642 // The old file might still be fine on disk, but there's no good way to
643 // verify this hence we assume that the error rendered it unusable.
644 return Error("Failed to create artifact: " + result.error());
645 }
646
647 return MemoryProfiler::DiskArtifact(path, timestamp);
648}
649
650
651MemoryProfiler::MemoryProfiler(const Option<string>& _authenticationRealm)

Callers

nothing calls this directly

Calls 3

DiskArtifactClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected