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

Unified Diff: test/cctest/test-trace-event.cc

Issue 1704253002: Reland: Add Scoped Context Info (Isolate) to V8 Traces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/test-incremental-marking.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-trace-event.cc
diff --git a/test/cctest/test-trace-event.cc b/test/cctest/test-trace-event.cc
index a889e088f667dcdcd5907b8e2c48a5459920c920..4fb3ad067e03f63dc8ec1a4c14644838ac045c8f 100644
--- a/test/cctest/test-trace-event.cc
+++ b/test/cctest/test-trace-event.cc
@@ -72,8 +72,8 @@ class MockTracingPlatform : public v8::Platform {
void PerformDelayedTask() {}
uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag,
- const char* name, uint64_t id, uint64_t bind_id,
- int num_args, const char** arg_names,
+ const char* name, const char* scope, uint64_t id,
+ uint64_t bind_id, int num_args, const char** arg_names,
const uint8_t* arg_types, const uint64_t* arg_values,
unsigned int flags) override {
MockTraceObject* to = new MockTraceObject(phase, std::string(name), id,
@@ -82,6 +82,15 @@ class MockTracingPlatform : public v8::Platform {
return 0;
}
+ // TODO(fmeawad): Remove once all embedders implement the scope version.
+ uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag,
+ const char* name, uint64_t id, uint64_t bind_id,
+ int num_args, const char** arg_names,
+ const uint8_t* arg_types, const uint64_t* arg_values,
+ unsigned int flags) override {
+ return 0;
+ }
+
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name, uint64_t handle) override {}
@@ -256,3 +265,27 @@ TEST(TestEventWithId) {
i::V8::SetPlatformForTesting(old_platform);
}
+
+TEST(TestEventInContext) {
+ v8::Platform* old_platform = i::V8::GetCurrentPlatform();
+ MockTracingPlatform platform(old_platform);
+ i::V8::SetPlatformForTesting(&platform);
+
+ static uint64_t isolate_id = 0x20151021;
+ {
+ TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_id);
+ TRACE_EVENT0("v8-cat", "e");
+ }
+
+ CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->length());
+ CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase);
+ CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name);
+ CHECK_EQ(isolate_id, GET_TRACE_OBJECT(0)->id);
+ CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase);
+ CHECK_EQ("e", GET_TRACE_OBJECT(1)->name);
+ CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase);
+ CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name);
+ CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id);
+
+ i::V8::SetPlatformForTesting(old_platform);
+}
« no previous file with comments | « test/cctest/heap/test-incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698