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

Side by Side Diff: components/metrics/system_memory_stats_recorder_win.cc

Issue 1810583002: Fix memory values for the Win.* stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/system_memory_stats_recorder.h" 5 #include "components/metrics/system_memory_stats_recorder.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/process/process_metrics.h" 10 #include "base/process/process_metrics.h"
11 11
12 namespace metrics { 12 namespace metrics {
13 namespace {
14 enum { kMBytes = 1024 * 1024 };
15 }
13 16
14 void RecordMemoryStats(RecordMemoryStatsType type) { 17 void RecordMemoryStats(RecordMemoryStatsType type) {
15 MEMORYSTATUSEX mem_status; 18 MEMORYSTATUSEX mem_status;
16 mem_status.dwLength = sizeof(mem_status); 19 mem_status.dwLength = sizeof(mem_status);
17 if (!::GlobalMemoryStatusEx(&mem_status)) 20 if (!::GlobalMemoryStatusEx(&mem_status))
18 return; 21 return;
19 22
20 switch (type) { 23 switch (type) {
21 case RECORD_MEMORY_STATS_TAB_DISCARDED: { 24 case RECORD_MEMORY_STATS_TAB_DISCARDED: {
22 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Stats.Win.MemoryLoad", 25 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Stats.Win.MemoryLoad",
23 mem_status.dwMemoryLoad, 0, 100, 101); 26 mem_status.dwMemoryLoad, 0, 100, 101);
24 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPhys", 27 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPhys2",
25 mem_status.ullTotalPhys); 28 mem_status.ullTotalPhys / kMBytes);
26 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPhys", 29 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPhys2",
27 mem_status.ullAvailPhys); 30 mem_status.ullAvailPhys / kMBytes);
28 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPageFile", 31 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalPageFile2",
29 mem_status.ullTotalPageFile); 32 mem_status.ullTotalPageFile / kMBytes);
30 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPageFile", 33 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailPageFile2",
31 mem_status.ullAvailPageFile); 34 mem_status.ullAvailPageFile / kMBytes);
32 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalVirtual", 35 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.TotalVirtual2",
33 mem_status.ullTotalVirtual); 36 mem_status.ullTotalVirtual / kMBytes);
34 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailVirtual", 37 UMA_HISTOGRAM_LARGE_MEMORY_MB("Memory.Stats.Win.AvailVirtual2",
35 mem_status.ullAvailVirtual); 38 mem_status.ullAvailVirtual / kMBytes);
36 break; 39 break;
37 } 40 }
38 default: 41 default:
39 NOTREACHED() << L"Received unexpected notification"; 42 NOTREACHED() << L"Received unexpected notification";
40 break; 43 break;
41 } 44 }
42 } 45 }
43 46
44 } // namespace metrics 47 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698