예제 #1
0
        public static void Main(string[] args)
        {
            if (args[0].EndsWith(".dmp") == false)
            {
                Console.WriteLine("First argument should be the canonical path to the *.dmp file");
                Environment.Exit(1);
            }

            Console.WriteLine("Loading dump... (this can take a while)");

            var runtime = CreateRuntime(args[0], string.Empty);
            var heap    = runtime.Heap;

            Console.WriteLine("Dump loaded!");

            var dict = new Dictionary <int, IAnalyse>();

            dict[1] = new CountArrays();
            dict[2] = new CountStrings();
            dict[3] = new DumpByteArrays();
            dict[4] = new DumpCharArrays();
            dict[5] = new RootedObjects();
            dict[6] = new TypesOnTheLoh();

            PresentAnalysers(dict);

            while (true)
            {
                Console.WriteLine(Environment.NewLine);

                int id = AskForAnalyserToRun();

                if (id == -1)
                {
                    Environment.Exit(0);
                }

                if (dict.ContainsKey(id))
                {
                    var sw = Stopwatch.StartNew();
                    dict[id].Execute(heap);
                    Console.WriteLine($"Took: {sw.Elapsed}");
                }
                else
                {
                    Console.WriteLine("Invalid ID");
                }

                PresentAnalysers(dict);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            CountArrays CArrays = new CountArrays();

            CArrays.CountArraysTogether();

            SumofArrays SArrays = new SumofArrays();

            SArrays.SumofAllArraysTogether();

            MeanofArrays MArrays = new MeanofArrays();

            MArrays.MeanofAllArraysTogether();

            ReverseArrays RArrays = new ReverseArrays();

            Console.WriteLine("\n----Reverse of Arrays----");
            Console.WriteLine("ArrayA");
            RArrays.ReverseArray(ArrayA);
            Console.WriteLine("ArrayB");
            RArrays.ReverseArray(ArrayB);
            Console.WriteLine("ArrayC");
            RArrays.ReverseArray(ArrayC);
            RotateArrays ROArrays = new RotateArrays();

            Console.WriteLine("----Rotate Array----");
            Console.WriteLine("ArrayA");
            ROArrays.RotateArray("Left", 2, ArrayA);
            Console.WriteLine("ArrayB");
            ROArrays.RotateArray("Right", 2, ArrayB);
            Console.WriteLine("ArrayC");
            ROArrays.RotateArray("Left", 4, ArrayC);

            SortArray SArray = new SortArray();

            SArray.Sort(ArrayC);

            Console.ReadLine();
        }