author | pliden |
Mon, 21 Oct 2019 09:55:58 +0200 | |
changeset 58704 | 8b16701b4636 |
parent 50525 | 767cdb97f103 |
permissions | -rw-r--r-- |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
1 |
/* |
58704
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
4 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
8 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
13 |
* accompanied this code). |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
14 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
18 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
21 |
* questions. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
22 |
*/ |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
23 |
|
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
24 |
#ifndef SHARE_GC_Z_ZTRACER_INLINE_HPP |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
25 |
#define SHARE_GC_Z_ZTRACER_INLINE_HPP |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
26 |
|
58704
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
27 |
#include "gc/z/zStat.hpp" |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
28 |
#include "gc/z/zTracer.hpp" |
58704
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
29 |
#include "jfr/jfrEvents.hpp" |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
30 |
|
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
31 |
inline ZTracer* ZTracer::tracer() { |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
32 |
return _tracer; |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
33 |
} |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
34 |
|
58704
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
35 |
inline void ZTracer::report_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
36 |
if (EventZStatisticsCounter::is_enabled()) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
37 |
send_stat_counter(counter, increment, value); |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
38 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
39 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
40 |
|
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
41 |
inline void ZTracer::report_stat_sampler(const ZStatSampler& sampler, uint64_t value) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
42 |
if (EventZStatisticsSampler::is_enabled()) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
43 |
send_stat_sampler(sampler, value); |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
44 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
45 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
46 |
|
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
47 |
inline void ZTracer::report_thread_phase(const char* name, const Ticks& start, const Ticks& end) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
48 |
if (EventZThreadPhase::is_enabled()) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
49 |
send_thread_phase(name, start, end); |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
50 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
51 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
52 |
|
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
53 |
inline void ZTracer::report_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
54 |
if (EventZPageAllocation::is_enabled()) { |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
55 |
send_page_alloc(size, used, free, cache, flags); |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
56 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
57 |
} |
8b16701b4636
8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
pliden
parents:
50525
diff
changeset
|
58 |
|
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
59 |
inline ZTraceThreadPhase::ZTraceThreadPhase(const char* name) : |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
60 |
_start(Ticks::now()), |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
61 |
_name(name) {} |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
62 |
|
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
63 |
inline ZTraceThreadPhase::~ZTraceThreadPhase() { |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
64 |
ZTracer::tracer()->report_thread_phase(_name, _start, Ticks::now()); |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
65 |
} |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
66 |
|
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
67 |
#endif // SHARE_GC_Z_ZTRACER_INLINE_HPP |