make mappingdensity provider write traces to process-specific files
Summary: make mappingdensity provider write traces to process-specific files
#include <string>
#include <fstream>
#include <regex>
+#include <sstream>
#include <sys/mman.h>
#include <sys/types.h>
#include <system_error>
@@ -46,7 +47,9 @@ void dumpMappingDensities(
size_t const pageSize = sysconf(_SC_PAGESIZE);
std::vector<uint8_t> buf(maxSize / pageSize + 1);
- std::ofstream os(outFile + "/mincore_" + dumpName);
+ std::stringstream ss;
+ ss << outFile << "/mincore_" << dumpName << "_" << getpid();
+ std::ofstream os(ss.str());
for (struct memorymap_vma const* vma = memorymap_first_vma(maps);
vma != nullptr;
vma = memorymap_vma_next(vma)) {
