This commit is contained in:
Paul Betts 2016-05-13 18:01:29 -07:00
parent cd7bc0e50c
commit 60bc2acd6c

View file

@ -18,19 +18,23 @@ v8::Local<v8::Value> GetProcessMemoryInfo(v8::Isolate* isolate) {
std::unique_ptr<base::ProcessMetrics> metrics(
base::ProcessMetrics::CreateCurrentProcessMetrics());
dict.Set("workingSetSize", (double)(metrics->GetWorkingSetSize() >> 10));
dict.Set("peakWorkingSetSize", (double)(metrics->GetPeakWorkingSetSize() >> 10));
dict.Set("workingSetSize",
static_cast<double>(metrics->GetWorkingSetSize() >> 10));
dict.Set("peakWorkingSetSize",
static_cast<double>(metrics->GetPeakWorkingSetSize() >> 10));
size_t private_bytes, shared_bytes;
if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) {
dict.Set("privateBytes", (double)(private_bytes >> 10));
dict.Set("sharedBytes", (double)(shared_bytes >> 10));
dict.Set("privateBytes", static_cast<double>(private_bytes >> 10));
dict.Set("sharedBytes", static_cast<double>(shared_bytes >> 10));
}
return dict.GetHandle();
}
v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate, mate::Arguments* args) {
v8::Local<v8::Value> GetSystemMemoryInfo(
v8::Isolate* isolate,
mate::Arguments* args) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
base::SystemMemoryInfoKB memInfo;