author | mgronlun |
Sun, 15 Sep 2019 13:41:19 +0200 | |
branch | JEP-349-branch |
changeset 58157 | 9dca61a7df19 |
parent 57983 | a57907813a83 |
parent 58132 | caa25ab47aca |
child 58184 | 2bc0dc4b7119 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50703
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
50113 | 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50703
diff
changeset
|
25 |
#ifndef SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTMANAGER_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50703
diff
changeset
|
26 |
#define SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTMANAGER_HPP |
50113 | 27 |
|
28 |
#include "jfr/recorder/storage/jfrBuffer.hpp" |
|
29 |
#include "jfr/recorder/storage/jfrMemorySpace.hpp" |
|
30 |
#include "jfr/recorder/storage/jfrMemorySpaceRetrieval.hpp" |
|
31 |
||
32 |
class JfrCheckpointManager; |
|
33 |
class JfrChunkWriter; |
|
34 |
class JfrSerializer; |
|
35 |
class JfrTypeManager; |
|
36 |
class Mutex; |
|
37 |
class Thread; |
|
38 |
||
39 |
struct JfrCheckpointEntry { |
|
40 |
jlong size; |
|
41 |
jlong start_time; |
|
42 |
jlong duration; |
|
43 |
juint flushpoint; |
|
44 |
juint nof_segments; |
|
45 |
}; |
|
46 |
||
47 |
typedef JfrMemorySpace<JfrBuffer, JfrMspaceSequentialRetrieval, JfrCheckpointManager> JfrCheckpointMspace; |
|
48 |
||
49 |
// |
|
50 |
// Responsible for maintaining checkpoints and by implication types. |
|
51 |
// A checkpoint is an event that has a payload consisting of constant types. |
|
52 |
// A constant type is a binary relation, a set of key-value pairs. |
|
53 |
// |
|
54 |
class JfrCheckpointManager : public JfrCHeapObj { |
|
55 |
public: |
|
56 |
typedef JfrCheckpointMspace::Type Buffer; |
|
57 |
private: |
|
58 |
JfrCheckpointMspace* _free_list_mspace; |
|
59 |
JfrCheckpointMspace* _epoch_transition_mspace; |
|
60 |
Mutex* _lock; |
|
61 |
const Thread* _service_thread; |
|
62 |
JfrChunkWriter& _chunkwriter; |
|
63 |
bool _checkpoint_epoch_state; |
|
64 |
||
65 |
// mspace callback |
|
66 |
void register_full(Buffer* t, Thread* thread); |
|
67 |
void lock(); |
|
68 |
void unlock(); |
|
69 |
DEBUG_ONLY(bool is_locked() const;) |
|
70 |
||
57882 | 71 |
JfrCheckpointMspace* lookup(Buffer* old) const; |
72 |
||
50113 | 73 |
static Buffer* lease_buffer(Thread* t, size_t size = 0); |
57882 | 74 |
static Buffer* lease_buffer(Buffer* old, Thread* t, size_t size = 0); |
50113 | 75 |
static Buffer* flush(Buffer* old, size_t used, size_t requested, Thread* t); |
76 |
||
77 |
size_t clear(); |
|
78 |
size_t write(); |
|
57360 | 79 |
size_t write_constants(); |
80 |
size_t flush(); |
|
50113 | 81 |
size_t write_epoch_transition_mspace(); |
82 |
size_t write_types(); |
|
57882 | 83 |
size_t write_threads(); |
57360 | 84 |
size_t write_metadata_event(); |
50113 | 85 |
void write_type_set(); |
86 |
void shift_epoch(); |
|
87 |
void synchronize_epoch(); |
|
88 |
bool use_epoch_transition_mspace(const Thread* t) const; |
|
57360 | 89 |
void notify_threads(); |
90 |
void notify_types_on_rotation(); |
|
57934 | 91 |
bool is_type_set_required(); |
92 |
bool is_constant_set_required(); |
|
50113 | 93 |
|
94 |
JfrCheckpointManager(JfrChunkWriter& cw); |
|
95 |
~JfrCheckpointManager(); |
|
96 |
||
97 |
static JfrCheckpointManager& instance(); |
|
98 |
static JfrCheckpointManager* create(JfrChunkWriter& cw); |
|
99 |
bool initialize(); |
|
100 |
static void destroy(); |
|
101 |
||
102 |
public: |
|
103 |
void register_service_thread(const Thread* t); |
|
57360 | 104 |
size_t flush_type_set(); |
57934 | 105 |
void flush_constant_set(); |
50113 | 106 |
static void write_type_set_for_unloaded_classes(); |
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57934
diff
changeset
|
107 |
static void create_thread_blob(Thread* t); |
57360 | 108 |
static void write_thread_checkpoint(Thread* t); |
50113 | 109 |
|
110 |
friend class JfrRecorder; |
|
111 |
friend class JfrRecorderService; |
|
112 |
friend class JfrCheckpointFlush; |
|
113 |
friend class JfrCheckpointWriter; |
|
114 |
friend class JfrSerializer; |
|
115 |
friend class JfrStackTraceRepository; |
|
116 |
template <typename, template <typename> class, typename> |
|
117 |
friend class JfrMemorySpace; |
|
118 |
}; |
|
119 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50703
diff
changeset
|
120 |
#endif // SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTMANAGER_HPP |