lib/third_party/tracing/extras/rail/rail_ir_finder.js
function(rirs) {
      var vacuumIRs = [];
      rirs.forEach(function(ir) {
        if (ir instanceof tr.e.rail.LoadInteractionRecord ||
            ir instanceof tr.e.rail.IdleInteractionRecord)
          vacuumIRs.push(ir);
      });
      if (vacuumIRs.length === 0)
        return;

      var allAssociatedEvents = tr.model.getAssociatedEvents(rirs);
      var unassociatedEvents = tr.model.getUnassociatedEvents(
          this.model, allAssociatedEvents);

      unassociatedEvents.forEach(function(event) {
        if (!(event instanceof tr.model.ThreadSlice))
          return;

        if (!event.isTopLevel)
          return;

        for (var iri = 0; iri < vacuumIRs.length; ++iri) {
          var ir = vacuumIRs[iri];

          if ((event.start >= ir.start) &&
              (event.start < ir.end)) {
            ir.associatedEvents.addEventSet(event.entireHierarchy);
            return;
          }
        }
      });
    }
function(rirs) {
      var vacuumIRs = [];
      rirs.forEach(function(ir) {
        if (ir instanceof tr.e.rail.LoadInteractionRecord ||
            ir instanceof tr.e.rail.IdleInteractionRecord)
          vacuumIRs.push(ir);
      });
      if (vacuumIRs.length === 0)
        return;

      var allAssociatedEvents = tr.model.getAssociatedEvents(rirs);
      var unassociatedEvents = tr.model.getUnassociatedEvents(
          this.model, allAssociatedEvents);

      unassociatedEvents.forEach(function(event) {
        if (!(event instanceof tr.model.ThreadSlice))
          return;

        if (!event.isTopLevel)
          return;

        for (var iri = 0; iri < vacuumIRs.length; ++iri) {
          var ir = vacuumIRs[iri];

          if ((event.start >= ir.start) &&
              (event.start < ir.end)) {
            ir.associatedEvents.addEventSet(event.entireHierarchy);
            return;
          }
        }
      });
    }
function ( rirs ) { var vacuumIRs = [ ] ; rirs . forEach ( function ( ir ) { if ( ir instanceof tr . e . rail . LoadInteractionRecord || ir instanceof tr . e . rail . IdleInteractionRecord ) vacuumIRs . push ( ir ) ; } ) ; if ( vacuumIRs . length === 0 ) return ; var allAssociatedEvents = tr . model . getAssociatedEvents ( rirs ) ; var unassociatedEvents = tr . model . getUnassociatedEvents ( this . model , allAssociatedEvents ) ; unassociatedEvents . forEach ( function ( event ) { if ( ! ( event instanceof tr . model . ThreadSlice ) ) return ; if ( ! event . isTopLevel ) return ; for ( var iri = 0 ; iri < vacuumIRs . length ; ++ iri ) { var ir = vacuumIRs [ iri ] ; if ( ( event . start >= ir . start ) && ( event . start < ir . end ) ) { ir . associatedEvents . addEventSet ( event . entireHierarchy ) ; return ; } } } ) ; }
Find all unassociated top-level ThreadSlices. If they start during an Idle or Load IR, then add their entire hierarchy to that IR.
Find all unassociated top - level ThreadSlices . If they start during an Idle or Load IR then add their entire hierarchy to that IR .