Commit e20ef024 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] added Debugger.getPossibleBreakpoints perf test

We need this benchmark to measure speedup of getPossibleBreakpoints method by [1].

[1] https://chromium-review.googlesource.com/c/591027/

R=dgozman@chromium.org

Bug: none
Change-Id: I617a435d5a162800caae2fb85596839a57d4d9bd
Reviewed-on: https://chromium-review.googlesource.com/592308Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46992}
parent 793053fd
...@@ -3,9 +3,16 @@ ...@@ -3,9 +3,16 @@
// found in the LICENSE file. // found in the LICENSE file.
(function() { (function() {
new BenchmarkSuite('Debugger.paused', [10000], [ function benchy(name, test, testSetup) {
new Benchmark('Debugger.paused', false, false, 0, DebuggerPaused, Setup, TearDown), new BenchmarkSuite(name, [10000], [
new Benchmark(name, false, false, 0, test, testSetup, TearDown)
]); ]);
}
benchy('Debugger.paused', DebuggerPaused, Setup);
benchy('Debugger.getPossibleBreakpoints',
DebuggerGetPossibleBreakpoints,
SetupGetPossibleBreakpoints);
function Setup() { function Setup() {
SendMessage('Debugger.enable'); SendMessage('Debugger.enable');
...@@ -22,4 +29,32 @@ ...@@ -22,4 +29,32 @@
debugger; debugger;
} }
} }
let scriptId;
function SetupGetPossibleBreakpoints() {
Setup();
let expression = '';
for (let i = 0; i < 20; ++i) {
expression += `function foo${i}(){
if (a) {
return true;
} else {
return false;
}
}\n`;
}
listener = function(msg) {
if (msg.method === "Debugger.scriptParsed") {
scriptId = msg.params.scriptId;
listener = null;
}
}
SendMessage('Runtime.evaluate', {expression});
}
function DebuggerGetPossibleBreakpoints() {
SendMessage('Debugger.getPossibleBreakpoints', {
start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}
});
}
})(); })();
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
load('../base.js'); load('../base.js');
let listener = null;
load('debugger.js'); load('debugger.js');
load('runtime.js'); load('runtime.js');
...@@ -36,3 +38,9 @@ function SendMessage(method, params) { ...@@ -36,3 +38,9 @@ function SendMessage(method, params) {
} }
send(JSON.stringify(obj)); send(JSON.stringify(obj));
} }
function receive(message) {
if (listener) {
listener(JSON.parse(message));
}
}
...@@ -570,7 +570,8 @@ ...@@ -570,7 +570,8 @@
"results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$", "results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$",
"tests": [ "tests": [
{"name": "Debugger.paused"}, {"name": "Debugger.paused"},
{"name": "Runtime.evaluate(String16Cstor)"} {"name": "Runtime.evaluate(String16Cstor)"},
{"name": "Debugger.getPossibleBreakpoints"}
] ]
} }
] ]
......
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