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 @@
############################################################################
# Slow tests.
'test-cpu-profiler/Inlining2': [PASS, SLOW],
'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]],
'test-heap-profiler/ManyLocalsInSharedContext': [PASS, SLOW],
'test-jump-table-assembler/JumpTablePatchingStress': [PASS, SLOW],
......@@ -203,7 +202,6 @@
['is_full_debug', {
# Tests too slow in non-optimized debug mode.
'test-api/InternalFieldsSubclassing': [SKIP],
'test-cpu-profiler/Inlining2': [SKIP],
'test-heap/TestInternalWeakLists': [SKIP],
}], # 'is_full_debug'
......
......@@ -1819,31 +1819,24 @@ const double load_factor = 1.0;
TEST(Inlining2) {
FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = CcTest::isolate();
LocalContext env;
v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> env = CcTest::NewContext({PROFILER_EXTENSION_ID});
v8::Context::Scope context_scope(env);
ProfilerHelper helper(env.local());
CompileRun(inlining_test_source2);
v8::Local<v8::Function> function = GetFunction(env, "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::Function> function = GetFunction(env.local(), "start");
v8::Local<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), 50000 * load_factor)};
function->Call(env, env->Global(), arraysize(args), args).ToLocalChecked();
v8::CpuProfile* profile = profiler->StopProfiling(profile_name);
v8::Local<v8::Value> args[] = {v8::Integer::New(env->GetIsolate(), 20)};
static const unsigned min_samples = 4000;
static const unsigned min_ext_samples = 0;
v8::CpuProfile* profile =
helper.Run(function, args, arraysize(args), min_samples, min_ext_samples,
v8::CpuProfilingMode::kCallerLineNumbers);
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* start_node = GetChild(env, root, "start");
const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start");
NameLinePair l421_a17[] = {{"level1", 27},
{"level2", 23},
......@@ -1875,7 +1868,6 @@ TEST(Inlining2) {
CheckBranch(start_node, action_direct, arraysize(action_direct));
profile->Delete();
profiler->Dispose();
}
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