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

Side by Side Diff: runtime/vm/profiler_test.cc

Issue 1258783005: Fix profiler exclusive code tree node counts (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 profile.Build(&filter, Profile::kNoTags); 371 profile.Build(&filter, Profile::kNoTags);
372 // We should have one allocation sample. 372 // We should have one allocation sample.
373 EXPECT_EQ(3, profile.sample_count()); 373 EXPECT_EQ(3, profile.sample_count());
374 ProfileTrieWalker walker(&profile); 374 ProfileTrieWalker walker(&profile);
375 375
376 // Exclusive code: B.boo -> main. 376 // Exclusive code: B.boo -> main.
377 walker.Reset(Profile::kExclusiveCode); 377 walker.Reset(Profile::kExclusiveCode);
378 // Move down from the root. 378 // Move down from the root.
379 EXPECT(walker.Down()); 379 EXPECT(walker.Down());
380 EXPECT_STREQ("B.boo", walker.CurrentName()); 380 EXPECT_STREQ("B.boo", walker.CurrentName());
381 EXPECT_EQ(3, walker.CurrentNodeTickCount());
381 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 382 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
382 EXPECT_EQ(3, walker.CurrentExclusiveTicks()); 383 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
383 EXPECT(walker.Down()); 384 EXPECT(walker.Down());
384 EXPECT_STREQ("main", walker.CurrentName()); 385 EXPECT_STREQ("main", walker.CurrentName());
386 EXPECT_EQ(3, walker.CurrentNodeTickCount());
385 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 387 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
386 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 388 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
387 EXPECT(!walker.Down()); 389 EXPECT(!walker.Down());
390
391 // Inclusive code: main -> B.boo.
392 walker.Reset(Profile::kInclusiveCode);
393 // Move down from the root.
394 EXPECT(walker.Down());
395 EXPECT_STREQ("main", walker.CurrentName());
396 EXPECT_EQ(3, walker.CurrentNodeTickCount());
397 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
398 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
399 EXPECT(walker.Down());
400 EXPECT_STREQ("B.boo", walker.CurrentName());
401 EXPECT_EQ(3, walker.CurrentNodeTickCount());
402 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
403 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
404 EXPECT(!walker.Down());
388 } 405 }
389 } 406 }
390 407
391 408
392 TEST_CASE(Profiler_IntrinsicAllocation) { 409 TEST_CASE(Profiler_IntrinsicAllocation) {
393 const char* kScript = "double foo(double a, double b) => a + b;"; 410 const char* kScript = "double foo(double a, double b) => a + b;";
394 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 411 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
395 EXPECT_VALID(lib); 412 EXPECT_VALID(lib);
396 Library& root_library = Library::Handle(); 413 Library& root_library = Library::Handle();
397 root_library ^= Api::UnwrapHandle(lib); 414 root_library ^= Api::UnwrapHandle(lib);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 HANDLESCOPE(isolate); 817 HANDLESCOPE(isolate);
801 Profile profile(isolate); 818 Profile profile(isolate);
802 AllocationFilter filter(isolate, one_byte_string_class.id()); 819 AllocationFilter filter(isolate, one_byte_string_class.id());
803 profile.Build(&filter, Profile::kNoTags); 820 profile.Build(&filter, Profile::kNoTags);
804 // We should now have two allocation samples. 821 // We should now have two allocation samples.
805 EXPECT_EQ(2, profile.sample_count()); 822 EXPECT_EQ(2, profile.sample_count());
806 } 823 }
807 } 824 }
808 825
809 } // namespace dart 826 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698