private static void SetupFileProcessor() { string[] files = ProcessFilenames(options.Arguments); if (files.Length < 1) { ShowErrorAndExit("No files specified to process."); } else if (files.Length > 1) { prefixWithFilename = true; } var fileProcessor = new ETWFileProcessor(files); fileProcessor.BuffersLost += HandleBuffersLost; processor = fileProcessor; }
public EventStatistics(ETWProcessor processor) { processor.EventProcessed += this.EventProcessed; }
private static void SetupRealtimeProcessor() { var sessionName = string.Format("{0}-ELT-realtime", Environment.UserName); var realtimeSession = new ETWRealtimeProcessor(sessionName); bool added = false; foreach (var arg in options.Arguments) { string[] split = arg.Split('!'); Guid providerID; var providers = new List <Guid>(); var minimumSeverity = EventLevel.Informational; long keywords = 0x0; if (split[0].Equals("CLR", StringComparison.OrdinalIgnoreCase)) { providers.Add(ClrTraceEventParser.ProviderGuid); } else if (split[0].Equals("Kernel", StringComparison.OrdinalIgnoreCase)) { providers.Add(KernelTraceEventParser.ProviderGuid); } else if (!Guid.TryParse(split[0], out providerID)) { // If it's not a GUID it might be an assembly -- we can try that... if (!GetProvidersFromAssembly(split[0], providers)) { ShowErrorAndExit("{0} is not a validly formatted GUID, and not a usable assembly", split[0]); } } else { providers.Add(providerID); } // Ignore if the string is null(won't be), empty, or whitespace -- all these will just mean that we // use default severity. if (split.Length > 1 && !string.IsNullOrWhiteSpace(split[1])) { minimumSeverity = ETWEvent.CharToEventLevel(split[1][0]); } if (split.Length > 2) { string num = split[2]; if (num.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) { num = num.Substring(2); } if (!long.TryParse(num, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out keywords)) { ShowErrorAndExit("Keyword value {0} is not a valid hexadecimal number", split[2]); } } foreach (var id in providers) { realtimeSession.SubscribeToProvider(id, minimumSeverity, keywords); } added = true; } if (!added) { ShowErrorAndExit("No providers given to subscribe to!"); } processor = realtimeSession; }