Correct units and cumulative bug in GC times (#9890)

Fixes #7080

In the logging page, GC events were displayed with summaries like idle
collection in 290 ms. The value 290 was calculated directly from the cumulative
times (`newSpace.time` and `oldSpace.time`), meaning it represented the total
cumulative GC time since isolate startup rather than the duration of this
specific GC. In reality, the individual collection took 290 microseconds (which
is 0.29 milliseconds), but since it was displaying the cumulative time of 290
ms, it was off by a factor of 1000x.

In this fix, we update `_handleGCEvent` to track and subtract the previous
cumulative GC time from the new cumulative GC time to compute the actual
duration delta for this specific GC.

Also format the duration as a millisecond double with 1 decimal place
(consistent with how frame times are displayed), and appended it to the log
summary (e.g. "idle collection in 100.0 ms").
4 files changed
tree: 2631c624653b66d10d1d80d47cd75f30a8ca0942
  1. .agents/
  2. .gemini/
  3. .github/
  4. .vscode/
  5. _markdown_images/
  6. docs/
  7. packages/
  8. third_party/
  9. tool/
  10. .gitattributes
  11. .gitignore
  12. AGENTS.md
  13. analysis_options.yaml
  14. AUTHORS
  15. BETA_TESTING.md
  16. CLAUDE.md
  17. CODE_OF_CONDUCT.md
  18. CODEOWNERS
  19. CONTRIBUTING.md
  20. DEBUGGING.md
  21. devtools_options.yaml
  22. DOCUMENTATION.md
  23. flutter-candidate.txt
  24. LICENSE
  25. pubspec.lock
  26. pubspec.yaml
  27. README.md
  28. STYLE.md
  29. TESTING.md
  30. TRIAGE.md
README.md

Dart & Flutter DevTools

Build Status OpenSSF Scorecard

What is this?

Dart & Flutter DevTools is a suite of performance tools for Dart and Flutter.

Getting started

For documentation on installing and trying out DevTools, please see our docs.

Contributing and development

Contributions welcome! See our contributing page for an overview of how to build and contribute to the project.

Terms and Privacy

By using Dart DevTools, you agree to the Google Terms of Service. To understand how we use data collected from this service, see the Google Privacy Policy.