Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/shared/gcTimer.hpp @ 14442:1174c8abbdb6
Merge
author | kvn |
---|---|
date | Thu, 05 Dec 2013 15:13:12 -0800 |
parents | 86e6d691f2e1 |
children |
comparison
equal
deleted
inserted
replaced
14441:e7cbc95179c4 | 14442:1174c8abbdb6 |
---|---|
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTIMER_HPP | 26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTIMER_HPP |
27 | 27 |
28 #include "memory/allocation.hpp" | 28 #include "memory/allocation.hpp" |
29 #include "prims/jni_md.h" | 29 #include "prims/jni_md.h" |
30 #include "utilities/macros.hpp" | 30 #include "utilities/macros.hpp" |
31 #include "utilities/ticks.hpp" | |
31 | 32 |
32 class ConcurrentPhase; | 33 class ConcurrentPhase; |
33 class GCPhase; | 34 class GCPhase; |
34 class PausePhase; | 35 class PausePhase; |
35 | 36 |
43 }; | 44 }; |
44 | 45 |
45 class GCPhase { | 46 class GCPhase { |
46 const char* _name; | 47 const char* _name; |
47 int _level; | 48 int _level; |
48 jlong _start; | 49 Ticks _start; |
49 jlong _end; | 50 Ticks _end; |
50 | 51 |
51 public: | 52 public: |
52 void set_name(const char* name) { _name = name; } | 53 void set_name(const char* name) { _name = name; } |
53 const char* name() { return _name; } | 54 const char* name() const { return _name; } |
54 | 55 |
55 int level() { return _level; } | 56 int level() const { return _level; } |
56 void set_level(int level) { _level = level; } | 57 void set_level(int level) { _level = level; } |
57 | 58 |
58 jlong start() { return _start; } | 59 const Ticks start() const { return _start; } |
59 void set_start(jlong time) { _start = time; } | 60 void set_start(const Ticks& time) { _start = time; } |
60 | 61 |
61 jlong end() { return _end; } | 62 const Ticks end() const { return _end; } |
62 void set_end(jlong time) { _end = time; } | 63 void set_end(const Ticks& time) { _end = time; } |
63 | 64 |
64 virtual void accept(PhaseVisitor* visitor) = 0; | 65 virtual void accept(PhaseVisitor* visitor) = 0; |
65 }; | 66 }; |
66 | 67 |
67 class PausePhase : public GCPhase { | 68 class PausePhase : public GCPhase { |
100 | 101 |
101 // Currently we only support pause phases. | 102 // Currently we only support pause phases. |
102 GrowableArray<PausePhase>* _phases; | 103 GrowableArray<PausePhase>* _phases; |
103 PhasesStack _active_phases; | 104 PhasesStack _active_phases; |
104 | 105 |
105 jlong _sum_of_pauses; | 106 Tickspan _sum_of_pauses; |
106 jlong _longest_pause; | 107 Tickspan _longest_pause; |
107 | 108 |
108 public: | 109 public: |
109 TimePartitions(); | 110 TimePartitions(); |
110 ~TimePartitions(); | 111 ~TimePartitions(); |
111 void clear(); | 112 void clear(); |
112 | 113 |
113 void report_gc_phase_start(const char* name, jlong time); | 114 void report_gc_phase_start(const char* name, const Ticks& time); |
114 void report_gc_phase_end(jlong time); | 115 void report_gc_phase_end(const Ticks& time); |
115 | 116 |
116 int num_phases() const; | 117 int num_phases() const; |
117 GCPhase* phase_at(int index) const; | 118 GCPhase* phase_at(int index) const; |
118 | 119 |
119 jlong sum_of_pauses(); | 120 const Tickspan sum_of_pauses() const { return _sum_of_pauses; } |
120 jlong longest_pause(); | 121 const Tickspan longest_pause() const { return _longest_pause; } |
121 | 122 |
122 bool has_active_phases(); | 123 bool has_active_phases(); |
123 private: | 124 private: |
124 void update_statistics(GCPhase* phase); | 125 void update_statistics(GCPhase* phase); |
125 }; | 126 }; |
131 }; | 132 }; |
132 | 133 |
133 class GCTimer : public ResourceObj { | 134 class GCTimer : public ResourceObj { |
134 NOT_PRODUCT(friend class GCTimerTest;) | 135 NOT_PRODUCT(friend class GCTimerTest;) |
135 protected: | 136 protected: |
136 jlong _gc_start; | 137 Ticks _gc_start; |
137 jlong _gc_end; | 138 Ticks _gc_end; |
138 TimePartitions _time_partitions; | 139 TimePartitions _time_partitions; |
139 | 140 |
140 public: | 141 public: |
141 virtual void register_gc_start(jlong time); | 142 virtual void register_gc_start(const Ticks& time = Ticks::now()); |
142 virtual void register_gc_end(jlong time); | 143 virtual void register_gc_end(const Ticks& time = Ticks::now()); |
143 | 144 |
144 void register_gc_phase_start(const char* name, jlong time); | 145 void register_gc_phase_start(const char* name, const Ticks& time); |
145 void register_gc_phase_end(jlong time); | 146 void register_gc_phase_end(const Ticks& time); |
146 | 147 |
147 jlong gc_start() { return _gc_start; } | 148 const Ticks gc_start() const { return _gc_start; } |
148 jlong gc_end() { return _gc_end; } | 149 const Ticks gc_end() const { return _gc_end; } |
149 | 150 |
150 TimePartitions* time_partitions() { return &_time_partitions; } | 151 TimePartitions* time_partitions() { return &_time_partitions; } |
151 | 152 |
152 long longest_pause(); | |
153 long sum_of_pauses(); | |
154 | |
155 protected: | 153 protected: |
156 void register_gc_pause_start(const char* name, jlong time); | 154 void register_gc_pause_start(const char* name, const Ticks& time = Ticks::now()); |
157 void register_gc_pause_end(jlong time); | 155 void register_gc_pause_end(const Ticks& time = Ticks::now()); |
158 }; | 156 }; |
159 | 157 |
160 class STWGCTimer : public GCTimer { | 158 class STWGCTimer : public GCTimer { |
161 public: | 159 public: |
162 virtual void register_gc_start(jlong time); | 160 virtual void register_gc_start(const Ticks& time = Ticks::now()); |
163 virtual void register_gc_end(jlong time); | 161 virtual void register_gc_end(const Ticks& time = Ticks::now()); |
164 }; | 162 }; |
165 | 163 |
166 class ConcurrentGCTimer : public GCTimer { | 164 class ConcurrentGCTimer : public GCTimer { |
167 public: | 165 public: |
168 void register_gc_pause_start(const char* name, jlong time); | 166 void register_gc_pause_start(const char* name); |
169 void register_gc_pause_end(jlong time); | 167 void register_gc_pause_end(); |
170 }; | 168 }; |
171 | 169 |
172 class TimePartitionPhasesIterator { | 170 class TimePartitionPhasesIterator { |
173 TimePartitions* _time_partitions; | 171 TimePartitions* _time_partitions; |
174 int _next; | 172 int _next; |