343 {
344
346
347
348 result["vmem"] = result["rss"] = result["pss"] = result["swap"] = 0;
349
350
351 static const std::string fileName = "/proc/self/smaps";
352 std::ifstream smaps_file{fileName};
353
355
356
357 while (smaps_file) {
358
360 smaps_file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
361
362 if(smaps_file) {
363 if (key == "Size:") {
364 result[
"vmem"] += std::stol(value);
365 }
366 if (key == "Rss:") {
367 result[
"rss"] += std::stol(value);
368 }
369 if (key == "Pss:") {
370 result[
"pss"] += std::stol(value);
371 }
372 if (key == "Swap:") {
373 result[
"swap"] += std::stol(value);
374 }
375 }
376 }
377
379}
std::map< std::string, int64_t > MemoryMap_t