Skip to main content

flutter_edge_ai_diagnostics 0.3.0 copy "flutter_edge_ai_diagnostics: ^0.3.0" to clipboard
flutter_edge_ai_diagnostics: ^0.3.0 copied to clipboard

Opt-in Android, iOS and macOS process memory diagnostics: footprint, its peak, resident clean pages and available memory, read from the OS.

example/example.dart

// ignore_for_file: avoid_print
import 'package:flutter_edge_ai_diagnostics/flutter_edge_ai_diagnostics.dart';

/// Measures what an operation costs in memory the OS enforces.
Future<void> main() async {
  if (!FlutterEdgeAiDiagnostics.isSupported) {
    print('Memory diagnostics run on Android, iOS and macOS only.');
    return;
  }

  final before = await FlutterEdgeAiDiagnostics.memorySnapshot();
  // ... load a model or run a generation here ...
  final after = await FlutterEdgeAiDiagnostics.memorySnapshot();

  final anonBefore = before.anonymousBytes;
  final anonAfter = after.anonymousBytes;
  if (anonBefore != null && anonAfter != null) {
    final mib = (anonAfter - anonBefore) / (1024 * 1024);
    print('Anonymous footprint changed by ${mib.toStringAsFixed(1)} MiB');
  }
  print('Available now: ${after.availableBytes ?? 'unknown'} bytes');
}
3
likes
0
points
879
downloads

Publisher

verified publishersashadenisov.dev

Weekly Downloads

Opt-in Android, iOS and macOS process memory diagnostics: footprint, its peak, resident clean pages and available memory, read from the OS.

Homepage
Repository (GitHub)
View/report issues

Topics

#memory #diagnostics #gemma #on-device

License

unknown (license)

Dependencies

ffi, flutter, meta

More

Packages that depend on flutter_edge_ai_diagnostics