public CodeExecutionMonitor(ILogMeasuremnetWriter logWriter, string blockName) { this.Block = blockName; this.Start = DateTime.Now; this._extraData = new Dictionary <string, string>(); this.logWriter = logWriter; this.InnerCodeExecution = new List <CodeExecLogEntry>(); parent = current; current = this; }
public static CodeExecLogEntry Create(CodeExecutionMonitor monitor) { var logEntry = new CodeExecLogEntry() { Block = monitor.Block, Start = monitor.Start, End = monitor.End, ExtraData = monitor.ExtraData }; return(logEntry); }
public void Dispose() { End = DateTime.Now; var logEntry = CodeExecLogEntry.Create(this); if (this.parent != null) { this.parent.InnerCodeExecution.Add(logEntry); } else { logEntry.AddChild(InnerCodeExecution); this.logWriter.Write(logEntry); } current = this.parent; }