Merge pull request #10680 from electron/idlewakeups-windows

Don't call GetIdleWakeupsPerSecond on Win
This commit is contained in:
Felix Rieseberg 2017-10-03 22:04:55 -07:00 committed by GitHub
commit a337b12877
2 changed files with 9 additions and 1 deletions

View file

@ -188,7 +188,14 @@ v8::Local<v8::Value> AtomBindings::GetCPUUsage(v8::Isolate* isolate) {
int processor_count = base::SysInfo::NumberOfProcessors();
dict.Set("percentCPUUsage",
metrics_->GetPlatformIndependentCPUUsage() / processor_count);
// NB: This will throw NOTIMPLEMENTED() on Windows
// For backwards compatibility, we'll return 0
#if !defined(OS_WIN)
dict.Set("idleWakeupsPerSecond", metrics_->GetIdleWakeupsPerSecond());
#else
dict.Set("idleWakeupsPerSecond", 0);
#endif
return dict.GetHandle();
}

View file

@ -3,4 +3,5 @@
* `percentCPUUsage` Number - Percentage of CPU used since the last call to getCPUUsage.
First call returns 0.
* `idleWakeupsPerSecond` Number - The number of average idle cpu wakeups per second
since the last call to getCPUUsage. First call returns 0.
since the last call to getCPUUsage. First call returns 0. Will always return 0 on
Windows.