Bug 915535 - Remove subtier tracking from build system. r=gps

It's currently inaccurate, and soon, the very notion of subtier is going to
blow away in the compile/binaries targets.
This commit is contained in:
Mike Hommey 2014-03-27 10:36:25 +09:00
Родитель b49534e0da
Коммит baec262951
4 изменённых файлов: 9 добавлений и 144 удалений

Просмотреть файл

@ -36,7 +36,7 @@ endif
# Main rules (export, compile, binaries, libs and tools) call recurse_* rules.
# This wrapping is only really useful for build status.
compile binaries libs export tools::
$(call BUILDSTATUS,TIER_START $@ $($@_subtiers))
$(call BUILDSTATUS,TIER_START $@)
+$(MAKE) recurse_$@
$(call BUILDSTATUS,TIER_FINISH $@)
@ -77,11 +77,9 @@ endif
# Subtier delimiter rules
$(addprefix subtiers/,$(addsuffix _start/$(CURRENT_TIER),$(CURRENT_SUBTIERS))): subtiers/%_start/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,subtiers/%_start))
$(call BUILDSTATUS,SUBTIER_START $(CURRENT_TIER) $*)
@$(STAMP_TOUCH)
$(addprefix subtiers/,$(addsuffix _finish/$(CURRENT_TIER),$(CURRENT_SUBTIERS))): subtiers/%_finish/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,subtiers/%_finish))
$(call BUILDSTATUS,SUBTIER_FINISH $(CURRENT_TIER) $*)
@$(STAMP_TOUCH)
$(addprefix subtiers/,$(addsuffix /$(CURRENT_TIER),$(CURRENT_SUBTIERS))): %/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,%))
@ -152,12 +150,10 @@ else
ifdef TIERS
libs export tools::
$(call BUILDSTATUS,TIER_START $@ $(filter-out $(if $(filter export,$@),,precompile),$(TIERS)))
$(call BUILDSTATUS,TIER_START $@)
$(foreach tier,$(TIERS), $(if $(filter-out libs_precompile tools_precompile,$@_$(tier)), \
$(call BUILDSTATUS,SUBTIER_START $@ $(tier)) \
$(if $(filter libs,$@),$(foreach dir, $(tier_$(tier)_staticdirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),,1))) \
$(foreach dir, $(tier_$(tier)_dirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),$@)) \
$(call BUILDSTATUS,SUBTIER_FINISH $@ $(tier))))
$(call BUILDSTATUS,TIER_FINISH $@)
else

Просмотреть файл

@ -60,16 +60,12 @@ class TierStatus(object):
The build system is organized into linear phases called tiers. Each tier
executes in the order it was defined, 1 at a time.
Tiers can have subtiers. Subtiers can execute in any order. Some subtiers
execute sequentially. Others are concurrent.
"""
def __init__(self, resources):
"""Accepts a SystemResourceMonitor to record results against."""
self.tiers = OrderedDict()
self.active_tier = None
self.active_subtiers = set()
self.resources = resources
def set_tiers(self, tiers):
@ -79,55 +75,22 @@ class TierStatus(object):
begin_time=None,
finish_time=None,
duration=None,
subtiers=OrderedDict(),
)
def begin_tier(self, tier, subtiers):
def begin_tier(self, tier):
"""Record that execution of a tier has begun."""
t = self.tiers[tier]
# We should ideally use a monotonic clock here. Unfortunately, we won't
# have one until Python 3.
t['begin_time'] = time.time()
self.resources.begin_phase(self._phase(tier))
for subtier in subtiers:
t['subtiers'][subtier] = dict(
begin_time=None,
finish_time=None,
duration=None,
concurrent=False,
)
self.resources.begin_phase(tier)
self.active_tier = tier
self.active_subtiers = set()
def finish_tier(self, tier):
"""Record that execution of a tier has finished."""
t = self.tiers[tier]
t['finish_time'] = time.time()
t['duration'] = self.resources.finish_phase(self._phase(tier))
def begin_subtier(self, tier, subtier):
"""Record that execution of a subtier has begun."""
self.resources.begin_phase(self._phase(tier, subtier))
st = self.tiers[tier]['subtiers'][subtier]
st['begin_time'] = time.time()
if self.active_subtiers:
st['concurrent'] = True
self.active_subtiers.add(subtier)
def finish_subtier(self, tier, subtier):
"""Record that execution of a subtier has finished."""
st = self.tiers[tier]['subtiers'][subtier]
st['finish_time'] = time.time()
self.active_subtiers.remove(subtier)
if self.active_subtiers:
st['concurrent'] = True
st['duration'] = self.resources.finish_phase(self._phase(tier, subtier))
t['duration'] = self.resources.finish_phase(tier)
def tier_status(self):
for tier, state in self.tiers.items():
@ -136,16 +99,6 @@ class TierStatus(object):
yield tier, active, finished
def current_subtier_status(self):
if self.active_tier not in self.tiers:
return
for subtier, state in self.tiers[self.active_tier]['subtiers'].items():
active = subtier in self.active_subtiers
finished = state['finish_time'] is not None
yield subtier, active, finished
def tiered_resource_usage(self):
"""Obtains an object containing resource usage for tiers.
@ -159,24 +112,9 @@ class TierStatus(object):
start=state['begin_time'],
end=state['finish_time'],
duration=state['duration'],
subtiers=[],
)
self.add_resources_to_dict(t_entry, phase=self._phase(tier))
for subtier, state in state['subtiers'].items():
st_entry = dict(
name=subtier,
start=state['begin_time'],
end=state['finish_time'],
duration=state['duration'],
concurrent=state['concurrent'],
)
self.add_resources_to_dict(st_entry, phase=self._phase(tier,
subtier))
t_entry['subtiers'].append(st_entry)
self.add_resources_to_dict(t_entry, phase=tier)
o.append(t_entry)
@ -210,13 +148,6 @@ class TierStatus(object):
return d
def _phase(self, tier, subtier=None):
parts = [tier]
if subtier:
parts.append(subtier)
return '_'.join(parts)
class BuildMonitor(MozbuildObject):
"""Monitors the output of the build."""
@ -288,17 +219,10 @@ class BuildMonitor(MozbuildObject):
update_needed = False
elif action == 'TIER_START':
tier = args[0]
subtiers = args[1:]
self.tiers.begin_tier(tier, subtiers)
self.tiers.begin_tier(tier)
elif action == 'TIER_FINISH':
tier, = args
self.tiers.finish_tier(tier)
elif action == 'SUBTIER_START':
tier, subtier = args[0:2]
self.tiers.begin_subtier(tier, subtier)
elif action == 'SUBTIER_FINISH':
tier, subtier = args
self.tiers.finish_subtier(tier, subtier)
else:
raise Exception('Unknown build status: %s' % action)

Просмотреть файл

@ -153,15 +153,6 @@ class BuildProgressFooter(object):
else:
parts.extend([tier, ' '])
parts.extend([('bold', 'SUBTIER'), ':', ' '])
for subtier, active, finished in tiers.current_subtier_status():
if active:
parts.extend([('underline_yellow', subtier), ' '])
elif finished:
parts.extend([('green', subtier), ' '])
else:
parts.extend([subtier, ' '])
# We don't want to write more characters than the current width of the
# terminal otherwise wrapping may result in weird behavior. We can't
# simply truncate the line at terminal width characters because a)

Просмотреть файл

@ -201,22 +201,6 @@ BuildResources.prototype = Object.freeze({
}
}
},
getSubtier: function (tier, subtier) {
var t = this.getTier(tier);
if (!t) {
return;
}
for (var i = 0; i < t.subtiers.length; i++) {
var entry = t.subtiers[i];
if (entry.name == subtier) {
return entry;
}
}
},
});
function updateResourcesGraph() {
@ -375,8 +359,8 @@ function renderResources(id, resources, what) {
.call(yAxis)
;
// Now we render a timeline of sorts of the tiers, subtiers.
// There are 2 rows of rectangles that visualize divisions between the
// Now we render a timeline of sorts of the tiers
// There is a row of rectangles that visualize divisions between the
// different items. We use the same x scale as the resource graph so times
// line up properly.
svg = d3.select("#" + id).append("svg")
@ -402,42 +386,14 @@ function renderResources(id, resources, what) {
.attr("class", "timeline tier")
.attr("tier", t)
;
tier.subtiers.forEach(function (subtier) {
var x_start = x(subtier.start - resources.offset);
var x_end = x(subtier.end - resources.offset);
var draw_width = x_end - x_start;
var classes = "timeline subtier";
if (draw_width < 6) {
classes += " short";
}
svg.append("rect")
.attr("x", x_start)
.attr("y", 60)
.attr("height", 30)
.attr("width", draw_width)
.attr("class", classes)
.attr("tier", t)
.attr("subtier", subtier.name)
;
});
});
function getEntry(element) {
var tier = element.getAttribute("tier");
var subtier = element.getAttribute("subtier");
var entry = resources.getTier(tier);
entry.tier = tier;
if (subtier) {
entry = resources.getSubtier(tier, subtier);
entry.tier = tier;
entry.subtier = subtier;
}
return entry;
}
@ -446,7 +402,6 @@ function renderResources(id, resources, what) {
var entry = getEntry(this);
d3.select("#tt_tier").html(entry.tier);
d3.select("#tt_subtier").html(entry.subtier || "n/a");
d3.select("#tt_duration").html(entry.duration || "n/a");
d3.select("#tt_cpu_percent").html(entry.cpu_percent || "n/a");
@ -488,7 +443,6 @@ document.addEventListener("DOMContentLoaded", function() {
<div id="tooltip" style="display: none;">
<table border="0">
<tr><td>Tier</td><td id="tt_tier"></td></tr>
<tr><td>Subtier</td><td id="tt_subtier"></td></tr>
<tr><td>Duration</td><td id="tt_duration"></td></tr>
<tr><td>CPU %</td><td id="tt_cpu_percent"></td></tr>
</table>