test/serviceability/dcmd/gc/HeapDumpTest.java

Print this page




  24 import org.testng.annotations.Test;
  25 import org.testng.Assert;
  26 
  27 import java.io.File;
  28 import java.nio.file.Files;
  29 import java.io.IOException;
  30 import java.util.List;
  31 
  32 import jdk.test.lib.hprof.HprofParser;
  33 import jdk.test.lib.hprof.model.Snapshot;
  34 
  35 import jdk.test.lib.JDKToolFinder;
  36 import jdk.test.lib.OutputAnalyzer;
  37 import jdk.test.lib.dcmd.CommandExecutor;
  38 import jdk.test.lib.dcmd.PidJcmdExecutor;
  39 
  40 /*
  41  * @test
  42  * @summary Test of diagnostic command GC.heap_dump
  43  * @library /testlibrary
  44  * @library /../../test/lib/share/classes
  45  * @modules java.base/sun.misc
  46  *          java.compiler
  47  *          java.management
  48  *          jdk.jvmstat/sun.jvmstat.monitor
  49  * @build jdk.test.lib.*
  50  * @build jdk.test.lib.dcmd.*
  51  * @build jdk.test.lib.hprof.*
  52  * @build jdk.test.lib.hprof.module.*
  53  * @build jdk.test.lib.hprof.parser.*
  54  * @build jdk.test.lib.hprof.utils.*
  55  * @run testng HeapDumpTest
  56  */
  57 public class HeapDumpTest {
  58     protected String heapDumpArgs = "";
  59 
  60     public void run(CommandExecutor executor) throws IOException {
  61         File dump = new File("jcmd.gc.heap_dump." + System.currentTimeMillis() + ".hprof");
  62         if (dump.exists()) {
  63             dump.delete();
  64         }




  24 import org.testng.annotations.Test;
  25 import org.testng.Assert;
  26 
  27 import java.io.File;
  28 import java.nio.file.Files;
  29 import java.io.IOException;
  30 import java.util.List;
  31 
  32 import jdk.test.lib.hprof.HprofParser;
  33 import jdk.test.lib.hprof.model.Snapshot;
  34 
  35 import jdk.test.lib.JDKToolFinder;
  36 import jdk.test.lib.OutputAnalyzer;
  37 import jdk.test.lib.dcmd.CommandExecutor;
  38 import jdk.test.lib.dcmd.PidJcmdExecutor;
  39 
  40 /*
  41  * @test
  42  * @summary Test of diagnostic command GC.heap_dump
  43  * @library /testlibrary
  44  * @library /test/lib/share/classes
  45  * @modules java.base/sun.misc
  46  *          java.compiler
  47  *          java.management
  48  *          jdk.jvmstat/sun.jvmstat.monitor
  49  * @build jdk.test.lib.*
  50  * @build jdk.test.lib.dcmd.*
  51  * @build jdk.test.lib.hprof.*
  52  * @build jdk.test.lib.hprof.module.*
  53  * @build jdk.test.lib.hprof.parser.*
  54  * @build jdk.test.lib.hprof.utils.*
  55  * @run testng HeapDumpTest
  56  */
  57 public class HeapDumpTest {
  58     protected String heapDumpArgs = "";
  59 
  60     public void run(CommandExecutor executor) throws IOException {
  61         File dump = new File("jcmd.gc.heap_dump." + System.currentTimeMillis() + ".hprof");
  62         if (dump.exists()) {
  63             dump.delete();
  64         }