Commit 49692720 authored by bashi's avatar bashi Committed by Commit bot

Add MemoryPurgeController.ReclaimedPartitionAllocInactiveTab

This UMA reports how much memory did MemoryPurgeController reclaim.

BUG=519146

Review URL: https://codereview.chromium.org/1460603002

Cr-Commit-Position: refs/heads/master@{#361284}
parent a92fdd6a
...@@ -45,7 +45,17 @@ void MemoryPurgeController::pageBecameInactive() ...@@ -45,7 +45,17 @@ void MemoryPurgeController::pageBecameInactive()
void MemoryPurgeController::pageInactiveTask(Timer<MemoryPurgeController>*) void MemoryPurgeController::pageInactiveTask(Timer<MemoryPurgeController>*)
{ {
static const size_t maxSizeInKB = 10 * 1024;
size_t totalSizeBefore = WTF::Partitions::totalSizeOfCommittedPages();
purgeMemory(MemoryPurgeMode::InactiveTab); purgeMemory(MemoryPurgeMode::InactiveTab);
size_t totalSizeAfter = WTF::Partitions::totalSizeOfCommittedPages();
if (totalSizeAfter >= totalSizeBefore)
return;
size_t reclaimedInKB = (totalSizeBefore - totalSizeAfter) / 1024 + 1;
if (reclaimedInKB >= maxSizeInKB)
reclaimedInKB = maxSizeInKB - 1;
Platform::current()->histogramCustomCounts("MemoryPurgeController.ReclaimedPartitionAllocInactiveTab", reclaimedInKB, 1, maxSizeInKB, 50);
} }
void MemoryPurgeController::purgeMemory(MemoryPurgeMode purgeMode) void MemoryPurgeController::purgeMemory(MemoryPurgeMode purgeMode)
......
...@@ -20129,6 +20129,12 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -20129,6 +20129,12 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="MemoryPurgeController.ReclaimedPartitionAllocInactiveTab"
units="KB">
<owner>bashi@chromium.org</owner>
<summary>The amount of reclaimed memory after a tab became inactive.</summary>
</histogram>
<histogram name="MemoryWarning.EvictedTabTimeSinceActive" units="ms"> <histogram name="MemoryWarning.EvictedTabTimeSinceActive" units="ms">
<owner>lliabraa@chromium.org</owner> <owner>lliabraa@chromium.org</owner>
<summary> <summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment