private Tuple <int, int> LinearizeTo(MLArtifact linear, ArtifactWithBuildMeta current) { linear.Queues.Add(current.Meta.BuildQueue); linear.Builds.Add(current.Meta.BuidId); // same hash == same size linear.SizeBytes = current.Artifact.ReportedSize; // now, do the pips.... var totalIpips = LinearizePips(linear, current.Artifact.InputPips, current, true); var totalOpips = LinearizePips(linear, current.Artifact.OutputPips, current, false); return(new Tuple <int, int>(totalIpips, totalOpips)); }
private int LinearizePips(MLArtifact linear, List <BxlPipData> pips, ArtifactWithBuildMeta artifact, bool inputPips) { var pipCount = 0; var avgDeps = 0.0; var avgIns = 0.0; var avgOuts = 0.0; var avgPrio = 0.0; var avgWeight = 0.0; var avgTC = 0.0; var avgSC = 0.0; var avgPos = 0.0; foreach (var pip in pips) { avgDeps += pip.DependencyCount; avgIns += pip.InputCount; avgOuts += pip.OutputCount; avgPrio += pip.Priority; avgWeight += pip.Weight; avgTC += pip.TagCount; avgSC += pip.SemaphoreCount; avgPos += inputPips? CalculateRelativeStartPosition(pip, artifact.Meta) : CalculateRelativeEndPosition(pip, artifact.Meta); ++pipCount; } // now assign depending on type if (inputPips) { linear.AvgDepsForInputPips += avgDeps; linear.AvgInputsForInputPips += avgIns; linear.AvgOutputsForInputPips += avgOuts; linear.AvgPriorityForInputPips += avgPrio; linear.AvgWeightForInputPips += avgWeight; linear.AvgTagCountForInputPips += avgTC; linear.AvgSemaphoreCountForInputPips += avgSC; linear.AvgPositionForInputPips += avgPos; linear.AvgInputPips += pipCount; } else { linear.AvgDepsForOutputPips += avgDeps; linear.AvgInputsForOutputPips += avgIns; linear.AvgOutputsForOutputPips += avgOuts; linear.AvgPriorityForOutputPips += avgPrio; linear.AvgWeightForOutputPips += avgWeight; linear.AvgTagCountForOutputPips += avgTC; linear.AvgSemaphoreCountForOutputPips += avgSC; linear.AvgPositionForOutputPips += avgPos; linear.AvgOutputPips += pipCount; } return(pipCount); }