Skip to content

Commit 2c790d3

Browse files
derekxu16Commit Queue
authored andcommitted
[VM/Service] Fix get_perfetto_cpu_samples_rpc_test
My change f3536c5 has made the test start failing on more configs, because now the `fib` computation isn't lasting long enough for any samples to get collected. This change makes the `fib` computation take longer. Issue: #54401 Change-Id: I0f038df21bb116f97a5093e7d2e58ccda7447977 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411161 Commit-Queue: Derek Xu <[email protected]> Reviewed-by: Liam Appelbe <[email protected]>
1 parent fb3f263 commit 2c790d3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ import 'package:vm_service_protos/vm_service_protos.dart';
1111
import 'common/service_test_common.dart';
1212
import 'common/test_helper.dart';
1313

14-
int fib(n) {
15-
if (n < 0) return 0;
16-
if (n == 0) return 1;
17-
return fib(n - 1) + fib(n - 2);
18-
}
19-
2014
void testeeDo() {
2115
print('Testee doing something.');
22-
fib(21);
16+
final stopwatch = Stopwatch();
17+
stopwatch.start();
18+
while (stopwatch.elapsedMilliseconds < 5000) {}
19+
stopwatch.stop();
2320
print('Testee did something.');
2421
}
2522

0 commit comments

Comments
 (0)