< prev index next >

test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.recording.misc;
  27 
  28 import static jdk.test.lib.Asserts.assertEquals;
  29 import static jdk.test.lib.Asserts.assertTrue;
  30 
  31 import java.nio.file.Files;
  32 import java.nio.file.Path;
  33 import java.nio.file.Paths;
  34 
  35 import jdk.jfr.Recording;
  36 import jdk.test.lib.jfr.EventNames;
  37 
  38 /*
  39  * @test
  40  * @summary Test recording file size with Recording.getSize()
  41  * @key jfr

  42  * @library /test/lib
  43  * @run main/othervm jdk.jfr.api.recording.misc.TestGetSize
  44  */
  45 public class TestGetSize {
  46 
  47     public static void main(String[] args) throws Throwable {
  48         Path dest = Paths.get(".", "my.jfr");
  49         Recording r = new Recording();
  50         r.setToDisk(true);
  51         r.enable(EventNames.OSInformation);
  52         assertEquals(r.getSize(), 0L, "getSize should return 0 before recording starts");
  53         r.start();
  54         r.stop();
  55         r.dump(dest);
  56         assertTrue(Files.exists(dest), "TestGetSize recording missing: " + dest);
  57         System.out.printf("%s size: %d%n", dest, Files.size(dest));
  58         System.out.printf("r.getSize(): %d%n", r.getSize());
  59         assertEquals(Files.size(dest), r.getSize(), "TestGetSize wrong recording size");
  60         r.close();
  61     }


  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.recording.misc;
  27 
  28 import static jdk.test.lib.Asserts.assertEquals;
  29 import static jdk.test.lib.Asserts.assertTrue;
  30 
  31 import java.nio.file.Files;
  32 import java.nio.file.Path;
  33 import java.nio.file.Paths;
  34 
  35 import jdk.jfr.Recording;
  36 import jdk.test.lib.jfr.EventNames;
  37 
  38 /**
  39  * @test
  40  * @summary Test recording file size with Recording.getSize()
  41  * @key jfr
  42  * @requires vm.hasJFR
  43  * @library /test/lib
  44  * @run main/othervm jdk.jfr.api.recording.misc.TestGetSize
  45  */
  46 public class TestGetSize {
  47 
  48     public static void main(String[] args) throws Throwable {
  49         Path dest = Paths.get(".", "my.jfr");
  50         Recording r = new Recording();
  51         r.setToDisk(true);
  52         r.enable(EventNames.OSInformation);
  53         assertEquals(r.getSize(), 0L, "getSize should return 0 before recording starts");
  54         r.start();
  55         r.stop();
  56         r.dump(dest);
  57         assertTrue(Files.exists(dest), "TestGetSize recording missing: " + dest);
  58         System.out.printf("%s size: %d%n", dest, Files.size(dest));
  59         System.out.printf("r.getSize(): %d%n", r.getSize());
  60         assertEquals(Files.size(dest), r.getSize(), "TestGetSize wrong recording size");
  61         r.close();
  62     }
< prev index next >