Skip to content

Commit

Permalink
[nit] Fixes two typos: build flag and error string.
Browse files Browse the repository at this point in the history
Change-Id: I0e0b7a8aeb113dc82177a8e1c9acd4c3e0b715ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115706
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
  • Loading branch information
bkonyi authored and commit-bot@chromium.org committed Sep 10, 2019
1 parent 35a7f4b commit 62f78a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion runtime/bin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ void main(int argc, char** argv) {

char* error = nullptr;
if (!dart::embedder::InitOnce(&error)) {
Syslog::PrintErr("Stanalone embedder initialization failed: %s\n", error);
Syslog::PrintErr("Standalone embedder initialization failed: %s\n", error);
free(error);
Platform::Exit(kErrorExitCode);
}
Expand Down
29 changes: 12 additions & 17 deletions runtime/vm/profiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,20 +494,20 @@ ISOLATE_UNIT_TEST_CASE(Profiler_TrivialRecordAllocation) {
}

#if defined(DART_USE_TCMALLOC) && defined(HOST_OS_LINUX) && defined(DEBUG) && \
defined(HOST_ARCH_x64)
defined(HOST_ARCH_X64)

DART_NOINLINE static void NativeAllocationSampleHelper(char** result) {
ASSERT(result != NULL);
*result = static_cast<char*>(malloc(sizeof(char) * 1024));
}

ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
EnableProfiler();

bool enable_malloc_hooks_saved = FLAG_profiler_native_memory;
FLAG_profiler_native_memory = true;

MallocHooks::InitOnce();
EnableProfiler();

MallocHooks::Init();
MallocHooks::ResetStats();
bool stack_trace_collection_enabled =
MallocHooks::stack_trace_collection_enabled();
Expand Down Expand Up @@ -536,31 +536,27 @@ ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
// Filter for the class in the time range.
NativeAllocationSampleFilter filter(before_allocations_micros,
allocation_extent_micros);
profile.Build(thread, &filter, Profiler::sample_buffer());
profile.Build(thread, &filter, Profiler::allocation_sample_buffer());
// We should have 1 allocation sample.
EXPECT_EQ(1, profile.sample_count());
ProfileStackWalker walker(&profile)
ProfileStackWalker walker(&profile);

// Move down from the root.
EXPECT(walker.Down());
// Move down from the root.
EXPECT_SUBSTRING("[Native]", walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT_EQ(1024ul, profile.SampleAt(0)->native_allocation_size_bytes());
EXPECT(walker.Down());
EXPECT_STREQ("dart::Dart_TestProfiler_NativeAllocation()",
walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT(walker.Down());
EXPECT_STREQ("dart::TestCase::Run()", walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT(walker.Down());
EXPECT_STREQ("dart::TestCaseBase::RunTest()", walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT(walker.Down());
EXPECT_STREQ("dart::TestCaseBase::RunAll()", walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT(walker.Down());
EXPECT_SUBSTRING("[Native]", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("main", walker.CurrentName());
EXPECT_EQ(walker.native_allocation_size_bytes(), 1024);
EXPECT(!walker.Down());
}

Expand Down Expand Up @@ -601,11 +597,10 @@ ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {

MallocHooks::set_stack_trace_collection_enabled(
stack_trace_collection_enabled);
MallocHooks::TearDown();
FLAG_profiler_native_memory = enable_malloc_hooks_saved;
}
#endif // defined(DART_USE_TCMALLOC) && !defined(PRODUCT) &&
// !defined(TARGET_ARCH_DBC) && !defined(HOST_OS_FUCHSIA)
#endif // defined(DART_USE_TCMALLOC) && defined(HOST_OS_LINUX) && \
// defined(DEBUG) && defined(HOST_ARCH_X64)

ISOLATE_UNIT_TEST_CASE(Profiler_ToggleRecordAllocation) {
EnableProfiler();
Expand Down

0 comments on commit 62f78a7

Please sign in to comment.