Mercurial > hg > truffle
comparison test/runtime/NMT/ThreadedMallocTestType.java @ 20361:ac12996df59b
8044140: Create NMT (Native Memory Tracking) tests for NMT2
Summary: Create new/modify existing tests for NMT2, which is an internal redesign to address scalability issues in the first implementation.
Reviewed-by: ctornqvi, zgu
Contributed-by: George Triantafillou <george.triantafillou@oracle.com>
author | zgu |
---|---|
date | Wed, 27 Aug 2014 08:35:03 -0400 |
parents | 3b890cd4da64 |
children | 6640f982c1be |
comparison
equal
deleted
inserted
replaced
20360:833b0f92429a | 20361:ac12996df59b |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
24 /* | 24 /* |
25 * @test | 25 * @test |
26 * @key nmt jcmd | 26 * @key nmt jcmd |
27 * @library /testlibrary /testlibrary/whitebox | 27 * @library /testlibrary /testlibrary/whitebox |
28 * @build ThreadedMallocTestType | 28 * @build ThreadedMallocTestType |
29 * @ignore | |
29 * @run main ClassFileInstaller sun.hotspot.WhiteBox | 30 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
30 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ThreadedMallocTestType | 31 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ThreadedMallocTestType |
31 */ | 32 */ |
32 | 33 |
33 import com.oracle.java.testlibrary.*; | 34 import com.oracle.java.testlibrary.*; |
56 }; | 57 }; |
57 | 58 |
58 allocThread.start(); | 59 allocThread.start(); |
59 allocThread.join(); | 60 allocThread.join(); |
60 | 61 |
61 // Use WB API to ensure that all data has been merged before we continue | |
62 if (!wb.NMTWaitForDataMerge()) { | |
63 throw new Exception("Call to WB API NMTWaitForDataMerge() failed"); | |
64 } | |
65 | |
66 // Run 'jcmd <pid> VM.native_memory summary' | 62 // Run 'jcmd <pid> VM.native_memory summary' |
67 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary"}); | 63 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary"}); |
68 output = new OutputAnalyzer(pb.start()); | 64 output = new OutputAnalyzer(pb.start()); |
69 output.shouldContain("Test (reserved=896KB, committed=896KB)"); | 65 output.shouldContain("Test (reserved=896KB, committed=896KB)"); |
70 | 66 |
78 }; | 74 }; |
79 | 75 |
80 freeThread.start(); | 76 freeThread.start(); |
81 freeThread.join(); | 77 freeThread.join(); |
82 | 78 |
83 // Use WB API to ensure that all data has been merged before we continue | |
84 if (!wb.NMTWaitForDataMerge()) { | |
85 throw new Exception("Call to WB API NMTWaitForDataMerge() failed"); | |
86 } | |
87 | |
88 output = new OutputAnalyzer(pb.start()); | 79 output = new OutputAnalyzer(pb.start()); |
89 output.shouldNotContain("Test (reserved="); | 80 output.shouldNotContain("Test (reserved="); |
90 } | 81 } |
91 } | 82 } |