blob: 4ef33e6992815c022a3568a459bfd14774443f3b [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/globals.h"
#if defined(HOST_OS_MACOS) && !defined(PRODUCT)
#include "vm/timeline.h"
namespace dart {
TimelineEventPlatformRecorder::TimelineEventPlatformRecorder(intptr_t capacity)
: TimelineEventFixedBufferRecorder(capacity) {
OS::PrintErr(
"Warning: The systrace timeline recorder is equivalent to the"
"ring recorder on this platform.");
}
TimelineEventPlatformRecorder::~TimelineEventPlatformRecorder() {}
TimelineEventPlatformRecorder*
TimelineEventPlatformRecorder::CreatePlatformRecorder(intptr_t capacity) {
return new TimelineEventPlatformRecorder(capacity);
}
const char* TimelineEventPlatformRecorder::name() const {
return "Systrace";
}
TimelineEventBlock* TimelineEventPlatformRecorder::GetNewBlockLocked() {
// TODO(johnmccutchan): This function should only hand out blocks
// which have been marked as finished.
if (block_cursor_ == num_blocks_) {
block_cursor_ = 0;
}
TimelineEventBlock* block = &blocks_[block_cursor_++];
block->Reset();
block->Open();
return block;
}
void TimelineEventPlatformRecorder::CompleteEvent(TimelineEvent* event) {
if (event == NULL) {
return;
}
ThreadBlockCompleteEvent(event);
}
} // namespace dart
#endif // defined(HOST_OS_MACOS) && !defined(PRODUCT)