mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
3d21a46b72
Avoids string copies in C++ and map copies in Dart. Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline. Change-Id: I962a67093ba461c991d9169b0391c44af1d489db Bug: https://github.com/dart-lang/sdk/issues/30787 Reviewed-on: https://dart-review.googlesource.com/6762 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Zach Anderson <zra@google.com>
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
// 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)
|