상속: IDataReader
예제 #1
0
        private void TouchOtherRegions(DumpReaderLogger readerLogger, ClrRuntime runtime)
        {
            // Touch all threads, stacks, frames
            foreach (var t in runtime.Threads)
            {
                foreach (var f in t.StackTrace)
                {
                    try { var ip = f.InstructionPointer; }
                    catch (Exception) { }
                }
            }

            // Touch all modules
            runtime.Modules.Count();

            // Touch all heap regions, roots, types
            var heap = runtime.GetHeap();

            heap.EnumerateRoots(enumerateStatics: false).Count();
            heap.EnumerateTypes().Count();

            // TODO Check if it's faster to construct sorted inside ReaderWrapper
            foreach (var kvp in readerLogger.Ranges)
            {
                _otherClrRegions.Add(kvp.Key, kvp.Value);
            }
        }
예제 #2
0
        private void DetermineNeededRegions()
        {
            if (_dumpType == DumpType.Minimal)
            {
                return;
            }

            var readerType   = typeof(DataTarget).Assembly.GetType("Microsoft.Diagnostics.Runtime.LiveDataReader");
            var reader       = (IDataReader)Activator.CreateInstance(readerType, _pid);
            var readerLogger = new DumpReaderLogger(reader);
            var target       = DataTarget.CreateFromDataReader(readerLogger);

            foreach (var clrVersion in target.ClrVersions)
            {
                var runtime = clrVersion.CreateRuntime();

                AddCLRRegions(runtime);

                TouchOtherRegions(readerLogger, runtime);

                _logger.WriteLine("{0} ranges requested by the DAC, total size {1:N0}",
                                  _otherClrRegions.Count,
                                  _otherClrRegions.Sum(r => (long)(r.Key - r.Value))
                                  );
                _logger.WriteLine("{0} CLR regions, total size {1:N0}",
                                  _majorClrRegions.Count,
                                  _majorClrRegions.Sum(r => (long)(r.Key - r.Value))
                                  );
            }
        }
예제 #3
0
        private void DetermineNeededRegions()
        {
            if (_dumpType == DumpType.Minimal)
                return;

            var readerType = typeof(DataTarget).Assembly.GetType("Microsoft.Diagnostics.Runtime.LiveDataReader");
            var reader = (IDataReader)Activator.CreateInstance(readerType, _pid);
            var readerLogger = new DumpReaderLogger(reader);
            var target = DataTarget.CreateFromDataReader(readerLogger);

            foreach (var clrVersion in target.ClrVersions)
            {
                var runtime = target.CreateRuntime(clrVersion.TryDownloadDac());

                AddCLRRegions(runtime);

                TouchOtherRegions(readerLogger, runtime);

                _logger.WriteLine("{0} ranges requested by the DAC, total size {1:N0}",
                    _otherClrRegions.Count,
                    _otherClrRegions.Sum(r => (long)(r.Key - r.Value))
                    );
                _logger.WriteLine("{0} CLR regions, total size {1:N0}",
                    _majorClrRegions.Count,
                    _majorClrRegions.Sum(r => (long)(r.Key - r.Value))
                    );
            }
        }
예제 #4
0
        private void TouchOtherRegions(DumpReaderLogger readerLogger, ClrRuntime runtime)
        {
            // Touch all threads, stacks, frames
            foreach (var t in runtime.Threads)
            {
                foreach (var f in t.StackTrace)
                {
                    try { f.GetFileAndLineNumber(); }
                    catch (Exception) { }
                }
            }

            // Touch all modules
            runtime.EnumerateModules().Count();

            // Touch all heap regions, roots, types
            var heap = runtime.GetHeap();
            heap.EnumerateRoots(enumerateStatics: false).Count();
            heap.EnumerateTypes().Count();

            // TODO Check if it's faster to construct sorted inside ReaderWrapper
            foreach (var kvp in readerLogger.Ranges)
                _otherClrRegions.Add(kvp.Key, kvp.Value);
        }