mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C#: Store buildless extraction timing information and return in telemetry query
This commit is contained in:
@@ -40,7 +40,6 @@ namespace Semmle.Extraction.CSharp.Standalone
|
||||
output.Name, syntaxTrees, references, new CSharpCompilationOptions(OutputKind.ConsoleApplication, allowUnsafe: true)
|
||||
),
|
||||
(compilation, options) => analyser.Initialize(output.FullName, extractionInput.CompilationInfos, compilation, options),
|
||||
_ => { },
|
||||
() =>
|
||||
{
|
||||
foreach (var type in analyser.MissingNamespaces)
|
||||
|
||||
@@ -245,6 +245,8 @@ namespace Semmle.Extraction.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPerformance(Entities.PerformanceMetrics p) => compilationEntity.PopulatePerformance(p);
|
||||
|
||||
#nullable restore warnings
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -309,7 +309,6 @@ namespace Semmle.Extraction.CSharp
|
||||
Func<Analyser, List<SyntaxTree>, IEnumerable<Action>> getSyntaxTreeTasks,
|
||||
Func<IEnumerable<SyntaxTree>, IEnumerable<MetadataReference>, CSharpCompilation> getCompilation,
|
||||
Action<CSharpCompilation, CommonOptions> initializeAnalyser,
|
||||
Action<Entities.PerformanceMetrics> logPerformance,
|
||||
Action postProcess)
|
||||
{
|
||||
using var references = new BlockingCollection<MetadataReference>();
|
||||
@@ -368,7 +367,7 @@ namespace Semmle.Extraction.CSharp
|
||||
PeakWorkingSet = currentProcess.PeakWorkingSet64
|
||||
};
|
||||
|
||||
logPerformance(performance);
|
||||
analyser.LogPerformance(performance);
|
||||
analyser.Logger.Log(Severity.Info, " Extraction took {0}", sw.Elapsed);
|
||||
|
||||
postProcess();
|
||||
@@ -422,7 +421,6 @@ namespace Semmle.Extraction.CSharp
|
||||
);
|
||||
},
|
||||
(compilation, options) => analyser.EndInitialize(compilerArguments, options, compilation),
|
||||
performance => analyser.LogPerformance(performance),
|
||||
() => { });
|
||||
}
|
||||
|
||||
|
||||
@@ -175,9 +175,6 @@ namespace Semmle.Extraction.CSharp
|
||||
Where(e => e.Severity >= DiagnosticSeverity.Error && !errorsToIgnore.Contains(e.Id));
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPerformance(Entities.PerformanceMetrics p) => compilationEntity.PopulatePerformance(p);
|
||||
|
||||
#nullable restore warnings
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +201,14 @@ predicate analyzerAssemblies(string key, float value) {
|
||||
value = 1.0
|
||||
}
|
||||
|
||||
predicate timingValues(string key, float value) {
|
||||
exists(Compilation c |
|
||||
key = "Total elapsed seconds" and value = c.getElapsedSeconds()
|
||||
or
|
||||
key = "Extractor elapsed seconds" and value = c.getExtractorElapsedSeconds()
|
||||
)
|
||||
}
|
||||
|
||||
from string key, float value
|
||||
where
|
||||
(
|
||||
@@ -230,7 +238,8 @@ where
|
||||
ExprStatsReport::numberOfOk(key, value) or
|
||||
ExprStatsReport::numberOfNotOk(key, value) or
|
||||
ExprStatsReport::percentageOfOk(key, value) or
|
||||
analyzerAssemblies(key, value)
|
||||
analyzerAssemblies(key, value) or
|
||||
timingValues(key, value)
|
||||
) and
|
||||
/* Infinity */
|
||||
value != 1.0 / 0.0 and
|
||||
|
||||
Reference in New Issue
Block a user