internal void CreateFileScanOperation(AMFilter_FileScanArgsTraceData data) { // If we can't get the process or thread index, bail. ProcessIndex processIndex = data.Process().ProcessIndex; if (processIndex == ProcessIndex.Invalid) { return; } ThreadIndex threadIndex = data.Thread().ThreadIndex; if (threadIndex == ThreadIndex.Invalid) { return; } // Get the process container. Dictionary <ThreadIndex, FileScanOperation> processContainer = GetOrCreateProcessContainer(processIndex); // Create a new file scan operation. // This happens when the scan is requested inside the user process. FileScanOperation scan = new FileScanOperation() { File = data.FileName, Reason = data.Reason, RequestorStack = _stackSource.GetCallStack(data.CallStackIndex(), data) }; processContainer[threadIndex] = scan; }
internal void StopScan(StreamscanrequestStartArgs_V1TraceData data) { // Get the requesting user process based on the PID logged inside the engine. TraceProcess process = _traceLog.Processes.GetProcess(data.PID, data.TimeStampRelativeMSec); ProcessIndex processIndex = process.ProcessIndex; if (processIndex == ProcessIndex.Invalid) { return; } // Get the file scan operation. Dictionary <ThreadIndex, FileScanOperation> processContainer = GetOrCreateProcessContainer(processIndex); FileScanOperation operation = processContainer.Values.Where(s => s.File.Equals(data.Path, System.StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (operation != null) { operation.StopTimeRelativeMSec = data.TimeStampRelativeMSec; // Create the stack. StackSourceFrameIndex fileNodeIndex = _stackSource.Interner.FrameIntern($"File ({operation.File})"); StackSourceFrameIndex reasonNodeIndex = _stackSource.Interner.FrameIntern($"Reason ({(operation.Reason != null ? operation.Reason : "Unknown")})"); StackSourceFrameIndex resultNodeIndex = _stackSource.Interner.FrameIntern($"Scan Result ({operation.Result})"); _sample.StackIndex = _stackSource.Interner.CallStackIntern(resultNodeIndex, operation.RequestorStack); _sample.StackIndex = _stackSource.Interner.CallStackIntern(reasonNodeIndex, _sample.StackIndex); _sample.StackIndex = _stackSource.Interner.CallStackIntern(fileNodeIndex, _sample.StackIndex); _sample.Metric = (float)(operation.StopTimeRelativeMSec - operation.StartTimeRelativeMSec); _sample.TimeRelativeMSec = operation.StartTimeRelativeMSec; _stackSource.AddSample(_sample); } }
internal void MarkSkipped(SkippedfileArgsTraceData data) { FileScanOperation inProcessOperation = _engineThreadToScanMap[(int)data.Thread().ThreadIndex]; if (inProcessOperation != null) { inProcessOperation.Result = FileScanResult.Skipped; } }
internal void StartScan(StreamscanrequestStartArgs_V1TraceData data) { // Get the requesting user process based on the PID logged inside the engine. TraceProcess process = _traceLog.Processes.GetProcess(data.PID, data.TimeStampRelativeMSec); ProcessIndex processIndex = process.ProcessIndex; if (processIndex == ProcessIndex.Invalid) { return; } // Get the file scan operation. Dictionary <ThreadIndex, FileScanOperation> processContainer = GetOrCreateProcessContainer(processIndex); FileScanOperation operation = processContainer.Values.Where(s => s.File.Equals(data.Path, System.StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (operation != null) { operation.StartTimeRelativeMSec = data.TimeStampRelativeMSec; _engineThreadToScanMap[(int)data.Thread().ThreadIndex] = operation; } }