devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Profiler gives incorrect data when profiling a test vs. non-test

Open mkorbel1 opened this issue 3 months ago • 3 comments

When I run a long-running program as a test (in test/*_test.dart in a test('test name', () async { ... }) body) and profile the performance to see why it's slow, I get weird data that looks like this:

Image

I don't know where _RandomAccessFileOpsImpl.writeFrom is coming from, but I don't recognize any of the code being profiled here from my program.

I tried taking the same long-running program code and ported it over to a file in bin/temp.dart inside a Future<void> main() async { ... } body, and then I see all the profiler information I expect for my program.

This used to work for me, but I only profile periodically, so I'm not sure when it broke.

I'm running Dart (no Flutter) on WSL2 Ubuntu on Windows 11.

Dart version:

$ dart --version
Dart SDK version: 3.9.4 (stable) (Tue Sep 30 12:08:50 2025 -0700) on "linux_x64"

VS Code version:

Version: 1.104.3 (user setup)
Commit: 385651c938df8a906869babee516bffd0ddb9829
Date: 2025-10-02T12:30:51.747Z
Electron: 37.3.1
ElectronBuildId: 12404162
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Windows_NT x64 10.0.22631

Dart extension version:

Identifier
dart-code.dart-code
Version
3.120.0
Last Updated
2025-09-30, 10:27:38

mkorbel1 avatar Oct 06 '25 21:10 mkorbel1

By default the profiler includes method calls from the SDK.

You can filter these out using the filter settings (see screenshots below). Please give that a try, and re-open if you are still seeing data you don't expect.

Image Image

elliette avatar Oct 07 '25 21:10 elliette

Hi @elliette, thanks for the tip, but this is not the issue I'm facing. With all options configured to be hidden, I'm still seeing none of my own code:

Image

I have additional reason to believe this is a bug in the profiler (or the stack to it) because when I run the same program not in a test, I get the information I expected to see.

I do not have access to re-open this issue, can you re-open it or do you want me to file a new issue?

mkorbel1 avatar Oct 07 '25 21:10 mkorbel1

Got it, thank you! I've re-opened the issue.

elliette avatar Oct 07 '25 22:10 elliette