src/jdk.jfr/share/classes/jdk/jfr/consumer/ChunkParser.java
changeset 52850 f527b24990d7
parent 50113 caf115bb98ad
child 57360 5d043a159d5c
equal deleted inserted replaced
52849:eef755718cb2 52850:f527b24990d7
    51     private final MetadataDescriptor metadata;
    51     private final MetadataDescriptor metadata;
    52     private final LongMap<Type> typeMap;
    52     private final LongMap<Type> typeMap;
    53     private final TimeConverter timeConverter;
    53     private final TimeConverter timeConverter;
    54 
    54 
    55     public ChunkParser(RecordingInput input) throws IOException {
    55     public ChunkParser(RecordingInput input) throws IOException {
    56       this(new ChunkHeader(input));
    56         this(new ChunkHeader(input));
    57     }
    57     }
    58 
    58 
    59     private ChunkParser(ChunkHeader header) throws IOException {
    59     private ChunkParser(ChunkHeader header) throws IOException {
    60         this.input = header.getInput();
    60         this.input = header.getInput();
    61         this.chunkHeader = header;
    61         this.chunkHeader = header;
    62         this.metadata = header.readMetadata();
    62         this.metadata = header.readMetadata();
    63         this.absoluteChunkEnd = header.getEnd();
    63         this.absoluteChunkEnd = header.getEnd();
    64         this.timeConverter =  new TimeConverter(chunkHeader);
    64         this.timeConverter = new TimeConverter(chunkHeader, metadata.getGMTOffset());
    65 
    65 
    66         ParserFactory factory = new ParserFactory(metadata, timeConverter);
    66         ParserFactory factory = new ParserFactory(metadata, timeConverter);
    67         LongMap<ConstantMap> constantPools = factory.getConstantPools();
    67         LongMap<ConstantMap> constantPools = factory.getConstantPools();
    68         parsers = factory.getParsers();
    68         parsers = factory.getParsers();
    69         typeMap = factory.getTypeMap();
    69         typeMap = factory.getTypeMap();
   112             deltaToNext = input.readLong();
   112             deltaToNext = input.readLong();
   113             final long delta = deltaToNext;
   113             final long delta = deltaToNext;
   114             boolean flush = input.readBoolean();
   114             boolean flush = input.readBoolean();
   115             int poolCount = input.readInt();
   115             int poolCount = input.readInt();
   116             Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.TRACE, () -> {
   116             Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.TRACE, () -> {
   117                 return "New constant pool: startPosition=" + position +
   117                 return "New constant pool: startPosition=" + position + ", size=" + size + ", deltaToNext=" + delta + ", flush=" + flush + ", poolCount=" + poolCount;
   118                         ", size=" + size + ", deltaToNext=" + delta +
       
   119                         ", flush=" + flush + ", poolCount=" + poolCount;
       
   120             });
   118             });
   121 
   119 
   122             for (int i = 0; i < poolCount; i++) {
   120             for (int i = 0; i < poolCount; i++) {
   123                 long id = input.readLong(); // type id
   121                 long id = input.readLong(); // type id
   124                 ConstantMap pool = constantPools.get(id);
   122                 ConstantMap pool = constantPools.get(id);
   153         }
   151         }
   154     }
   152     }
   155 
   153 
   156     private String getName(long id) {
   154     private String getName(long id) {
   157         Type type = typeMap.get(id);
   155         Type type = typeMap.get(id);
   158         return type == null ? ("unknown(" + id +")") : type.getName();
   156         return type == null ? ("unknown(" + id + ")") : type.getName();
   159     }
   157     }
   160 
   158 
   161     public Collection<Type> getTypes() {
   159     public Collection<Type> getTypes() {
   162         return metadata.getTypes();
   160         return metadata.getTypes();
   163     }
   161     }