예제 #1
0
        private async Task <LoopPerformanceInfo> VisitLoopAsync(SyntaxNode loopSyntax, MethodPerformanceInfo methodPerformanceInfo)
        {
            var invocationExpressionSyntaxsInLoop = loopSyntax.DescendantNodes(node => true).OfType <InvocationExpressionSyntax>();
            var loopInvocationsList = new List <MethodPerformanceInfo>();

            foreach (var invocationExpressionSyntax in invocationExpressionSyntaxsInLoop)
            {
                var invokedMethodSymbol = _semanticModel.GetSymbolInfo(invocationExpressionSyntax).Symbol as IMethodSymbol;
                // Only Drawing invocationSymbols that refer to the current assembly. Not drawing Information about other assemblies...
                if (invokedMethodSymbol == null || !Equals(_semanticModel.Compilation.Assembly, invokedMethodSymbol.ContainingAssembly))
                {
                    continue;
                }
                var invocationPerformanceInfo = await _telemetryDataMapper.GetMethodPerformanceInfoAsync(invokedMethodSymbol).ConfigureAwait(false);

                loopInvocationsList.Add(invocationPerformanceInfo);
            }


            var loopPerformanceInfo = new LoopPerformanceInfo(_predictionEngine, methodPerformanceInfo, loopInvocationsList);

            var derivedLoopIterations = TryGetLoopIterationsFromCodeFlow(loopSyntax);

            if (derivedLoopIterations != 0)
            {
                loopPerformanceInfo.PredictedLoopIterations = derivedLoopIterations;
            }

            PerformanceTags.Add(loopSyntax, new LoopPerformanceTag(loopPerformanceInfo));
            return(loopPerformanceInfo);
        }
 public LoopPerformanceTag(LoopPerformanceInfo loopPerformanceInfo) : base(loopPerformanceInfo.MethodPerformanceInfo)
 {
     LoopPerformanceInfo = loopPerformanceInfo;
 }
 public InSituLoopControlViewModel(LoopPerformanceInfo loopPerformanceInfo)
 {
     LoopPerformanceInfo = loopPerformanceInfo;
     // initializing LoopIterations to Average
     _loopIterations = LoopPerformanceInfo.PredictedLoopIterations > 0 ? LoopPerformanceInfo.PredictedLoopIterations : LoopPerformanceInfo.AverageLoopIterations;
 }
 public TimeSpan PredictLoopTime(LoopPerformanceInfo loopPerformanceInfo)
 {
     // TODO RR: multiply by 1 + workolad
     return(loopPerformanceInfo.SingleIterationTime.Multiply(loopPerformanceInfo.PredictedLoopIterations));
 }