Skip to content

Commit a2cb747

Browse files
jensjohaCommit Queue
authored andcommitted
[analyzer] Allow server benchmark to launch via aot + perf
By changing a benchmark to say ``` LaunchFrom get launchFrom => LaunchFrom.AotWithPerf; ``` and compiling the server with aot: ``` out/ReleaseX64/dart-sdk/bin/dart compile aot-snapshot pkg/analysis_server/bin/server.dart ``` running the benchmark will run from the aot snapshot and automatically launch `perf`, allowing one to do `perf report` after to get a profile of the entire benchmark. Change-Id: Idd5c576129acaf4756befb22f9832b24f93b1583 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426480 Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Jens Johansen <[email protected]>
1 parent 9429d56 commit a2cb747

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ abstract class DartLanguageServerBenchmark {
283283
'--port=9102',
284284
...cacheFolderArgs,
285285
]);
286+
case LaunchFrom.AotWithPerf:
286287
case LaunchFrom.Aot:
287288
File serverFile = File.fromUri(
288289
repoDir.resolve('pkg/analysis_server/bin/server.aot'),
@@ -298,12 +299,22 @@ abstract class DartLanguageServerBenchmark {
298299
if (!aotRuntime.existsSync()) {
299300
throw "Couldn't find 'dartaotruntime' expected it at $aotRuntime";
300301
}
302+
301303
p = await Process.start(aotRuntime.path, [
302304
serverFile.path,
303305
lsp ? '--protocol=lsp' : '--protocol=analyzer',
304306
'--port=9102',
305307
...cacheFolderArgs,
306308
]);
309+
310+
if (launchFrom == LaunchFrom.AotWithPerf) {
311+
await Process.start('perf', [
312+
'record',
313+
'-p',
314+
'${p.pid}',
315+
'-g',
316+
], mode: ProcessStartMode.inheritStdio);
317+
}
307318
}
308319

309320
// ignore: unawaited_futures
@@ -487,7 +498,7 @@ class DurationInfo {
487498
DurationInfo(this.name, this.duration);
488499
}
489500

490-
enum LaunchFrom { Source, Dart, Aot }
501+
enum LaunchFrom { Source, Dart, Aot, AotWithPerf }
491502

492503
class MemoryInfo {
493504
final String name;

0 commit comments

Comments
 (0)