Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: runtime/vm/timeline.h

Issue 1514653002: - Assert that we do not hold the timeline lock while entering (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_TIMELINE_H_ 5 #ifndef VM_TIMELINE_H_
6 #define VM_TIMELINE_H_ 6 #define VM_TIMELINE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/bitfield.h" 9 #include "vm/bitfield.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (other->TimeEnd() > TimeEnd()) { 229 if (other->TimeEnd() > TimeEnd()) {
230 return false; 230 return false;
231 } 231 }
232 return true; 232 return true;
233 } 233 }
234 } 234 }
235 235
236 const char* GetSerializedJSON() const; 236 const char* GetSerializedJSON() const;
237 237
238 private: 238 private:
239 int64_t timestamp0_;
240 int64_t timestamp1_;
241 TimelineEventArgument* arguments_;
242 intptr_t arguments_length_;
243 uword state_;
244 const char* label_;
245 const char* category_;
246 ThreadId thread_;
247 Dart_Port isolate_id_;
248
249 void FreeArguments(); 239 void FreeArguments();
250 240
251 void StreamInit(TimelineStream* stream); 241 void StreamInit(TimelineStream* stream);
252 void Init(EventType event_type, const char* label); 242 void Init(EventType event_type, const char* label);
253 243
254 void set_event_type(EventType event_type) { 244 void set_event_type(EventType event_type) {
255 // We only reserve 4 bits to hold the event type. 245 // We only reserve 4 bits to hold the event type.
256 COMPILE_ASSERT(kNumEventTypes < 16); 246 COMPILE_ASSERT(kNumEventTypes < 16);
257 state_ = EventTypeField::update(event_type, state_); 247 state_ = EventTypeField::update(event_type, state_);
258 } 248 }
259 249
250 void set_timestamp0(int64_t value) {
251 ASSERT(timestamp0_ == 0);
252 timestamp0_ = value;
253 }
254 void set_timestamp1(int64_t value) {
255 ASSERT(timestamp1_ == 0);
256 timestamp1_ = value;
257 }
258
260 enum StateBits { 259 enum StateBits {
261 kEventTypeBit = 0, // reserve 4 bits for type. 260 kEventTypeBit = 0, // reserve 4 bits for type.
262 kNextBit = 4, 261 kNextBit = 4,
263 }; 262 };
264 263
265 class EventTypeField : public BitField<EventType, kEventTypeBit, 4> {}; 264 class EventTypeField : public BitField<EventType, kEventTypeBit, 4> {};
266 265
266 int64_t timestamp0_;
267 int64_t timestamp1_;
268 TimelineEventArgument* arguments_;
269 intptr_t arguments_length_;
270 uword state_;
271 const char* label_;
272 const char* category_;
273 ThreadId thread_;
274 Dart_Port isolate_id_;
275
267 friend class TimelineEventRecorder; 276 friend class TimelineEventRecorder;
268 friend class TimelineEventEndlessRecorder; 277 friend class TimelineEventEndlessRecorder;
269 friend class TimelineEventRingRecorder; 278 friend class TimelineEventRingRecorder;
270 friend class TimelineStream; 279 friend class TimelineStream;
271 friend class TimelineTestHelper; 280 friend class TimelineTestHelper;
272 DISALLOW_COPY_AND_ASSIGN(TimelineEvent); 281 DISALLOW_COPY_AND_ASSIGN(TimelineEvent);
273 }; 282 };
274 283
275 284
276 // A stream of timeline events. A stream has a name and can be enabled or 285 // A stream of timeline events. A stream has a name and can be enabled or
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 653
645 private: 654 private:
646 TimelineEventBlock* current_; 655 TimelineEventBlock* current_;
647 TimelineEventRecorder* recorder_; 656 TimelineEventRecorder* recorder_;
648 }; 657 };
649 658
650 659
651 } // namespace dart 660 } // namespace dart
652 661
653 #endif // VM_TIMELINE_H_ 662 #endif // VM_TIMELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698