src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp
changeset 58863 c16ac7a2eba4
parent 58132 caa25ab47aca
child 59226 a0f39cc47387
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
       
     1 /*
       
     2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     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
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  *
       
    23  */
       
    24 
       
    25 #ifndef SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP
       
    26 #define SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP
       
    27 
       
    28 #include "jfr/utilities/jfrAllocation.hpp"
       
    29 
       
    30 const u1 COMPLETE = 0;
       
    31 const u1 GUARD = 0xff;
       
    32 const u1 PAD = 0;
       
    33 
       
    34 class JfrChunk : public JfrCHeapObj {
       
    35   friend class JfrChunkWriter;
       
    36   friend class JfrChunkHeadWriter;
       
    37  private:
       
    38   char* _path;
       
    39   int64_t _start_ticks;
       
    40   int64_t _previous_start_ticks;
       
    41   int64_t _start_nanos;
       
    42   int64_t _previous_start_nanos;
       
    43   int64_t _last_update_nanos;
       
    44   int64_t _last_checkpoint_offset;
       
    45   int64_t _last_metadata_offset;
       
    46   mutable u1 _generation;
       
    47 
       
    48   JfrChunk();
       
    49   ~JfrChunk();
       
    50   void reset();
       
    51 
       
    52   const char* magic() const;
       
    53   u2 major_version() const;
       
    54   u2 minor_version() const;
       
    55   int64_t cpu_frequency() const;
       
    56   u2 capabilities() const;
       
    57 
       
    58   void update_start_ticks();
       
    59   void update_start_nanos();
       
    60   void save_current_and_update_start_ticks();
       
    61   void save_current_and_update_start_nanos();
       
    62 
       
    63   int64_t last_checkpoint_offset() const;
       
    64   void set_last_checkpoint_offset(int64_t offset);
       
    65 
       
    66   int64_t last_metadata_offset() const;
       
    67   void set_last_metadata_offset(int64_t offset);
       
    68   bool has_metadata() const;
       
    69 
       
    70   int64_t start_ticks() const;
       
    71   int64_t start_nanos() const;
       
    72 
       
    73   int64_t previous_start_ticks() const;
       
    74   int64_t previous_start_nanos() const;
       
    75   int64_t last_chunk_duration() const;
       
    76 
       
    77   void set_time_stamp();
       
    78   void update_current_nanos();
       
    79 
       
    80   void set_path(const char* path);
       
    81   const char* path() const;
       
    82 
       
    83   bool is_started() const;
       
    84   bool is_finished() const;
       
    85 
       
    86   int64_t duration() const;
       
    87   u1 generation() const;
       
    88   u1 next_generation() const;
       
    89 };
       
    90 
       
    91 #endif // SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP