bug 1237619: Record build objects in resource_usage.json r?gps draft
authorDan Minor <dminor@mozilla.com>
Tue, 12 Jan 2016 14:00:24 -0500
changeset 321374 e4a8e3056a69a59568dd4271a96cc22163796898
parent 321373 f6833ac20a24f92ca16da2ec14c63ba8ac039f4e
child 512888 d64256af0c30222ced26c1f1a9f1030c4d0953c7
push id9364
push userdminor@mozilla.com
push dateWed, 13 Jan 2016 13:08:09 +0000
reviewersgps
bugs1237619
milestone46.0a1
bug 1237619: Record build objects in resource_usage.json r?gps Collecting the list of object files compiled, while not ideal, will give us some indication of how much work was involved in the build. This will help with analyzing the data.
config/rules.mk
python/mozbuild/mozbuild/controller/building.py
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -897,16 +897,17 @@ src_libdep = $(call mk_libname,$1): $1 $
 
 # Rules for building native targets must come first because of the host_ prefix
 $(HOST_COBJS):
 	$(REPORT_BUILD)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CPPOBJS):
 	$(REPORT_BUILD)
+	$(call BUILDSTATUS,OBJECT_FILE $@)
 	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CMOBJS):
 	$(REPORT_BUILD)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CMMOBJS):
 	$(REPORT_BUILD)
@@ -949,16 +950,17 @@ ifdef MOZ_RUST
 endif
 
 $(SOBJS):
 	$(REPORT_BUILD)
 	$(AS) -o $@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) $(TARGET_LOCAL_INCLUDES) -c $<
 
 $(CPPOBJS):
 	$(REPORT_BUILD)
+	$(call BUILDSTATUS,OBJECT_FILE $@)
 	@$(MAKE_DEPS_AUTO_CXX)
 	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
 
 $(CMMOBJS):
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO_CXX)
 	$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
 
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -166,16 +166,18 @@ class BuildMonitor(MozbuildObject):
             try:
                 self.warnings_database.load_from_file(warnings_path)
             except ValueError:
                 os.remove(warnings_path)
 
         self._warnings_collector = WarningsCollector(
             database=self.warnings_database, objdir=self.topobjdir)
 
+        self.build_objects = []
+
     def start(self):
         """Record the start of the build."""
         self.start_time = time.time()
         self._finder_start_cpu = self._get_finder_cpu_usage()
 
     def start_resource_recording(self):
         # This should be merged into start() once bug 892342 lands.
         self.resources.start()
@@ -210,16 +212,19 @@ class BuildMonitor(MozbuildObject):
                 self.tiers.set_tiers(args)
                 update_needed = False
             elif action == 'TIER_START':
                 tier = args[0]
                 self.tiers.begin_tier(tier)
             elif action == 'TIER_FINISH':
                 tier, = args
                 self.tiers.finish_tier(tier)
+            elif action == 'OBJECT_FILE':
+                self.build_objects.append(args[0])
+                update_needed = False
             else:
                 raise Exception('Unknown build status: %s' % action)
 
             return BuildOutputResult(None, update_needed, False)
 
         warning = None
 
         try:
@@ -376,16 +381,17 @@ class BuildMonitor(MozbuildObject):
             argv=sys.argv,
             start=self.start_time,
             end=self.end_time,
             duration=self.end_time - self.start_time,
             resources=[],
             cpu_percent=cpu_percent,
             cpu_times=cpu_times,
             io=io,
+            objects=self.build_objects
         )
 
         o['tiers'] = self.tiers.tiered_resource_usage()
 
         self.tiers.add_resource_fields_to_dict(o)
 
         for usage in self.resources.range_usage():
             cpu_percent = self.resources.aggregate_cpu_percent(usage.start,