debug: memory overlay
This commit is contained in:
parent
988d9b2c8d
commit
9c641e0f49
1 changed files with 58 additions and 15 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:aves/ref/locales.dart';
|
||||||
|
import 'package:aves/utils/file_utils.dart';
|
||||||
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -95,21 +99,60 @@ class _CollectorOverlayState extends State<_CollectorOverlay> {
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.indigo.shade900.withAlpha(0xCC),
|
color: Colors.indigo.shade900.withAlpha(0xCC),
|
||||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
child: Column(
|
||||||
IconButton(
|
mainAxisSize: MainAxisSize.min,
|
||||||
onPressed: () => setState(() => _alignment = _alignment == AlignmentDirectional.bottomStart ? AlignmentDirectional.topStart : AlignmentDirectional.bottomStart),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
icon: Icon(_alignment == AlignmentDirectional.bottomStart ? Icons.vertical_align_top_outlined : Icons.vertical_align_bottom_outlined),
|
children: [
|
||||||
),
|
Wrap(
|
||||||
...LeakType.values.map((type) {
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
return TextButton(
|
children: [
|
||||||
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
IconButton(
|
||||||
final reports = leaks.byType[type] ?? [];
|
onPressed: () => setState(() => _alignment = _alignment == AlignmentDirectional.bottomStart ? AlignmentDirectional.topStart : AlignmentDirectional.bottomStart),
|
||||||
_printLeaks(type, reports);
|
icon: Icon(_alignment == AlignmentDirectional.bottomStart ? Icons.vertical_align_top_outlined : Icons.vertical_align_bottom_outlined),
|
||||||
}),
|
),
|
||||||
child: Text(type.name),
|
...LeakType.values.map((type) {
|
||||||
);
|
return OutlinedButton(
|
||||||
})
|
style: ButtonStyle(
|
||||||
]),
|
padding: WidgetStateProperty.all(const EdgeInsets.all(6)),
|
||||||
|
minimumSize: WidgetStateProperty.all(Size.zero),
|
||||||
|
),
|
||||||
|
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
||||||
|
final reports = leaks.byType[type] ?? [];
|
||||||
|
_printLeaks(type, reports);
|
||||||
|
}),
|
||||||
|
child: Text(type.name),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Wrap(
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
children: [
|
||||||
|
StreamBuilder(
|
||||||
|
stream: Stream.periodic(const Duration(seconds: 1)),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final currentRss = formatFileSize(asciiLocale, ProcessInfo.currentRss);
|
||||||
|
final maxRss = formatFileSize(asciiLocale, ProcessInfo.maxRss);
|
||||||
|
return Text('RSS: $currentRss / $maxRss');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Wrap(
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
children: [
|
||||||
|
StreamBuilder(
|
||||||
|
stream: Stream.periodic(const Duration(seconds: 1)),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final currentImageCache = formatFileSize(asciiLocale, imageCache.currentSizeBytes);
|
||||||
|
final maxImageCache = formatFileSize(asciiLocale, imageCache.maximumSizeBytes);
|
||||||
|
return Text('imageCache: $currentImageCache / $maxImageCache');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue