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

Side by Side Diff: chrome/renderer/chrome_render_thread_observer.cc

Issue 2566043004: Add renderer memory metrics (Closed)
Patch Set: Created 4 years 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/renderer/chrome_render_thread_observer.h" 5 #include "chrome/renderer/chrome_render_thread_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) 283 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
284 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, 284 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules,
285 OnSetContentSettingRules) 285 OnSetContentSettingRules)
286 IPC_MESSAGE_UNHANDLED(handled = false) 286 IPC_MESSAGE_UNHANDLED(handled = false)
287 IPC_END_MESSAGE_MAP() 287 IPC_END_MESSAGE_MAP()
288 return handled; 288 return handled;
289 } 289 }
290 290
291 void ChromeRenderThreadObserver::OnRenderProcessShutdown() { 291 void ChromeRenderThreadObserver::OnRenderProcessShutdown() {
292 visited_link_slave_.reset(); 292 visited_link_slave_.reset();
293
294 content::RendererMemoryMetrics memory_metrics;
295 content::RenderThread::Get()->GetRendererMemoryMetrics(&memory_metrics);
296 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.Shutdown.PartitionAllocKB",
297 memory_metrics.partition_alloc_kb);
298 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.Shutdown.BlinkGCKB",
299 memory_metrics.blink_gc_kb);
300 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.Shutdown.MallocMB",
301 memory_metrics.malloc_mb);
302 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.Shutdown.DiscardableKB",
303 memory_metrics.discardable_kb);
304 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.Shutdown.V8MainThreadIsolateMB",
305 memory_metrics.v8_main_thread_isolate_mb);
306 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.Shutdown.TotalAllocatedMB",
307 memory_metrics.total_allocated_mb);
308 UMA_HISTOGRAM_MEMORY_MB(
haraken 2016/12/12 11:32:27 I might prefer unifying the units to MB though. It
keishi 2017/01/06 11:08:27 Unified new UMAs to MB. Leaving the existing Purge
309 "Renderer.Memory.Shutdown.NonDiscardableTotalAllocatedMB",
310 memory_metrics.non_discardable_total_allocated_mb);
293 } 311 }
294 312
295 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized( 313 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized(
296 const std::string& trial_name, 314 const std::string& trial_name,
297 const std::string& group_name) { 315 const std::string& group_name) {
298 chrome::mojom::FieldTrialRecorderPtr field_trial_recorder; 316 chrome::mojom::FieldTrialRecorderPtr field_trial_recorder;
299 content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface( 317 content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface(
300 &field_trial_recorder); 318 &field_trial_recorder);
301 field_trial_recorder->FieldTrialActivated(trial_name); 319 field_trial_recorder->FieldTrialActivated(trial_name);
302 } 320 }
(...skipping 11 matching lines...) Expand all
314 void ChromeRenderThreadObserver::OnSetFieldTrialGroup( 332 void ChromeRenderThreadObserver::OnSetFieldTrialGroup(
315 const std::string& trial_name, 333 const std::string& trial_name,
316 const std::string& group_name) { 334 const std::string& group_name) {
317 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name); 335 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name);
318 } 336 }
319 337
320 const RendererContentSettingRules* 338 const RendererContentSettingRules*
321 ChromeRenderThreadObserver::content_setting_rules() const { 339 ChromeRenderThreadObserver::content_setting_rules() const {
322 return &content_setting_rules_; 340 return &content_setting_rules_;
323 } 341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698