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

Side by Side Diff: chrome/browser/chromeos/memory/oom_priority_manager.cc

Issue 484603006: Add LOCAL_ prefix to non-UMA histogram macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/memory/oom_priority_manager.h" 5 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 using base::TimeDelta; 51 using base::TimeDelta;
52 using base::TimeTicks; 52 using base::TimeTicks;
53 using content::BrowserThread; 53 using content::BrowserThread;
54 using content::WebContents; 54 using content::WebContents;
55 55
56 namespace chromeos { 56 namespace chromeos {
57 57
58 namespace { 58 namespace {
59 59
60 // Record a size in megabytes, over a potential interval up to 32 GB. 60 // Record a size in megabytes, over a potential interval up to 32 GB.
61 #define HISTOGRAM_MEGABYTES(name, sample) \ 61 #define UMA_HISTOGRAM_MEGABYTES(name, sample) \
62 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 32768, 50) 62 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 32768, 50)
63 63
64 // The default interval in seconds after which to adjust the oom_score_adj 64 // The default interval in seconds after which to adjust the oom_score_adj
65 // value. 65 // value.
66 const int kAdjustmentIntervalSeconds = 10; 66 const int kAdjustmentIntervalSeconds = 10;
67 67
68 // For each period of this length we record a statistic to indicate whether 68 // For each period of this length we record a statistic to indicate whether
69 // or not the user experienced a low memory event. If you change this interval 69 // or not the user experienced a low memory event. If you change this interval
70 // you must replace Tabs.Discard.DiscardInLastMinute with a new statistic. 70 // you must replace Tabs.Discard.DiscardInLastMinute with a new statistic.
71 const int kRecentTabDiscardIntervalSeconds = 60; 71 const int kRecentTabDiscardIntervalSeconds = 60;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 UMA_HISTOGRAM_CUSTOM_COUNTS( 349 UMA_HISTOGRAM_CUSTOM_COUNTS(
350 "Tabs.Discard.IntervalTime2", interval_ms, 100, 100000 * 1000, 50); 350 "Tabs.Discard.IntervalTime2", interval_ms, 100, 100000 * 1000, 50);
351 } 351 }
352 // Record Chrome's concept of system memory usage at the time of the discard. 352 // Record Chrome's concept of system memory usage at the time of the discard.
353 base::SystemMemoryInfoKB memory; 353 base::SystemMemoryInfoKB memory;
354 if (base::GetSystemMemoryInfo(&memory)) { 354 if (base::GetSystemMemoryInfo(&memory)) {
355 // TODO(jamescook): Remove this after R25 is deployed to stable. It does 355 // TODO(jamescook): Remove this after R25 is deployed to stable. It does
356 // not have sufficient resolution in the 2-4 GB range and does not properly 356 // not have sufficient resolution in the 2-4 GB range and does not properly
357 // account for graphics memory on ARM. Replace with MemAllocatedMB below. 357 // account for graphics memory on ARM. Replace with MemAllocatedMB below.
358 int mem_anonymous_mb = (memory.active_anon + memory.inactive_anon) / 1024; 358 int mem_anonymous_mb = (memory.active_anon + memory.inactive_anon) / 1024;
359 HISTOGRAM_MEGABYTES("Tabs.Discard.MemAnonymousMB", mem_anonymous_mb); 359 UMA_HISTOGRAM_MEGABYTES("Tabs.Discard.MemAnonymousMB", mem_anonymous_mb);
360 360
361 // Record graphics GEM object size in a histogram with 50 MB buckets. 361 // Record graphics GEM object size in a histogram with 50 MB buckets.
362 int mem_graphics_gem_mb = 0; 362 int mem_graphics_gem_mb = 0;
363 if (memory.gem_size != -1) 363 if (memory.gem_size != -1)
364 mem_graphics_gem_mb = memory.gem_size / 1024 / 1024; 364 mem_graphics_gem_mb = memory.gem_size / 1024 / 1024;
365 RecordLinearHistogram( 365 RecordLinearHistogram(
366 "Tabs.Discard.MemGraphicsMB", mem_graphics_gem_mb, 2500, 50); 366 "Tabs.Discard.MemGraphicsMB", mem_graphics_gem_mb, 2500, 50);
367 367
368 // Record shared memory (used by renderer/GPU buffers). 368 // Record shared memory (used by renderer/GPU buffers).
369 int mem_shmem_mb = memory.shmem / 1024; 369 int mem_shmem_mb = memory.shmem / 1024;
370 RecordLinearHistogram("Tabs.Discard.MemShmemMB", mem_shmem_mb, 2500, 50); 370 RecordLinearHistogram("Tabs.Discard.MemShmemMB", mem_shmem_mb, 2500, 50);
371 371
372 // On Intel, graphics objects are in anonymous pages, but on ARM they are 372 // On Intel, graphics objects are in anonymous pages, but on ARM they are
373 // not. For a total "allocated count" add in graphics pages on ARM. 373 // not. For a total "allocated count" add in graphics pages on ARM.
374 int mem_allocated_mb = mem_anonymous_mb; 374 int mem_allocated_mb = mem_anonymous_mb;
375 #if defined(ARCH_CPU_ARM_FAMILY) 375 #if defined(ARCH_CPU_ARM_FAMILY)
376 mem_allocated_mb += mem_graphics_gem_mb; 376 mem_allocated_mb += mem_graphics_gem_mb;
377 #endif 377 #endif
378 UMA_HISTOGRAM_CUSTOM_COUNTS( 378 UMA_HISTOGRAM_CUSTOM_COUNTS(
379 "Tabs.Discard.MemAllocatedMB", mem_allocated_mb, 256, 32768, 50); 379 "Tabs.Discard.MemAllocatedMB", mem_allocated_mb, 256, 32768, 50);
380 380
381 int mem_available_mb = 381 int mem_available_mb =
382 (memory.active_file + memory.inactive_file + memory.free) / 1024; 382 (memory.active_file + memory.inactive_file + memory.free) / 1024;
383 HISTOGRAM_MEGABYTES("Tabs.Discard.MemAvailableMB", mem_available_mb); 383 UMA_HISTOGRAM_MEGABYTES("Tabs.Discard.MemAvailableMB", mem_available_mb);
384 } 384 }
385 // Set up to record the next interval. 385 // Set up to record the next interval.
386 last_discard_time_ = TimeTicks::Now(); 386 last_discard_time_ = TimeTicks::Now();
387 } 387 }
388 388
389 void OomPriorityManager::RecordRecentTabDiscard() { 389 void OomPriorityManager::RecordRecentTabDiscard() {
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
391 // If we change the interval we need to change the histogram name. 391 // If we change the interval we need to change the histogram name.
392 UMA_HISTOGRAM_BOOLEAN("Tabs.Discard.DiscardInLastMinute", 392 UMA_HISTOGRAM_BOOLEAN("Tabs.Discard.DiscardInLastMinute",
393 recent_tab_discard_); 393 recent_tab_discard_);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if (it == pid_to_oom_score_.end() || it->second != score) { 653 if (it == pid_to_oom_score_.end() || it->second != score) {
654 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore(*iterator, 654 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore(*iterator,
655 score); 655 score);
656 pid_to_oom_score_[*iterator] = score; 656 pid_to_oom_score_[*iterator] = score;
657 } 657 }
658 priority += priority_increment; 658 priority += priority_increment;
659 } 659 }
660 } 660 }
661 661
662 } // namespace chromeos 662 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_mac.mm ('k') | chrome/browser/extensions/external_registry_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698