Пример #1
0
        public void Can_extract_gc_roots()
        {
            using var dumpContext = new DumpContext(_store);
            dumpContext.LoadFromDump("allocations.dmp");


            dumpContext.ExtractDataWith(new GcRootsExtractor(), new HeapObjectsExtractor());
            using var session = _store.OpenSession();

            var gcRootCount = session.Query <GcRoot>().Count();

            //sanity check...
            Assert.Equal(60, gcRootCount);
        }
Пример #2
0
        public void Can_load_dump()
        {
            using var dumpContext = new DumpContext(_store);
            dumpContext.LoadFromDump("allocations.dmp");

            dumpContext.ExtractDataWith(new HeapObjectsExtractor(), new StringsExtractor());

            using var session = _store.OpenSession();

            var objectCount = session.Query <Core.Object>().Count();
            var stringCount = session.Query <Core.String>().Count();

            //sanity check...
            Assert.Equal(146, objectCount);
            Assert.Equal(34, stringCount);
        }
Пример #3
0
    public static void Main()
    {
        var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

        XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));

        var logger = logRepository.GetLogger("FooBar");

        EmbeddedServer.Instance.StartServer(new ServerOptions
        {
            AcceptEula      = true,
            CommandLineArgs = new List <string> {
                "Setup.Mode=None", "RunInMemory=true"
            },
            FrameworkVersion = Environment.Version.ToString()
        });
        var store = EmbeddedServer.Instance.GetDocumentStore(new DatabaseOptions("Metadata")
        {
            Conventions = new DocumentConventions
            {
                CustomizeJsonSerializer = serializer =>
                {
                    serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
                    serializer.NullValueHandling     = NullValueHandling.Ignore;
                    serializer.ContractResolver      = new DumpExplorerContractSerializer();
                },
                RequestTimeout = TimeSpan.FromMinutes(5)
            }
        });

        using var dumpContext       = new DumpContext(store);
        dumpContext.OperationEvent += DumpContext_OperationEvent;
        dumpContext.LoadFromDump("allocations.dmp");

        EmbeddedServer.Instance.OpenStudioInBrowser();

        dumpContext.ExtractDataWith(new HeapObjectsExtractor(), new ExceptionExtractor(), new StringsExtractor(), new GcRootsExtractor());

        Console.ReadKey();
    }