author | mgronlun |
Wed, 30 Oct 2019 19:43:52 +0100 | |
changeset 58863 | c16ac7a2eba4 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
50113 | 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 | 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 |
*/ |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
24 |
#ifndef SHARE_JFR_RECORDER_STORAGE_JFRSTORAGE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
25 |
#define SHARE_JFR_RECORDER_STORAGE_JFRSTORAGE_HPP |
50113 | 26 |
|
27 |
#include "jfr/recorder/storage/jfrBuffer.hpp" |
|
28 |
#include "jfr/recorder/storage/jfrMemorySpace.hpp" |
|
29 |
#include "jfr/recorder/storage/jfrMemorySpaceRetrieval.hpp" |
|
30 |
||
31 |
class JfrChunkWriter; |
|
32 |
class JfrPostBox; |
|
33 |
class JfrStorage; |
|
34 |
class JfrStorageControl; |
|
35 |
||
36 |
typedef JfrMemorySpace<JfrBuffer, JfrMspaceAlternatingRetrieval, JfrStorage> JfrStorageMspace; |
|
37 |
typedef JfrMemorySpace<JfrBuffer, JfrThreadLocalRetrieval, JfrStorage> JfrThreadLocalMspace; |
|
38 |
typedef JfrMemorySpace<JfrAgeNode, JfrMspaceSequentialRetrieval, JfrStorage> JfrStorageAgeMspace; |
|
39 |
||
40 |
// |
|
41 |
// Responsible for providing backing storage for writing events. |
|
42 |
// |
|
43 |
class JfrStorage : public JfrCHeapObj { |
|
44 |
public: |
|
45 |
typedef JfrStorageMspace::Type Buffer; |
|
46 |
private: |
|
47 |
JfrStorageControl* _control; |
|
48 |
JfrStorageMspace* _global_mspace; |
|
49 |
JfrThreadLocalMspace* _thread_local_mspace; |
|
50 |
JfrStorageMspace* _transient_mspace; |
|
51 |
JfrStorageAgeMspace* _age_mspace; |
|
52 |
JfrChunkWriter& _chunkwriter; |
|
53 |
JfrPostBox& _post_box; |
|
54 |
||
55 |
// mspace callbacks |
|
56 |
void register_full(Buffer* t, Thread* thread); |
|
57 |
void lock(); |
|
58 |
void unlock(); |
|
59 |
DEBUG_ONLY(bool is_locked() const;) |
|
60 |
||
61 |
Buffer* acquire_large(size_t size, Thread* t); |
|
62 |
Buffer* acquire_transient(size_t size, Thread* thread); |
|
63 |
bool flush_regular_buffer(Buffer* const buffer, Thread* t); |
|
64 |
Buffer* flush_regular(Buffer* cur, const u1* cur_pos, size_t used, size_t req, bool native, Thread* t); |
|
65 |
Buffer* flush_large(Buffer* cur, const u1* cur_pos, size_t used, size_t req, bool native, Thread* t); |
|
66 |
Buffer* provision_large(Buffer* cur, const u1* cur_pos, size_t used, size_t req, bool native, Thread* t); |
|
67 |
void release(Buffer* buffer, Thread* t); |
|
68 |
||
69 |
size_t clear(); |
|
70 |
size_t clear_full(); |
|
71 |
size_t write_full(); |
|
72 |
size_t write_at_safepoint(); |
|
73 |
size_t scavenge(); |
|
74 |
||
75 |
JfrStorage(JfrChunkWriter& cw, JfrPostBox& post_box); |
|
76 |
~JfrStorage(); |
|
77 |
||
78 |
static JfrStorage& instance(); |
|
79 |
static JfrStorage* create(JfrChunkWriter& chunkwriter, JfrPostBox& post_box); |
|
80 |
bool initialize(); |
|
81 |
static void destroy(); |
|
82 |
||
83 |
public: |
|
84 |
static Buffer* acquire_thread_local(Thread* t, size_t size = 0); |
|
85 |
static void release_thread_local(Buffer* buffer, Thread* t); |
|
86 |
void release_large(Buffer* const buffer, Thread* t); |
|
87 |
static Buffer* flush(Buffer* cur, size_t used, size_t req, bool native, Thread* t); |
|
88 |
void discard_oldest(Thread* t); |
|
89 |
static JfrStorageControl& control(); |
|
90 |
||
58863 | 91 |
size_t write(); |
92 |
||
50113 | 93 |
friend class JfrRecorder; |
94 |
friend class JfrRecorderService; |
|
95 |
template <typename, template <typename> class, typename> |
|
96 |
friend class JfrMemorySpace; |
|
97 |
}; |
|
98 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
99 |
#endif // SHARE_JFR_RECORDER_STORAGE_JFRSTORAGE_HPP |