Commit 1b6265ef authored by alph's avatar alph Committed by Commit bot

Unflake CPU profiler tests.

Do not rely on elapsed time to collect enough samples.
Use CollectSample API function instead.

Remove checks for extra functions present in a profile, as
there in fact can be lots of native support functions.

BUG=v8:2999
LOG=N

Review URL: https://codereview.chromium.org/1665303004

Cr-Commit-Position: refs/heads/master@{#33822}
parent fe581185
......@@ -71,20 +71,9 @@
# This tests API threading, no point in running several variants.
'test-api/Threading*': [PASS, NO_VARIANTS],
# The cpu profiler tests are notoriously flaky.
# BUG(2999). (test/cpu-profiler/CollectCpuProfile)
# BUG(3287). (test-cpu-profiler/SampleWhenFrameIsNotSetup)
'test-cpu-profiler/CollectCpuProfile': [SKIP],
'test-cpu-profiler/CollectCpuProfileSamples': [SKIP],
'test-cpu-profiler/FunctionApplySample': [SKIP],
'test-cpu-profiler/FunctionCallSample': [SKIP],
'test-cpu-profiler/SampleWhenFrameIsNotSetup': [SKIP],
'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
'test-cpu-profiler/BoundFunctionCall': [SKIP],
# BUG(2999). The cpu profiler tests are notoriously flaky.
'test-cpu-profiler/CpuProfileDeepStack': [SKIP],
'test-cpu-profiler/JsNativeJsSample': [SKIP],
'test-cpu-profiler/JsNativeJsRuntimeJsSample': [SKIP],
'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP],
'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
# BUG(3525). Test crashes flakily.
'test-debug/RecursiveBreakpoints': [PASS, FLAKY],
......@@ -605,13 +594,23 @@
# TODO(rmcilroy,4680): Test assert errors.
'test-cpu-profiler/CodeEvents': [FAIL],
'test-cpu-profiler/TickEvents': [FAIL],
'test-cpu-profiler/BoundFunctionCall': [FAIL],
'test-cpu-profiler/CollectCpuProfile': [FAIL],
'test-cpu-profiler/CollectSampleAPI': [FAIL],
'test-cpu-profiler/CpuProfileDeepStack': [FAIL],
'test-cpu-profiler/FunctionApplySample': [FAIL],
'test-cpu-profiler/FunctionCallSample': [FAIL],
'test-cpu-profiler/FunctionDetails': [FAIL],
'test-cpu-profiler/HotDeoptNoFrameEntry': [FAIL],
'test-cpu-profiler/JsNative1JsNative2JsSample': [FAIL],
'test-cpu-profiler/JsNativeJsRuntimeJsSample': [FAIL],
'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [FAIL],
'test-cpu-profiler/JsNativeJsSample': [FAIL],
'test-cpu-profiler/NativeMethodUninitializedIC': [FAIL],
'test-cpu-profiler/NativeMethodMonomorphicIC': [FAIL],
'test-cpu-profiler/NativeAccessorUninitializedIC': [FAIL],
'test-cpu-profiler/NativeAccessorMonomorphicIC': [FAIL],
'test-cpu-profiler/SampleWhenFrameIsNotSetup': [FAIL],
'test-sampler-api/StackFramesConsistent': [FAIL],
'test-profile-generator/LineNumber': [FAIL],
'test-profile-generator/ProfileNodeScriptId': [FAIL],
......
......@@ -27,41 +27,35 @@
//
// Tests of profiles generator and utilities.
#include "src/base/logging.h"
#include "test/cctest/profiler-extension.h"
#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
v8::CpuProfile* ProfilerExtension::last_profile = NULL;
const char* ProfilerExtension::kSource =
"native function startProfiling();"
"native function stopProfiling();";
"native function stopProfiling();"
"native function collectSample();";
v8::Local<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (name->Equals(context, v8::String::NewFromUtf8(isolate, "startProfiling",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
if (name->Equals(context, v8_str(isolate, "startProfiling")).FromJust()) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StartProfiling);
} else if (name->Equals(context,
v8::String::NewFromUtf8(isolate, "stopProfiling",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StopProfiling);
} else {
}
if (name->Equals(context, v8_str(isolate, "stopProfiling")).FromJust()) {
return v8::FunctionTemplate::New(isolate, ProfilerExtension::StopProfiling);
}
if (name->Equals(context, v8_str(isolate, "collectSample")).FromJust()) {
return v8::FunctionTemplate::New(isolate, ProfilerExtension::CollectSample);
}
CHECK(false);
return v8::Local<v8::FunctionTemplate>();
}
}
void ProfilerExtension::StartProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
last_profile = NULL;
......@@ -71,7 +65,6 @@ void ProfilerExtension::StartProfiling(
: v8::String::Empty(args.GetIsolate()));
}
void ProfilerExtension::StopProfiling(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
......@@ -80,5 +73,10 @@ void ProfilerExtension::StopProfiling(
: v8::String::Empty(args.GetIsolate()));
}
void ProfilerExtension::CollectSample(
const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetIsolate()->GetCpuProfiler()->CollectSample();
}
} // namespace internal
} // namespace v8
......@@ -40,10 +40,13 @@ class ProfilerExtension : public v8::Extension {
ProfilerExtension() : v8::Extension("v8/profiler", kSource) { }
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name);
static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::CpuProfile* last_profile;
private:
static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
static void CollectSample(const v8::FunctionCallbackInfo<v8::Value>& args);
static const char* kSource;
};
......
This diff is collapsed.
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