[vm] Add a timeline stream for recording the zone high watermark.

Change-Id: Ic7f899dbb29eb732b54d7164968a176d7b1025b9
Reviewed-on: https://dart-review.googlesource.com/45544
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Ryan Macnak 2018-03-16 17:43:27 +00:00 committed by commit-bot@chromium.org
parent 9a20a001a6
commit 8590919ca6
5 changed files with 32 additions and 6 deletions

View file

@ -75,6 +75,10 @@ void allEventsHaveIsolateNumber(List events) {
// Skip meta-data events.
continue;
}
if (event['ph'] == 'C') {
// Skip counter events, where an isolate id makes Catapult hard to read.
continue;
}
if (event['name'] == 'Runnable' && event['ph'] == 'i') {
// Skip Runnable events which don't have an isolate.
continue;

View file

@ -2709,8 +2709,6 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
thread = thread_registry()->GetFreeThreadLocked(this, is_mutator);
ASSERT(thread != NULL);
thread->ResetHighWatermark();
// Set up other values and set the TLS value.
thread->isolate_ = this;
ASSERT(heap() != NULL);
@ -2731,6 +2729,8 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
}
Thread::SetCurrent(thread);
os_thread->EnableThreadInterrupts();
thread->ResetHighWatermark();
}
return thread;
}

View file

@ -457,6 +457,25 @@ bool Thread::ZoneIsOwnedByThread(Zone* zone) const {
return false;
}
void Thread::SetHighWatermark(intptr_t value) {
zone_high_watermark_ = value;
#if !defined(PRODUCT)
if ((isolate()->name() != NULL)) {
TimelineEvent* event = Timeline::GetZoneStream()->StartEvent();
if (event != NULL) {
event->Counter(strdup(isolate()->name()));
event->set_owns_label(true);
// Prevent Catapult from showing "isolateId" as another series.
event->set_isolate_id(ILLEGAL_PORT);
event->SetNumArguments(1);
event->FormatArgument(0, "zoneHighWatermark", "%" Pd, value);
event->Complete();
}
}
#endif
}
void Thread::DeferOOBMessageInterrupts() {
MonitorLocker ml(thread_lock_);
defer_oob_messages_count_++;

View file

@ -284,7 +284,7 @@ class Thread : public BaseThread {
void IncrementMemoryCapacity(uintptr_t value) {
current_zone_capacity_ += value;
if (current_zone_capacity_ > zone_high_watermark_) {
zone_high_watermark_ = current_zone_capacity_;
SetHighWatermark(current_zone_capacity_);
}
}
@ -297,7 +297,9 @@ class Thread : public BaseThread {
uintptr_t zone_high_watermark() const { return zone_high_watermark_; }
void ResetHighWatermark() { zone_high_watermark_ = current_zone_capacity_; }
void ResetHighWatermark() { SetHighWatermark(current_zone_capacity_); }
void SetHighWatermark(intptr_t value);
// The reusable api local scope for this thread.
ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; }

View file

@ -39,7 +39,8 @@ class Zone;
V(Embedder, false) \
V(GC, false) \
V(Isolate, false) \
V(VM, false)
V(VM, false) \
V(Zone, false)
// A stream of timeline events. A stream has a name and can be enabled or
// disabled (globally and per isolate).
@ -314,10 +315,10 @@ class TimelineEvent {
void PrintJSON(JSONStream* stream) const;
ThreadId thread() const { return thread_; }
void set_thread(ThreadId tid) { thread_ = tid; }
Dart_Port isolate_id() const { return isolate_id_; }
void set_isolate_id(Dart_Port id) { isolate_id_ = id; }
const char* label() const { return label_; }