示例#1
0
    public static int Main(string[] args)
    {
        uint sizeInMB = 0;

        try {
            sizeInMB = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ((e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException))
            {
                Console.WriteLine("args: uint - number of MB to allocate");
                return(0);
            }
            throw;
        }

        int availableMem = MemCheck.GetPhysicalMem();

        if (availableMem != -1 && availableMem < sizeInMB)
        {
            sizeInMB = (uint)(availableMem > 300 ? 300 : (availableMem / 2));
            Console.WriteLine("Not enough memory. Allocating " + sizeInMB + "MB instead.");
        }

        GetTotalMemoryTest test = new GetTotalMemoryTest(sizeInMB);

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
示例#2
0
    public static int Main(string[] args)
    {
        uint size = 0;

        try {
            size = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ((e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException))
            {
                Console.WriteLine("args: uint - number of GB to allocate");
                return(0);
            }
            throw;
        }


        GetTotalMemoryTest test = new GetTotalMemoryTest(size);

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
示例#3
0
    public static int Main(string[] args) {

        uint sizeInMB = 0;
        try {
            sizeInMB = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ( (e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException) ) {
                Console.WriteLine("args: uint - number of MB to allocate");
                return 0;
            }
            throw;
        }

        int availableMem = MemCheck.GetPhysicalMem();
        if (availableMem != -1 && availableMem < sizeInMB){
            sizeInMB = (uint)(availableMem > 300 ? 300 : (availableMem / 2));
            Console.WriteLine("Not enough memory. Allocating " + sizeInMB + "MB instead.");
        }

        GetTotalMemoryTest test = new GetTotalMemoryTest(sizeInMB);
        if (test.RunTests()) {
            Console.WriteLine("Test passed");
            return 100;
        }

        Console.WriteLine("Test failed");
        return 0;
    }
    public static int Main(string[] args)
    {
        GetTotalMemoryTest test = new GetTotalMemoryTest(MemCheck.ParseSizeMBAndLimitByAvailableMem(args));

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
示例#5
0
    public static int Main(string[] args) {

        uint size = 0;
        try {
            size = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ( (e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException) ) {
                Console.WriteLine("args: uint - number of GB to allocate");
                return 0;
            }
            throw;
        }


        GetTotalMemoryTest test = new GetTotalMemoryTest(size);
        if (test.RunTests()) {
            Console.WriteLine("Test passed");
            return 100;
        }

        Console.WriteLine("Test failed");
        return 0;
    }