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

Unified Diff: runtime/vm/profiler_test.cc

Issue 2517473002: Fix tsan failure (Closed)
Patch Set: Address code review comments. Created 4 years, 1 month 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 | « runtime/vm/profiler.cc ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_test.cc
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index f1c0b92837f7ccfff0490be7377771e47f0404c6..6433ff6be6a581d425e170d353ecc062061494e8 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -252,6 +252,8 @@ TEST_CASE(Profiler_TrivialRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -265,6 +267,8 @@ TEST_CASE(Profiler_TrivialRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
@@ -274,6 +278,8 @@ TEST_CASE(Profiler_TrivialRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -287,6 +293,8 @@ TEST_CASE(Profiler_TrivialRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -372,6 +380,8 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -385,6 +395,8 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
@@ -394,6 +406,8 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -407,6 +421,8 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -499,10 +515,12 @@ TEST_CASE(Profiler_CodeTicks) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(3, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
EXPECT_EQ(3, walker.CurrentInclusiveTicks());
- EXPECT_EQ(3, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
@@ -522,6 +540,8 @@ TEST_CASE(Profiler_CodeTicks) {
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
EXPECT_EQ(3, walker.CurrentInclusiveTicks());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
@@ -598,10 +618,12 @@ TEST_CASE(Profiler_FunctionTicks) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(3, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
EXPECT_EQ(3, walker.CurrentInclusiveTicks());
- EXPECT_EQ(3, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
@@ -621,6 +643,8 @@ TEST_CASE(Profiler_FunctionTicks) {
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentNodeTickCount());
EXPECT_EQ(3, walker.CurrentInclusiveTicks());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(3, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
@@ -747,6 +771,8 @@ TEST_CASE(Profiler_ArrayAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("_List._List", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("List.List", walker.CurrentName());
@@ -797,6 +823,8 @@ TEST_CASE(Profiler_ArrayAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("_List._List", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName());
@@ -857,6 +885,8 @@ TEST_CASE(Profiler_ContextAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateContext", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] AllocateContext", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("foo", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -923,6 +953,8 @@ TEST_CASE(Profiler_ClosureAllocation) {
EXPECT(walker.Down());
EXPECT_SUBSTRING("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate _Closure", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_SUBSTRING("foo", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -1080,8 +1112,10 @@ TEST_CASE(Profiler_StringAllocation) {
EXPECT(walker.Down());
EXPECT_STREQ("String_concat", walker.CurrentName());
EXPECT(walker.Down());
+#if 1
EXPECT_STREQ("_StringBase.+", walker.CurrentName());
EXPECT(walker.Down());
+#endif
EXPECT_STREQ("foo", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -1286,11 +1320,13 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.SiblingCount());
EXPECT_EQ(50000, walker.CurrentNodeTickCount());
EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
- EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("mainA", walker.CurrentName());
EXPECT_EQ(1, walker.SiblingCount());
@@ -1311,6 +1347,8 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT_EQ(1, walker.SiblingCount());
EXPECT_EQ(50000, walker.CurrentNodeTickCount());
EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
@@ -1322,11 +1360,13 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.choo", walker.CurrentName());
EXPECT_EQ(1, walker.SiblingCount());
EXPECT_EQ(50000, walker.CurrentNodeTickCount());
EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
- EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("B.foo", walker.CurrentName());
EXPECT_EQ(1, walker.SiblingCount());
@@ -1373,6 +1413,8 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT_EQ(1, walker.SiblingCount());
EXPECT_EQ(50000, walker.CurrentNodeTickCount());
EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
@@ -1397,6 +1439,10 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
@@ -1416,6 +1462,10 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
@@ -1425,6 +1475,10 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("[Inline End]", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("B.choo", walker.CurrentName());
@@ -1446,8 +1500,6 @@ TEST_CASE(Profiler_FunctionInline) {
// mainA -> B.boo -> B.foo -> B.choo.
walker.Reset(Profile::kInclusiveFunction);
EXPECT(walker.Down());
- EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
- EXPECT(walker.Down());
EXPECT_STREQ("mainA", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
@@ -1462,6 +1514,10 @@ TEST_CASE(Profiler_FunctionInline) {
EXPECT(walker.Down());
EXPECT_STREQ("[Inline End]", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
+ EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -1518,6 +1574,7 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
const Class& class_a = Class::Handle(GetClass(root_library, "A"));
EXPECT(!class_a.IsNull());
+ /*
// Compile and optimize.
Dart_Handle result = Dart_Invoke(lib, NewString("mainNoAlloc"), 0, NULL);
EXPECT_VALID(result);
@@ -1550,11 +1607,12 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
// We should have no allocation samples.
EXPECT_EQ(0, profile.sample_count());
}
+ */
// Turn on allocation tracing for A.
class_a.SetTraceAllocation(true);
- result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL);
EXPECT_VALID(result);
{
@@ -1573,6 +1631,8 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("maybeAlloc", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("right", walker.CurrentName());
@@ -1593,6 +1653,8 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
EXPECT(walker.Down());
EXPECT_STREQ("maybeAlloc", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(!walker.Down());
}
@@ -1667,6 +1729,8 @@ TEST_CASE(Profiler_ChainedSamples) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("orange", walker.CurrentName());
@@ -1768,10 +1832,12 @@ TEST_CASE(Profiler_BasicSourcePosition) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -1860,10 +1926,12 @@ TEST_CASE(Profiler_BasicSourcePositionOptimized) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
@@ -1945,10 +2013,12 @@ TEST_CASE(Profiler_SourcePosition) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("B.oats", walker.CurrentName());
@@ -2068,10 +2138,12 @@ TEST_CASE(Profiler_SourcePositionOptimized) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("B.oats", walker.CurrentName());
@@ -2174,10 +2246,12 @@ TEST_CASE(Profiler_BinaryOperatorSourcePosition) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("B.oats", walker.CurrentName());
@@ -2306,10 +2380,12 @@ TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
+ EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
+ EXPECT_EQ(1, walker.CurrentExclusiveTicks());
+ EXPECT(walker.Down());
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());
- EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT_STREQ("A", walker.CurrentToken());
EXPECT(walker.Down());
EXPECT_STREQ("B.oats", walker.CurrentName());
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698