equal
deleted
inserted
replaced
30 #include "jfr/utilities/jfrTypes.hpp" |
30 #include "jfr/utilities/jfrTypes.hpp" |
31 #include "runtime/os.inline.hpp" |
31 #include "runtime/os.inline.hpp" |
32 |
32 |
33 static const char* const MAGIC = "FLR"; |
33 static const char* const MAGIC = "FLR"; |
34 static const u2 JFR_VERSION_MAJOR = 2; |
34 static const u2 JFR_VERSION_MAJOR = 2; |
35 static const u2 JFR_VERSION_MINOR = 0; |
35 static const u2 JFR_VERSION_MINOR = 1; |
36 |
36 |
|
37 // strictly monotone |
37 static jlong nanos_now() { |
38 static jlong nanos_now() { |
38 return os::javaTimeMillis() * JfrTimeConverter::NANOS_PER_MILLISEC; |
39 static jlong last = 0; |
|
40 const jlong now = os::javaTimeMillis() * JfrTimeConverter::NANOS_PER_MILLISEC; |
|
41 if (now > last) { |
|
42 last = now; |
|
43 } else { |
|
44 ++last; |
|
45 } |
|
46 return last; |
39 } |
47 } |
40 |
48 |
41 static jlong ticks_now() { |
49 static jlong ticks_now() { |
42 return JfrTicks::now(); |
50 return JfrTicks::now(); |
43 } |
51 } |
120 void JfrChunk::update_start_ticks() { |
128 void JfrChunk::update_start_ticks() { |
121 _start_ticks = ticks_now(); |
129 _start_ticks = ticks_now(); |
122 } |
130 } |
123 |
131 |
124 void JfrChunk::update_start_nanos() { |
132 void JfrChunk::update_start_nanos() { |
125 _start_nanos = _last_update_nanos = nanos_now(); |
133 const jlong now = nanos_now(); |
|
134 assert(now > _start_nanos, "invariant"); |
|
135 assert(now > _last_update_nanos, "invariant"); |
|
136 _start_nanos = _last_update_nanos = now; |
126 } |
137 } |
127 |
138 |
128 void JfrChunk::update_current_nanos() { |
139 void JfrChunk::update_current_nanos() { |
129 _last_update_nanos = nanos_now(); |
140 const jlong now = nanos_now(); |
|
141 assert(now > _last_update_nanos, "invariant"); |
|
142 _last_update_nanos = now; |
130 } |
143 } |
131 |
144 |
132 void JfrChunk::save_current_and_update_start_ticks() { |
145 void JfrChunk::save_current_and_update_start_ticks() { |
133 _previous_start_ticks = _start_ticks; |
146 _previous_start_ticks = _start_ticks; |
134 update_start_ticks(); |
147 update_start_ticks(); |