equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
40 |
40 |
41 import jdk.jfr.EventType; |
41 import jdk.jfr.EventType; |
42 import jdk.jfr.internal.MetadataDescriptor; |
42 import jdk.jfr.internal.MetadataDescriptor; |
43 import jdk.jfr.internal.Type; |
43 import jdk.jfr.internal.Type; |
44 import jdk.jfr.internal.consumer.ChunkHeader; |
44 import jdk.jfr.internal.consumer.ChunkHeader; |
|
45 import jdk.jfr.internal.consumer.FileAccess; |
45 import jdk.jfr.internal.consumer.RecordingInput; |
46 import jdk.jfr.internal.consumer.RecordingInput; |
46 |
47 |
47 final class Summary extends Command { |
48 final class Summary extends Command { |
48 private final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withLocale(Locale.UK).withZone(ZoneOffset.UTC); |
49 private final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withLocale(Locale.UK).withZone(ZoneOffset.UTC); |
49 |
50 |
89 |
90 |
90 private void printInformation(Path p) throws IOException { |
91 private void printInformation(Path p) throws IOException { |
91 long totalDuration = 0; |
92 long totalDuration = 0; |
92 long chunks = 0; |
93 long chunks = 0; |
93 |
94 |
94 try (RecordingInput input = new RecordingInput(p.toFile())) { |
95 try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILIGED)) { |
95 ChunkHeader first = new ChunkHeader(input); |
96 ChunkHeader first = new ChunkHeader(input); |
96 ChunkHeader ch = first; |
97 ChunkHeader ch = first; |
97 String eventPrefix = Type.EVENT_NAME_PREFIX; |
98 String eventPrefix = Type.EVENT_NAME_PREFIX; |
98 if (first.getMajor() == 1) { |
99 if (first.getMajor() == 1) { |
99 eventPrefix = "com.oracle.jdk."; |
100 eventPrefix = "com.oracle.jdk."; |