author | tschatzl |
Tue, 29 May 2018 09:26:00 +0200 | |
changeset 50605 | 7f63c74f0974 |
parent 47216 | 71c04702a3d5 |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
30764 | 2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
18025 | 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 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_GCTRACETIME_HPP |
26 |
#define SHARE_VM_GC_SHARED_GCTRACETIME_HPP |
|
18025 | 27 |
|
35061 | 28 |
#include "logging/log.hpp" |
37255 | 29 |
#include "logging/logHandle.hpp" |
30 |
#include "logging/logStream.hpp" |
|
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
30764
diff
changeset
|
31 |
#include "memory/allocation.hpp" |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18025
diff
changeset
|
32 |
#include "utilities/ticks.hpp" |
18025 | 33 |
|
35061 | 34 |
class GCTraceCPUTime : public StackObj { |
35 |
bool _active; // true if times will be measured and printed |
|
36 |
double _starting_user_time; // user time at start of measurement |
|
37 |
double _starting_system_time; // system time at start of measurement |
|
38 |
double _starting_real_time; // real time at start of measurement |
|
39 |
public: |
|
40 |
GCTraceCPUTime(); |
|
41 |
~GCTraceCPUTime(); |
|
42 |
}; |
|
43 |
||
18025 | 44 |
class GCTimer; |
45 |
||
35061 | 46 |
class GCTraceTimeImpl : public StackObj { |
47 |
private: |
|
37255 | 48 |
LogTargetHandle _out_start; |
49 |
LogTargetHandle _out_stop; |
|
35061 | 50 |
bool _enabled; |
51 |
Ticks _start_ticks; |
|
18025 | 52 |
const char* _title; |
35061 | 53 |
GCCause::Cause _gc_cause; |
18025 | 54 |
GCTimer* _timer; |
35061 | 55 |
size_t _heap_usage_before; |
56 |
||
57 |
void log_start(jlong start_counter); |
|
58 |
void log_stop(jlong start_counter, jlong stop_counter); |
|
59 |
void time_stamp(Ticks& ticks); |
|
18025 | 60 |
|
61 |
public: |
|
37255 | 62 |
GCTraceTimeImpl(LogTargetHandle out_start, LogTargetHandle out_end, const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false); |
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
30764
diff
changeset
|
63 |
~GCTraceTimeImpl(); |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
30764
diff
changeset
|
64 |
}; |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
30764
diff
changeset
|
65 |
|
37255 | 66 |
template <LogLevelType Level, LogTagType T0, LogTagType T1, LogTagType T2, LogTagType T3, LogTagType T4, LogTagType GuardTag> |
67 |
class GCTraceTimeImplWrapper : public StackObj { |
|
68 |
GCTraceTimeImpl _impl; |
|
69 |
public: |
|
70 |
GCTraceTimeImplWrapper(const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false); |
|
71 |
~GCTraceTimeImplWrapper(); |
|
72 |
}; |
|
73 |
||
35061 | 74 |
// Similar to GCTraceTimeImpl but is intended for concurrent phase logging, |
75 |
// which is a bit simpler and should always print the start line, i.e. not add the "start" tag. |
|
76 |
template <LogLevelType Level, LogTagType T0, LogTagType T1 = LogTag::__NO_TAG, LogTagType T2 = LogTag::__NO_TAG, LogTagType T3 = LogTag::__NO_TAG, |
|
77 |
LogTagType T4 = LogTag::__NO_TAG, LogTagType GuardTag = LogTag::__NO_TAG> |
|
78 |
class GCTraceConcTimeImpl : public StackObj { |
|
79 |
private: |
|
80 |
bool _enabled; |
|
81 |
jlong _start_time; |
|
82 |
const char* _title; |
|
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
30764
diff
changeset
|
83 |
public: |
35061 | 84 |
GCTraceConcTimeImpl(const char* title); |
85 |
~GCTraceConcTimeImpl(); |
|
86 |
jlong start_time() { return _start_time; } |
|
18025 | 87 |
}; |
88 |
||
30764 | 89 |
#endif // SHARE_VM_GC_SHARED_GCTRACETIME_HPP |