author | mgronlun |
Mon, 02 Sep 2019 19:42:46 +0200 | |
branch | JEP-349-branch |
changeset 57983 | a57907813a83 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52850
diff
changeset
|
2 |
* Copyright (c) 2017, 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:
52850
diff
changeset
|
25 |
#ifndef SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52850
diff
changeset
|
26 |
#define SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP |
50113 | 27 |
#include "jfr/utilities/jfrAllocation.hpp" |
28 |
#include "jfr/utilities/jfrDoublyLinkedList.hpp" |
|
29 |
||
30 |
class ObjectSample; |
|
31 |
||
32 |
class SampleList : public JfrCHeapObj { |
|
33 |
typedef JfrDoublyLinkedList<ObjectSample> List; |
|
34 |
private: |
|
35 |
List _free_list; |
|
36 |
List _in_use_list; |
|
37 |
const ObjectSample* _last_resolved; |
|
38 |
mutable size_t _allocated; |
|
39 |
const size_t _limit; |
|
40 |
const size_t _cache_size; |
|
41 |
||
42 |
void populate_cache(); |
|
43 |
ObjectSample* newSample() const; |
|
44 |
void link(ObjectSample* sample); |
|
45 |
void unlink(ObjectSample* sample); |
|
46 |
void deallocate_samples(List& list); |
|
47 |
void reset(ObjectSample* sample); |
|
48 |
||
49 |
public: |
|
50 |
SampleList(size_t limit, size_t cache_size = 0); |
|
51 |
~SampleList(); |
|
52 |
||
53 |
ObjectSample* get(); |
|
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
53244
diff
changeset
|
54 |
ObjectSample* first() const; |
50113 | 55 |
ObjectSample* last() const; |
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
53244
diff
changeset
|
56 |
const ObjectSample* last_resolved() const; |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
53244
diff
changeset
|
57 |
void set_last_resolved(const ObjectSample* sample); |
50113 | 58 |
void release(ObjectSample* sample); |
59 |
ObjectSample* reuse(ObjectSample* sample); |
|
60 |
bool is_full() const; |
|
61 |
size_t count() const; |
|
62 |
}; |
|
63 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52850
diff
changeset
|
64 |
#endif // SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP |