src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp
author mgronlun
Wed, 30 Oct 2019 19:43:52 +0100
changeset 58863 c16ac7a2eba4
parent 58132 src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp@caa25ab47aca
child 59226 a0f39cc47387
permissions -rw-r--r--
8226511: Implement JFR Event Streaming Reviewed-by: egahlin, mseledtsov, mgronlun Contributed-by: erik.gahlin@oracle.com, mikhailo.seledtsov@oracle.com, markus.gronlund@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50113
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     4
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     8
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    13
 * accompanied this code).
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    14
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    18
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    21
 * questions.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    22
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    23
 */
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    24
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    25
#ifndef SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    26
#define SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    27
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    28
#include "jfr/utilities/jfrAllocation.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    29
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    30
const u1 COMPLETE = 0;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    31
const u1 GUARD = 0xff;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    32
const u1 PAD = 0;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    33
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    34
class JfrChunk : public JfrCHeapObj {
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    35
  friend class JfrChunkWriter;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    36
  friend class JfrChunkHeadWriter;
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    37
 private:
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    38
  char* _path;
53897
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    39
  int64_t _start_ticks;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    40
  int64_t _previous_start_ticks;
53897
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    41
  int64_t _start_nanos;
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    42
  int64_t _previous_start_nanos;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    43
  int64_t _last_update_nanos;
58132
caa25ab47aca 8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents: 53897
diff changeset
    44
  int64_t _last_checkpoint_offset;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    45
  int64_t _last_metadata_offset;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    46
  mutable u1 _generation;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    47
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    48
  JfrChunk();
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    49
  ~JfrChunk();
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    50
  void reset();
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    51
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    52
  const char* magic() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    53
  u2 major_version() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    54
  u2 minor_version() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    55
  int64_t cpu_frequency() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    56
  u2 capabilities() const;
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    57
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    58
  void update_start_ticks();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    59
  void update_start_nanos();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    60
  void save_current_and_update_start_ticks();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    61
  void save_current_and_update_start_nanos();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    62
58132
caa25ab47aca 8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents: 53897
diff changeset
    63
  int64_t last_checkpoint_offset() const;
caa25ab47aca 8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents: 53897
diff changeset
    64
  void set_last_checkpoint_offset(int64_t offset);
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    65
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    66
  int64_t last_metadata_offset() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    67
  void set_last_metadata_offset(int64_t offset);
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    68
  bool has_metadata() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    69
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    70
  int64_t start_ticks() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    71
  int64_t start_nanos() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    72
53897
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    73
  int64_t previous_start_ticks() const;
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    74
  int64_t previous_start_nanos() const;
0abec72a3ac2 8217647: JFR: recordings on 32-bit systems unreadable
bulasevich
parents: 53244
diff changeset
    75
  int64_t last_chunk_duration() const;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    76
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    77
  void set_time_stamp();
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    78
  void update_current_nanos();
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    79
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    80
  void set_path(const char* path);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    81
  const char* path() const;
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    82
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    83
  bool is_started() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    84
  bool is_finished() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    85
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    86
  int64_t duration() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    87
  u1 generation() const;
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    88
  u1 next_generation() const;
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    89
};
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    90
58863
c16ac7a2eba4 8226511: Implement JFR Event Streaming
mgronlun
parents: 58132
diff changeset
    91
#endif // SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP