From 98a5f800505f4cd4838a976be2850911c7f0e086 Mon Sep 17 00:00:00 2001 From: Alois Kraus Date: Mon, 9 Sep 2024 17:19:37 +0200 Subject: [PATCH] Workaround fix for issue 91. For long running sessions where the first information is missing this API will throw. --- ETWAnalyzer/Extractors/CPU/CpuFrequencyExtractor.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ETWAnalyzer/Extractors/CPU/CpuFrequencyExtractor.cs b/ETWAnalyzer/Extractors/CPU/CpuFrequencyExtractor.cs index 52326815..1afda4ff 100644 --- a/ETWAnalyzer/Extractors/CPU/CpuFrequencyExtractor.cs +++ b/ETWAnalyzer/Extractors/CPU/CpuFrequencyExtractor.cs @@ -29,9 +29,17 @@ public override void Extract(ITraceProcessor processor, ETWExtract results) foreach(Microsoft.Windows.EventTracing.Power.IProcessorFrequencyInterval cpu in myCpuFrequencies.Result.Intervals) { - if( cpu.AverageFrequency == null) + try { - Console.WriteLine($"Warning: File {results.SourceETLFileName} contains CPU frequency ETW data, but AverageFrequency is null. This happens when the CaptureState for the Microsoft-Windows-Kernel-Processor-Power provider is missing."); + if (cpu.AverageFrequency == null) + { + Console.WriteLine($"Warning: File {results.SourceETLFileName} contains CPU frequency ETW data, but AverageFrequency is null. This happens when the CaptureState for the Microsoft-Windows-Kernel-Processor-Power provider is missing."); + break; + } + } + catch(ArgumentOutOfRangeException) + { + Console.WriteLine($"Warning: File {results.SourceETLFileName} contains CPU frequency ETW data, but AverageFrequency is not accessible. This happens when the CaptureState for the Microsoft-Windows-Kernel-Processor-Power provider is missing."); break; }