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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2899683002: Reenable Purge+Suspend Memory Growth metrics. (Closed)
Patch Set: Fixed. Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index f1130851bcb1adc31dd82aed3e7ee0f58d140706..1add34edebdbe5386cff2cce2030da02eb9af65f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -23,6 +23,7 @@
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/path_service.h"
#include "base/process/process_metrics.h"
@@ -1695,6 +1696,21 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
return;
purge_and_suspend_memory_metrics_ = memory_metrics;
+ GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
+ base::Unretained(this), "30min", process_foregrounded_count_),
+ base::TimeDelta::FromMinutes(30));
+ GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
+ base::Unretained(this), "60min", process_foregrounded_count_),
+ base::TimeDelta::FromMinutes(60));
+ GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
+ base::Unretained(this), "90min", process_foregrounded_count_),
+ base::TimeDelta::FromMinutes(90));
}
// TODO(tasak): Replace the following GetMallocUsage() with memory-infra
@@ -1796,12 +1812,12 @@ bool RenderThreadImpl::GetRendererMemoryMetrics(
? current.allocator - previous.allocator \
: 0)
-#define UMA_HISTOGRAM_MEMORY_GROWTH_KB(basename, suffix, memory_usage) \
- { \
- std::string histogram_name = \
- base::StringPrintf("%s.%s", basename, suffix); \
- UMA_HISTOGRAM_MEMORY_KB(histogram_name, memory_usage); \
- }
+static void RecordPurgeAndSuspendMemoryGrowthKB(const char* basename,
+ const char* suffix,
+ int memory_usage) {
+ std::string histogram_name = base::StringPrintf("%s.%s", basename, suffix);
+ base::UmaHistogramMemoryKB(histogram_name, memory_usage);
+}
void RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics(
const char* suffix,
@@ -1816,29 +1832,29 @@ void RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics(
if (!GetRendererMemoryMetrics(&memory_metrics))
return;
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.PartitionAllocKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
partition_alloc_kb));
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.BlinkGCKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
blink_gc_kb));
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.MallocKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
malloc_mb) *
1024);
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.DiscardableKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
discardable_kb));
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.V8MainThreadIsolateKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
v8_main_thread_isolate_mb) *
1024);
- UMA_HISTOGRAM_MEMORY_GROWTH_KB(
+ RecordPurgeAndSuspendMemoryGrowthKB(
"PurgeAndSuspend.Experimental.MemoryGrowth.TotalAllocatedKB", suffix,
GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_,
total_allocated_mb) *
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698