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

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

Issue 2771293003: Resubmission of native memory allocation info surfacing in Observatory. Fixed crashing tests and st… (Closed)
Patch Set: Removed garbage code, updated status file to skip service test not supported Created 3 years, 9 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
« runtime/vm/malloc_hooks.cc ('K') | « runtime/vm/profiler.h ('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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 Profile profile(isolate); 309 Profile profile(isolate);
310 AllocationFilter filter(isolate->main_port(), class_a.id(), 310 AllocationFilter filter(isolate->main_port(), class_a.id(),
311 Dart_TimelineGetMicros(), 16000); 311 Dart_TimelineGetMicros(), 16000);
312 profile.Build(thread, &filter, Profile::kNoTags); 312 profile.Build(thread, &filter, Profile::kNoTags);
313 // We should have no allocation samples because none occured within 313 // We should have no allocation samples because none occured within
314 // the specified time range. 314 // the specified time range.
315 EXPECT_EQ(0, profile.sample_count()); 315 EXPECT_EQ(0, profile.sample_count());
316 } 316 }
317 } 317 }
318 318
319 #if defined(DART_USE_TCMALLOC) && defined(HOST_OS_LINUX) && defined(DEBUG) && \
320 defined(HOST_ARCH_x64)
319 321
320 DART_NOINLINE static void NativeAllocationSampleHelper(char** result) { 322 DART_NOINLINE static void NativeAllocationSampleHelper(char** result) {
321 ASSERT(result != NULL); 323 ASSERT(result != NULL);
322 *result = static_cast<char*>(malloc(sizeof(char) * 1024)); 324 *result = static_cast<char*>(malloc(sizeof(char) * 1024));
323 } 325 }
324 326
325 327
326 ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) { 328 ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
327 bool enable_malloc_hooks_saved = FLAG_enable_malloc_hooks; 329 bool enable_malloc_hooks_saved = FLAG_enable_malloc_hooks;
328 FLAG_enable_malloc_hooks = true; 330 FLAG_enable_malloc_hooks = true;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // We should have no allocation samples because none occured within 517 // We should have no allocation samples because none occured within
516 // the specified time range. 518 // the specified time range.
517 EXPECT_EQ(0, profile.sample_count()); 519 EXPECT_EQ(0, profile.sample_count());
518 } 520 }
519 521
520 MallocHooks::set_stack_trace_collection_enabled( 522 MallocHooks::set_stack_trace_collection_enabled(
521 stack_trace_collection_enabled); 523 stack_trace_collection_enabled);
522 MallocHooks::TearDown(); 524 MallocHooks::TearDown();
523 FLAG_enable_malloc_hooks = enable_malloc_hooks_saved; 525 FLAG_enable_malloc_hooks = enable_malloc_hooks_saved;
524 } 526 }
527 #endif // defined(DART_USE_TCMALLOC) && !defined(PRODUCT) &&
528 // !defined(TARGET_ARCH_DBC) && !defined(HOST_OS_FUCHSIA)
525 529
526 530
527 TEST_CASE(Profiler_ToggleRecordAllocation) { 531 TEST_CASE(Profiler_ToggleRecordAllocation) {
528 DisableNativeProfileScope dnps; 532 DisableNativeProfileScope dnps;
529 const char* kScript = 533 const char* kScript =
530 "class A {\n" 534 "class A {\n"
531 " var a;\n" 535 " var a;\n"
532 " var b;\n" 536 " var b;\n"
533 "}\n" 537 "}\n"
534 "class B {\n" 538 "class B {\n"
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); 2805 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString());
2802 // Verify exclusive ticks in main. 2806 // Verify exclusive ticks in main.
2803 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); 2807 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString());
2804 // Verify inclusive ticks in main. 2808 // Verify inclusive ticks in main.
2805 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); 2809 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString());
2806 } 2810 }
2807 2811
2808 #endif // !PRODUCT 2812 #endif // !PRODUCT
2809 2813
2810 } // namespace dart 2814 } // namespace dart
OLDNEW
« runtime/vm/malloc_hooks.cc ('K') | « runtime/vm/profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698