RFR: 8256156: JFR: Allow 'jfr' tool to show metadata without a recording [v4]

Yang Yi github.com+5010047+kelthuzadx at openjdk.java.net
Fri Jan 8 10:08:10 UTC 2021


On Fri, 8 Jan 2021 04:15:05 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> Yang Yi has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>> 
>>   Allow jfr tool to show metadata without a recording
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java line 200:
> 
>> 198:                 prettyWriter.flush(true);
>> 199:             }
>> 200:         } catch (Exception e) {
> 
> This error handling seems inadequate. If there is IOException, it still makes sense to get proper message, and not a stack trace

Fixed

> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java line 183:
> 
>> 181:                 }
>> 182:                 if (foundEventFilter) {
>> 183:                     if (acceptedEvents.contains(type.getName())) {
> 
> I would expect filtering for the metadata command to work like the 'print' command (accepting acronyms, wildcards etc.)

Added.

> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java line 211:
> 
>> 209:             String[] categories = categoryAnno.value();
>> 210:             for (String category : categories) {
>> 211:                 if (categoryNames.contains(category)) {
> 
> I would expect filtering for the metadata command to work like the 'print' command (wildcards etc.)

Added.

> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java line 241:
> 
> 
> Inadequate error handling. If there is something wrong with the file (permission etc) I like to know it, and not get the event types for the current JVM.

It would not swallow the exception now.

> test/jdk/jdk/jfr/tool/TestMetadata.java line 94:
> 
>> 92:             }
>> 93:         }
>> 94:         List<Type> eventTypes = TypeLibrary.getInstance().getTypes();
> 
> I think it would be better to use public API (FlightRecorder.getEventTypes()) instead of calling internals.

Changed.

> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java line 110:
> 
>> 108:     public List<String> getOptionSyntax() {
>> 109:         List<String> list = new ArrayList<>();
>> 110:         list.add("[--categories <filter>]");
> 
> I think ine would like to get similar help as for the ''print' command when it comes to filtering.

Added.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1904


More information about the hotspot-jfr-dev mailing list