/// <summary> /// Constructor. /// </summary> /// <param name="raceDetectionEngine">IRaceDetectionEngine</param> /// <param name="configuration">Configuration</param> public RaceInstrumentationEngine(IRegisterRuntimeOperation raceDetectionEngine, Configuration configuration) : base(new Container(), new EngineOptions(), new MonitorManager(raceDetectionEngine, configuration), new ThreadMonitorManager(configuration)) { if (SingletonEngine != null) { throw new InvalidOperationException("RaceInstrumentationEngine created more than once."); } SingletonEngine = this; // required? AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomainProcessExit); this.GetService <ISymbolManager>().AddStackFrameFilter(new StackFrameFilter()); if (!ControllerEnvironment.IsMonitoringEnabled) { Console.WriteLine("ExtendedReflection monitor not enabled"); throw new NotImplementedException("ExtendedReflection monitor not enabled"); } ((IMonitorManager)this.GetService <MonitorManager>()).RegisterThreadMonitor( new ThreadMonitorFactory(this.GetService <ThreadMonitorManager>(), raceDetectionEngine, configuration)); ((IMonitorManager)this.GetService <MonitorManager>()).RegisterObjectAccessThreadMonitor(); this.ExecutionMonitor.Initialize(); var tid = this.ExecutionMonitor.CreateThread(); _ThreadContext.Start(this.ExecutionMonitor, tid); }
/// <summary> /// Constructor. /// </summary> /// <param name="host">ICopComponent</param> /// <param name="configuration">Configuration</param> public ThreadMonitorFactory(ICopComponent host, IRegisterRuntimeOperation raceDetectionEngine, Configuration configuration) : base(host) { this.Configuration = configuration; this.RaceDetectionEngine = raceDetectionEngine; this.ThreadMonitors = new ThreadMonitorCollection(); }
/// <summary> /// Constructor. /// </summary> /// <param name="log">IEventLog</param> /// <param name="threadIndex">Thread index</param> /// <param name="callMonitor">IThreadMonitor</param> /// <param name="raceDetectionEngine">IRaceDetectionEngine</param> /// <param name="configuration">Configuration</param> public ThreadExecutionMonitorDispatcher(IEventLog log, int threadIndex, IThreadMonitor callMonitor, IRegisterRuntimeOperation raceDetectionEngine, Configuration configuration) : base(threadIndex) { SafeDebug.AssertNotNull(callMonitor, "callMonitor"); this.ThreadIndex = threadIndex; this.Configuration = configuration; this.DebugTrace = new SafeList <string>(); this.CallStack = new SafeStack <Method>(); this.Reporter = raceDetectionEngine; }
/// <summary> /// Constructor. /// </summary> /// <param name="raceDetectionEngine">ITestingEngine</param> /// <param name="configuration">Configuration</param> public MonitorManager(IRegisterRuntimeOperation raceDetectionEngine, Configuration configuration) : base() { this.RaceDetectionEngine = raceDetectionEngine; this.Configuration = configuration; }