Commit b2771571 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Orderfile: remove unused stability calculations.

Since we are now creating orderfiles by running across multiple
benchmarks, the stability computations don't make much sense as, for
example, we don't expect the startup symbols from two different
benchmarks to necessarily be similar.

Bug: 865983
Change-Id: I11f756a69bf160e9dce293e3c1cd05003264da0f
Reviewed-on: https://chromium-review.googlesource.com/1152739Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579351}
parent 50f29a60
......@@ -46,12 +46,6 @@ class PhasedAnalyzer(object):
It maintains common data such as symbol table information to make analysis
more convenient.
"""
# These figures are taken from running memory and speedometer telemetry
# benchmarks, and are still subject to change as of 2018-01-24.
STARTUP_STABILITY_THRESHOLD = 1.5
COMMON_STABILITY_THRESHOLD = 1.75
INTERACTION_STABILITY_THRESHOLD = 2.5
# The process name of the browser as used in the profile dumps.
BROWSER = 'browser'
......@@ -70,99 +64,6 @@ class PhasedAnalyzer(object):
self._annotated_offsets = None
self._process_list = None
def IsStableProfile(self):
"""Verify that the profiling has been stable.
See ComputeStability for details.
Returns:
True if the profile was stable as described above.
"""
(startup_stability, common_stability,
interaction_stability) = [s[0] for s in self.ComputeStability()]
stable = True
if startup_stability > self.STARTUP_STABILITY_THRESHOLD:
logging.error('Startup unstable: %.3f', startup_stability)
stable = False
if common_stability > self.COMMON_STABILITY_THRESHOLD:
logging.error('Common unstable: %.3f', common_stability)
stable = False
if interaction_stability > self.INTERACTION_STABILITY_THRESHOLD:
logging.error('Interaction unstable: %.3f', interaction_stability)
stable = False
return stable
def ComputeStability(self):
"""Compute heuristic phase stability metrics.
This computes the ratio in size of symbols between the union and
intersection of all orderfile phases. Intuitively if this ratio is not too
large it means that the profiling phases are stable with respect to the code
they cover.
Returns:
((float, int), (float, int), (float, int)) A heuristic stability metric
for startup, common and interaction orderfile phases,
respectively. Each metric is a pair of the ratio of symbol sizes as
described above, and the size of the intersection.
"""
(startup_intersection, startup_union,
common_intersection, common_union,
interaction_intersection, interaction_union,
_, _) = self.GetCombinedOffsets()
startup_intersection_size = self._processor.OffsetsPrimarySize(
startup_intersection)
common_intersection_size = self._processor.OffsetsPrimarySize(
common_intersection)
interaction_intersection_size = self._processor.OffsetsPrimarySize(
interaction_intersection)
startup_stability = self._SafeDiv(
self._processor.OffsetsPrimarySize(startup_union),
startup_intersection_size)
common_stability = self._SafeDiv(
self._processor.OffsetsPrimarySize(common_union),
common_intersection_size)
interaction_stability = self._SafeDiv(
self._processor.OffsetsPrimarySize(interaction_union),
interaction_intersection_size)
return ((startup_stability, startup_intersection_size),
(common_stability, common_intersection_size),
(interaction_stability, interaction_intersection_size))
def GetCombinedOffsets(self):
"""Get offsets for the union and intersection of orderfile phases.
Returns:
([int] * 8) For each of startup, common, interaction and all, respectively
the intersection and union offsets, in that order.
"""
phase_offsets = self._GetOrderfilePhaseOffsets()
assert phase_offsets
if len(phase_offsets) == 1:
logging.error('Only one run set, the combined offset files will all be '
'identical')
startup_union = set(phase_offsets[0].startup)
startup_intersection = set(phase_offsets[0].startup)
common_union = set(phase_offsets[0].common)
common_intersection = set(phase_offsets[0].common)
interaction_union = set(phase_offsets[0].interaction)
interaction_intersection = set(phase_offsets[0].interaction)
for offsets in phase_offsets[1:]:
startup_union |= set(offsets.startup)
startup_intersection &= set(offsets.startup)
common_union |= set(offsets.common)
common_intersection &= set(offsets.common)
interaction_union |= set(offsets.interaction)
interaction_intersection &= set(offsets.interaction)
return (startup_intersection, startup_union,
common_intersection, common_union,
interaction_intersection, interaction_union,
(startup_union & common_union & interaction_union),
(startup_union | common_union | interaction_union))
def GetOffsetsForMemoryFootprint(self):
"""Get offsets organized to minimize the memory footprint.
......@@ -367,12 +268,6 @@ class PhasedAnalyzer(object):
return self._phase_offsets
@classmethod
def _SafeDiv(cls, a, b):
if not b:
return None
return float(a) / b
def _CreateArgumentParser():
parser = argparse.ArgumentParser(
......
......@@ -59,32 +59,6 @@ class PhasedOrderfileTestCase(unittest.TestCase):
def setUp(self):
self._file_counter = 0
def testProfileStability(self):
symbols = [SimpleTestSymbol(str(i), i, 10)
for i in xrange(20)]
phaser = phased_orderfile.PhasedAnalyzer(
None, TestSymbolOffsetProcessor(symbols))
opo = lambda s, c, i: phased_orderfile.OrderfilePhaseOffsets(
startup=s, common=c, interaction=i)
phaser._phase_offsets = [opo(range(5), range(6, 10), range(11,15)),
opo(range(4), range(6, 10), range(18, 20))]
self.assertEquals((1.25, 1, None),
tuple(s[0] for s in phaser.ComputeStability()))
def testIsStable(self):
symbols = [SimpleTestSymbol(str(i), i, 10)
for i in xrange(20)]
phaser = phased_orderfile.PhasedAnalyzer(
None, TestSymbolOffsetProcessor(symbols))
opo = lambda s, c, i: phased_orderfile.OrderfilePhaseOffsets(
startup=s, common=c, interaction=i)
phaser._phase_offsets = [opo(range(5), range(6, 10), range(11,15)),
opo(range(4), range(6, 10), range(18, 20))]
phaser.STARTUP_STABILITY_THRESHOLD = 1.1
self.assertFalse(phaser.IsStableProfile())
phaser.STARTUP_STABILITY_THRESHOLD = 1.5
self.assertTrue(phaser.IsStableProfile())
def testGetOrderfilePhaseOffsets(self):
mgr = TestProfileManager({
ProfileFile(0, 0): [12, 21, -1, 33],
......
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