コード例 #1
0
        public void ProfileTest(ProfilingContainer container)
        {
            var parser  = container.Resolve <ISolrAbstractResponseParser <TestDocumentWithArrays> >();
            var xml     = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.responseWithArraysSimple.xml");
            var results = new SolrQueryResults <TestDocumentWithArrays>();

            for (var i = 0; i < 1000; i++)
            {
                parser.Parse(xml, results);
            }

            var profile = Flatten(container.GetProfile());
            var q       = from n in profile
                          group n.Value by n.Key
                          into x
                          let kv = new { method = x.Key, count = x.Count(), total = x.Sum(t => t.TotalMilliseconds) }
            orderby kv.total descending
            select kv;
        }
コード例 #2
0
        public void ProfileTest(ProfilingContainer container)
        {
            var parser = container.Resolve <ISolrQueryResultParser <TestDocumentWithArrays> >();
            var xml    = EmbeddedResource.GetEmbeddedString(GetType(), "Resources.responseWithArraysSimple.xml");

            for (var i = 0; i < 1000; i++)
            {
                parser.Parse(xml);
            }

            var profile = Flatten(container.GetProfile());
            var q       = from n in profile
                          group n.Value by n.Key into x
                          let kv = new { method = x.Key, count = x.Count(), total = x.Sum(t => t.TotalMilliseconds) }
            orderby kv.total descending
            select kv;

            foreach (var i in q)
            {
                Console.WriteLine("{0} {1}: {2} executions, {3}ms", i.method.DeclaringType, i.method, i.count, i.total);
            }
        }