Commit 15f018ec authored by chrisha's avatar chrisha Committed by Commit bot

Remove unused metric from memory_pressurecomponent.

BUG=643523
TBR=georgesak@chromium.org

Review-Url: https://codereview.chromium.org/2317083002
Cr-Commit-Position: refs/heads/master@{#417050}
parent 211bb9dc
...@@ -50,37 +50,6 @@ MemoryPressureLevel MemoryPressureLevelFromUmaEnumValue( ...@@ -50,37 +50,6 @@ MemoryPressureLevel MemoryPressureLevelFromUmaEnumValue(
return MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE; return MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
} }
// Converts a pressure state change to an UMA enumeration value.
MemoryPressureLevelChangeUMA MemoryPressureLevelChangeToUmaEnumValue(
MemoryPressureLevel old_level,
MemoryPressureLevel new_level) {
switch (old_level) {
case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: {
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_NONE_TO_MODERATE;
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_NONE_TO_CRITICAL;
break; // Should never happen; handled by the NOTREACHED below.
}
case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: {
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_MODERATE_TO_NONE;
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_MODERATE_TO_CRITICAL;
break; // Should never happen; handled by the NOTREACHED below.
}
case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: {
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_CRITICAL_TO_MODERATE;
if (new_level == MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE)
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_CRITICAL_TO_MODERATE;
break; // Should never happen; handled by the NOTREACHED below.
}
}
NOTREACHED();
return UMA_MEMORY_PRESSURE_LEVEL_CHANGE_NONE_TO_MODERATE;
}
} // namespace } // namespace
MemoryPressureStatsCollector::MemoryPressureStatsCollector( MemoryPressureStatsCollector::MemoryPressureStatsCollector(
...@@ -149,10 +118,7 @@ void MemoryPressureStatsCollector::ReportCumulativeTime( ...@@ -149,10 +118,7 @@ void MemoryPressureStatsCollector::ReportCumulativeTime(
void MemoryPressureStatsCollector::ReportLevelChange( void MemoryPressureStatsCollector::ReportLevelChange(
MemoryPressureLevel old_pressure_level, MemoryPressureLevel old_pressure_level,
MemoryPressureLevel new_pressure_level) { MemoryPressureLevel new_pressure_level) {
UMA_HISTOGRAM_ENUMERATION("Memory.PressureLevelChange", // TODO(chrisha): Report Memory.PressureLevelChange when this code is in use.
MemoryPressureLevelChangeToUmaEnumValue(
old_pressure_level, new_pressure_level),
UMA_MEMORY_PRESSURE_LEVEL_CHANGE_COUNT);
} }
} // namespace memory_pressure } // namespace memory_pressure
...@@ -14,7 +14,6 @@ namespace { ...@@ -14,7 +14,6 @@ namespace {
// Histogram names. // Histogram names.
const char kPressureLevel[] = "Memory.PressureLevel"; const char kPressureLevel[] = "Memory.PressureLevel";
const char kPressureLevelChange[] = "Memory.PressureLevelChange";
} // namespace } // namespace
...@@ -81,7 +80,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) { ...@@ -81,7 +80,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) {
// Upon construction no statistics should yet have been reported. // Upon construction no statistics should yet have been reported.
ExpectAccumulated(0, 0, 0); ExpectAccumulated(0, 0, 0);
ExpectReported(0, 0, 0); ExpectReported(0, 0, 0);
histograms_.ExpectTotalCount(kPressureLevelChange, 0);
// A first call should not invoke any reporting functions, but it should // A first call should not invoke any reporting functions, but it should
// modify member variables. // modify member variables.
...@@ -93,7 +91,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) { ...@@ -93,7 +91,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) {
EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time()); EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time());
ExpectAccumulated(0, 0, 0); ExpectAccumulated(0, 0, 0);
ExpectReported(0, 0, 0); ExpectReported(0, 0, 0);
histograms_.ExpectTotalCount(kPressureLevelChange, 0);
// A subsequent call with the same pressure level should increment the // A subsequent call with the same pressure level should increment the
// cumulative time but not make a report, as less than one second of time // cumulative time but not make a report, as less than one second of time
...@@ -106,7 +103,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) { ...@@ -106,7 +103,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) {
EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time()); EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time());
ExpectAccumulated(500, 0, 0); ExpectAccumulated(500, 0, 0);
ExpectReported(0, 0, 0); ExpectReported(0, 0, 0);
histograms_.ExpectTotalCount(kPressureLevelChange, 0);
// Yet another call and this time a report should be made, as one second // Yet another call and this time a report should be made, as one second
// of time has been accumulated. 500ms should remain unreported. // of time has been accumulated. 500ms should remain unreported.
...@@ -118,7 +114,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) { ...@@ -118,7 +114,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) {
EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time()); EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time());
ExpectAccumulated(500, 0, 0); ExpectAccumulated(500, 0, 0);
ExpectReported(1, 0, 0); ExpectReported(1, 0, 0);
histograms_.ExpectTotalCount(kPressureLevelChange, 0);
// A subsequent call with a different pressure level should increment the // A subsequent call with a different pressure level should increment the
// cumulative time and make several reports. // cumulative time and make several reports.
...@@ -130,10 +125,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) { ...@@ -130,10 +125,6 @@ TEST_F(MemoryPressureStatsCollectorTest, EndToEnd) {
EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time()); EXPECT_EQ(tick_clock_.NowTicks(), collector_.last_update_time());
ExpectAccumulated(500, 250, 0); ExpectAccumulated(500, 250, 0);
ExpectReported(1, 2, 0); ExpectReported(1, 2, 0);
histograms_.ExpectBucketCount(
kPressureLevelChange, UMA_MEMORY_PRESSURE_LEVEL_CHANGE_NONE_TO_MODERATE,
1);
histograms_.ExpectTotalCount(kPressureLevelChange, 1);
} }
} // namespace memory_pressure } // namespace memory_pressure
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