mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Implement virtual memory computation in caffe2_benchmark binary (#24144)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/24144 Implement virtual memory computation in caffe2_benchmark binary in windows. Reviewed By: hl475 Differential Revision: D16752250 fbshipit-source-id: aceb13ddd507aa2e6bad07de28d79776e6ee517c
This commit is contained in:
committed by
Facebook Github Bot
parent
90f3f9d9aa
commit
ceb9a573d9
@ -18,6 +18,10 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#endif
|
||||
|
||||
#include <binaries/benchmark_helper.h>
|
||||
#include "caffe2/core/blob_serialization.h"
|
||||
@ -397,6 +401,11 @@ defined(TARGET_IPHONE_SIMULATOR)
|
||||
malloc_statistics_t stats = {0};
|
||||
malloc_zone_statistics(nullptr, &stats);
|
||||
return stats.size_allocated;
|
||||
#elif defined(_WIN32)
|
||||
PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||
GetProcessMemoryInfo(
|
||||
GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
|
||||
return pmc.PrivateUsage;
|
||||
#else
|
||||
struct mallinfo info = mallinfo();
|
||||
return info.uordblks;
|
||||
|
Reference in New Issue
Block a user