Esempio n. 1
0
        public void ProxyableComponent()
        {
            var container = new ProfilingContainer();

            container.Register(Component.For <Proxyable>());
            container.Resolve <Proxyable>().LongOperation();
            var profile = container.GetProfile();

            Assert.AreEqual(1, profile.Children.Count);
            Console.WriteLine("{0}: {1}", profile.Children[0].Value.Key, profile.Children[0].Value.Value);
            var fProfile = Flatten(profile);
            var q        = from n in fProfile
                           group n.Value by n.Key
                           into x
                           let kv = new KeyValuePair <MethodInfo, double>(x.Key, x.Sum(t => t.TotalMilliseconds))
                                    orderby kv.Value descending
                                    select kv;

            foreach (var i in q)
            {
                Console.WriteLine("{0}: {1}", i.Key, i.Value);
            }

            //Console.WriteLine(profile.Values.ToList()[0][0].TotalMilliseconds);
        }
Esempio n. 2
0
        public void NonProxyableComponent()
        {
            var container = new ProfilingContainer();

            container.AddComponent <NonProxyable>();
            container.Resolve <NonProxyable>().LongOperation();
            var profile = container.GetProfile();

            Assert.AreEqual(0, profile.Children.Count);
        }
Esempio n. 3
0
        public void NonProxyableComponent()
        {
            var container = new ProfilingContainer();

            container.Register(Component.For <NonProxyable>());
            container.Resolve <NonProxyable>().LongOperation();
            var profile = container.GetProfile();

            Assert.Empty(profile.Children);
        }