flutter / flutter/devtools

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

Aperta
#9,458 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
P2 screen: cpu profiler
Lingua principale
Dart
Stelle
1.7k
Fork
404
Merge medio
6g 17h
PR unite (30g)
18

Descrizione

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 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:
```shell
$ 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
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Reproduce the issue by profiling the same long-running program inside a test/*_test.dart test body and in bin/temp.dart under main(). Compare the profiler output and investigate why test profiling shows unrelated file I/O frames; done means the test profile identifies the program's actual work like the non-test profile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart
Ambito
devtools, performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.