Commit 10be5423 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cpu-profiler] Speed up Inlining2 test by using a min num of samples

This test tried to get enough samples by varying the amount of work
done based on simulator vs. non-simulator builds. This didn't take
into account other things like release vs. debug, and some bots took
a very long time to run this test.

This CL uses the existing ProfilerHelper and sets a minimum number of
samples so that we can actually run the minimum amount of work for
any platform without manual tweaking.

This decreases runtime on x64.optdebug from 18.5 to 1.08s, and from
10+ min on x64.debug to 1.8s. arm.debug is ~4s now.

Bug: v8:10013
Change-Id: Ibdbdec00a300683554e3c67013e56d27dc7e6257
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1981504
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65574}
parent ac0c6331
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
############################################################################ ############################################################################
# Slow tests. # Slow tests.
'test-cpu-profiler/Inlining2': [PASS, SLOW],
'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]], 'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]],
'test-heap-profiler/ManyLocalsInSharedContext': [PASS, SLOW], 'test-heap-profiler/ManyLocalsInSharedContext': [PASS, SLOW],
'test-jump-table-assembler/JumpTablePatchingStress': [PASS, SLOW], 'test-jump-table-assembler/JumpTablePatchingStress': [PASS, SLOW],
...@@ -203,7 +202,6 @@ ...@@ -203,7 +202,6 @@
['is_full_debug', { ['is_full_debug', {
# Tests too slow in non-optimized debug mode. # Tests too slow in non-optimized debug mode.
'test-api/InternalFieldsSubclassing': [SKIP], 'test-api/InternalFieldsSubclassing': [SKIP],
'test-cpu-profiler/Inlining2': [SKIP],
'test-heap/TestInternalWeakLists': [SKIP], 'test-heap/TestInternalWeakLists': [SKIP],
}], # 'is_full_debug' }], # 'is_full_debug'
......
...@@ -1819,31 +1819,24 @@ const double load_factor = 1.0; ...@@ -1819,31 +1819,24 @@ const double load_factor = 1.0;
TEST(Inlining2) { TEST(Inlining2) {
FLAG_allow_natives_syntax = true; FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = CcTest::isolate(); v8::Isolate* isolate = CcTest::isolate();
LocalContext env;
v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Local<v8::Context> env = CcTest::NewContext({PROFILER_EXTENSION_ID}); ProfilerHelper helper(env.local());
v8::Context::Scope context_scope(env);
CompileRun(inlining_test_source2); CompileRun(inlining_test_source2);
v8::Local<v8::Function> function = GetFunction(env, "start"); v8::Local<v8::Function> function = GetFunction(env.local(), "start");
v8::CpuProfiler* profiler = v8::CpuProfiler::New(CcTest::isolate());
v8::Local<v8::String> profile_name = v8_str("inlining");
profiler->StartProfiling(
profile_name,
v8::CpuProfilingOptions{v8::CpuProfilingMode::kCallerLineNumbers});
v8::Local<v8::Value> args[] = { v8::Local<v8::Value> args[] = {v8::Integer::New(env->GetIsolate(), 20)};
v8::Integer::New(env->GetIsolate(), 50000 * load_factor)}; static const unsigned min_samples = 4000;
function->Call(env, env->Global(), arraysize(args), args).ToLocalChecked(); static const unsigned min_ext_samples = 0;
v8::CpuProfile* profile = profiler->StopProfiling(profile_name); v8::CpuProfile* profile =
helper.Run(function, args, arraysize(args), min_samples, min_ext_samples,
v8::CpuProfilingMode::kCallerLineNumbers);
CHECK(profile); CHECK(profile);
// Dump collected profile to have a better diagnostic in case of failure.
reinterpret_cast<i::CpuProfile*>(profile)->Print();
const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* root = profile->GetTopDownRoot();
const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start");
NameLinePair l421_a17[] = {{"level1", 27}, NameLinePair l421_a17[] = {{"level1", 27},
{"level2", 23}, {"level2", 23},
...@@ -1875,7 +1868,6 @@ TEST(Inlining2) { ...@@ -1875,7 +1868,6 @@ TEST(Inlining2) {
CheckBranch(start_node, action_direct, arraysize(action_direct)); CheckBranch(start_node, action_direct, arraysize(action_direct));
profile->Delete(); profile->Delete();
profiler->Dispose();
} }
static const char* cross_script_source_a = R"( static const char* cross_script_source_a = R"(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment