static void Main(string[] args)
        {
            RegionAllocator.Initialize();
            HeapWarmer heapWarmer = new HeapWarmer();

            if (args.Length != 4 && args.Length != 5)
            {
                Console.WriteLine("Unexpected number of arguments. Please specify: region|regioncontext|nonregion num_iterations num_objs dict|list");
                return;
            }
            if (args.Length == 5 && args[4] == "warm")
            {
                heapWarmer.WarmHeap(1000);
            }
            System.GC.Collect();
            int num_iterations = Convert.ToInt32(args[1]);
            int num_objects    = Convert.ToInt32(args[2]);

            if (args[0] == "region")
            {
                allocateInRegion(num_iterations, num_objects, args[3]);
            }
            else if (args[0] == "regioncontext")
            {
                allocateInRegionContext(num_iterations, num_objects, args[3]);
            }
            else if (args[0] == "nonregion")
            {
                allocate(num_iterations, num_objects, args[3]);
            }
            else
            {
                Console.WriteLine("Unexpected region type");
            }

            RegionAllocator.PrintStatistics();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            HeapWarmer heapWarmer = new HeapWarmer();

            if (args.Length != 3 && args.Length != 4)
            {
                Console.WriteLine("Unexpected number of arguments. Please specify: region|nonregion|regioncontext size_of_region, num_objects");
                return;
            }
            RegionAllocator.Initialize();
            uint size_of_region = (uint)Convert.ToInt32(args[1]);
            int  num_objects    = Convert.ToInt32(args[2]);

            if (args.Length == 4 && args[3] == "warm")
            {
                heapWarmer.WarmHeap(1000);
            }
            if (args[0] == "region")
            {
                Region region = RegionAllocator.AllocateRegion(size_of_region);
                AllocateInRegion(region, num_objects);
            }
            else if (args[0] == "regioncontext")
            {
                Region region = RegionAllocator.AllocateRegion(size_of_region);
                AllocateInRegionContext(region, num_objects);
            }
            else if (args[0] == "nonregion")
            {
                Allocate(num_objects);
            }
            else
            {
                Console.WriteLine("Unexpected region type");
            }
        }