public void CanParseMemoryDumpFromPackageWithAndroid11([Values(true, false)] bool windowsEndLines)
    {
        var stats = new AndroidMemoryStatistics();

        if (windowsEndLines)
        {
            stats.Parse(kPackageMemoryDumpAndroid11.Replace("\n", "\r\n"));
        }
        else
        {
            stats.Parse(kPackageMemoryDumpAndroid11);
        }

        Assert.AreEqual(688561 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Total));
        Assert.AreEqual(5265 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.System));
        Assert.AreEqual(396792 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(85032 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Graphics));
        Assert.AreEqual(1536 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Stack));
        Assert.AreEqual(10152 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(746132 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.Total));
        Assert.AreEqual(0 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.System));
        Assert.AreEqual(399380 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(85032 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.Graphics));
        Assert.AreEqual(1548 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.Stack));
        Assert.AreEqual(24732 * kKiloByte, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(504803 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        Assert.AreEqual(12110 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.JavaHeap));
        Assert.AreEqual(550768 * kKiloByte, stats.GetValue(MemoryGroup.HeapSize, MemoryType.NativeHeap));
        Assert.AreEqual(16146 * kKiloByte, stats.GetValue(MemoryGroup.HeapSize, MemoryType.JavaHeap));
    }
    public void CanParseHugeValues([Values(true, false)] bool windowsEndLines)
    {
        const UInt64 kOneMegaByte = 1000;
        const UInt64 kOneGigabyte = 1000 * kOneMegaByte;
        const UInt64 kOneTerabyte = 1000 * kOneGigabyte;

        var inputs = new[] { kOneGigabyte, kOneTerabyte };

        foreach (var i in inputs)
        {
            // Note: Report contains values in kilobytes
            var contents = string.Format(kProcessWithHugeValues, i);

            var stats = new AndroidMemoryStatistics();
            if (windowsEndLines)
            {
                stats.Parse(contents.Replace("\n", "\r\n"));
            }
            else
            {
                stats.Parse(contents);
            }
            Assert.AreEqual(i * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        }
    }
    public void CanParseMemoryDumpFromPackage([Values(true, false)] bool windowsEndLines)
    {
        var stats = new AndroidMemoryStatistics();

        if (windowsEndLines)
        {
            stats.Parse(kPackageMemoryDump.Replace("\n", "\r\n"));
        }
        else
        {
            stats.Parse(kPackageMemoryDump);
        }

        Assert.AreEqual(312674 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Total));
        Assert.AreEqual(169230 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.System));
        Assert.AreEqual(43210 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(107884 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Graphics));
        Assert.AreEqual(36 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Stack));
        Assert.AreEqual(1234 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(0, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(0, stats.GetValue(MemoryGroup.ResidentSetSize, MemoryType.Total));

        Assert.AreEqual(157805 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        Assert.AreEqual(1184 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.JavaHeap));
    }
    public void CanParseMemoryDumpFromProcess([Values(true, false)] bool windowsEndLines)
    {
        var stats = new AndroidMemoryStatistics();

        if (windowsEndLines)
        {
            stats.Parse(kSystemProcessDump.Replace("\n", "\r\n"));
        }
        else
        {
            stats.Parse(kSystemProcessDump);
        }

        Assert.AreEqual(1383 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Total));
        Assert.AreEqual(903 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.System));
        Assert.AreEqual(156 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(2 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Graphics));
        Assert.AreEqual(4 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Stack));
        Assert.AreEqual(1 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(2 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        Assert.AreEqual(3 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.JavaHeap));
        Assert.AreEqual(5 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.Total));
    }
Exemplo n.º 5
0
    public void CanParseMemoryDumpFromPackage()
    {
        var stats = new AndroidMemoryStatistics();

        stats.Parse(kPackageMemoryDump);

        Assert.AreEqual(312674 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Total));
        Assert.AreEqual(169230 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.System));
        Assert.AreEqual(43210 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(107884 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Graphics));
        Assert.AreEqual(36 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Stack));
        Assert.AreEqual(1234 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(157805 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        Assert.AreEqual(1184 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.JavaHeap));
    }
Exemplo n.º 6
0
    public void CanParseHugeValues()
    {
        const UInt64 kOneMegaByte = 1000;
        const UInt64 kOneGigabyte = 1000 * kOneMegaByte;
        const UInt64 kOneTerabyte = 1000 * kOneGigabyte;

        var inputs = new[] { kOneGigabyte, kOneTerabyte };

        foreach (var i in inputs)
        {
            // Note: Report contains values in kilobytes
            var contents = string.Format(kProcessWithHugeValues, i);
            var stats    = new AndroidMemoryStatistics();
            stats.Parse(contents);
            Assert.AreEqual(i * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        }
    }
Exemplo n.º 7
0
    public void CanParseMemoryDumpFromProcess()
    {
        var stats = new AndroidMemoryStatistics();

        stats.Parse(kSystemProcessDump);


        Assert.AreEqual(1383 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Total));
        Assert.AreEqual(903 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.System));
        Assert.AreEqual(156 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.NativeHeap));
        Assert.AreEqual(2 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Graphics));
        Assert.AreEqual(4 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.Stack));
        Assert.AreEqual(1 * kKiloByte, stats.GetValue(MemoryGroup.ProportionalSetSize, MemoryType.JavaHeap));

        Assert.AreEqual(2 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.NativeHeap));
        Assert.AreEqual(3 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.JavaHeap));
        Assert.AreEqual(5 * kKiloByte, stats.GetValue(MemoryGroup.HeapAlloc, MemoryType.Total));
    }