Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: chrome/browser/memory/system_memory_stats_recorder_win.cc

Issue 1214803006: [Memory] Add system_memory_stats_recorder_win.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge issue in gyp and line wrapping. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/memory/system_memory_stats_recorder_linux.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/system_memory_stats_recorder_win.cc
diff --git a/chrome/browser/memory/system_memory_stats_recorder_win.cc b/chrome/browser/memory/system_memory_stats_recorder_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b90949869883e60f0579298ed4f865978aa95a07
--- /dev/null
+++ b/chrome/browser/memory/system_memory_stats_recorder_win.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/memory/system_memory_stats_recorder.h"
+
+#include <windows.h>
+
+#include "base/metrics/histogram_macros.h"
+#include "base/process/process_metrics.h"
+
+namespace memory {
+
+void RecordMemoryStats(RecordMemoryStatsType type) {
+ MEMORYSTATUSEX mem_status;
+ mem_status.dwLength = sizeof(mem_status);
+ if (!::GlobalMemoryStatusEx(&mem_status))
+ return;
+
+ switch (type) {
+ case RECORD_MEMORY_STATS_TAB_DISCARDED: {
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Stats.Win.MemoryLoad",
+ mem_status.dwMemoryLoad, 0, 100, 101);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPhys",
+ mem_status.ullTotalPhys);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPhys",
+ mem_status.ullAvailPhys);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPageFile",
+ mem_status.ullTotalPageFile);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPageFile",
+ mem_status.ullAvailPageFile);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalVirtual",
+ mem_status.ullTotalVirtual);
+ UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailVirtual",
+ mem_status.ullAvailVirtual);
+ break;
+ }
+ default:
+ NOTREACHED() << L"Received unexpected notification";
+ break;
+ }
+}
+
+} // namespace memory
« no previous file with comments | « chrome/browser/memory/system_memory_stats_recorder_linux.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698