예제 #1
0
        private void SetStrategy()
        {
            if (_context.TargetType == TargetType.DumpFile ||
                _context.TargetType == TargetType.DumpFileNoHeap)
            {
                _temporaryDbgEngTarget   = _context.CreateTemporaryDbgEngTarget();
                _unifiedStackTraces      = new UnifiedStackTraces(_temporaryDbgEngTarget.DebuggerInterface, _context);
                _blockingObjectsStrategy = new DumpFileBlockingObjectsStrategy(_context.Runtime, _unifiedStackTraces, _temporaryDbgEngTarget);

                _threads.AddRange(_unifiedStackTraces.Threads.Select(ti => _blockingObjectsStrategy.GetThreadWithBlockingObjects(ti)));
            }
            else
            {
                _blockingObjectsStrategy = new LiveProcessBlockingObjectsStrategy(_context.Runtime);

                // Currently, we are only enumerating the managed threads because we don't have
                // an alternative source of information for threads in live processes. In the future,
                // we can consider using System.Diagnostics or some other means of enumerating threads
                // in live processes.
                _threads.AddRange(_context.Runtime.Threads.Select(thr => _blockingObjectsStrategy.GetThreadWithBlockingObjects(thr)));
            }
        }
예제 #2
0
파일: WaitChains.cs 프로젝트: goldshtn/msos
        private void SetStrategy()
        {
            if (_context.TargetType == TargetType.DumpFile
                || _context.TargetType == TargetType.DumpFile)
            {
                _temporaryDbgEngTarget = _context.CreateTemporaryDbgEngTarget();
                _unifiedStackTraces = new UnifiedStackTraces(_temporaryDbgEngTarget.DebuggerInterface, _context);
                _blockingObjectsStrategy = new DumpFileBlockingObjectsStrategy(_context.Runtime, _unifiedStackTraces, _temporaryDbgEngTarget);

                _threads.AddRange(_unifiedStackTraces.Threads.Select(ti => _blockingObjectsStrategy.GetThreadWithBlockingObjects(ti)));
            }
            else
            {
                _blockingObjectsStrategy = new LiveProcessBlockingObjectsStrategy(_context.Runtime);

                // Currently, we are only enumerating the managed threads because we don't have
                // an alternative source of information for threads in live processes. In the future,
                // we can consider using System.Diagnostics or some other means of enumerating threads
                // in live processes.
                _threads.AddRange(_context.Runtime.Threads.Select(thr => _blockingObjectsStrategy.GetThreadWithBlockingObjects(thr)));
            }
        }