fnx_profiler 0.9.1

  • README.md
  • Example
  • Installing
  • Versions
  • 0


A library for Dart developers. It is awesome!

fnx_profiler is an "imperative" profiler. You manually mark blocks of code you want to profile. Profiler is hierarchical, you can add children to it and grandchildren to them, whole clans of profilers will help you to drill down to that performance bottleneck.

Use it like this:

import 'package:fnx_profiler/fnx_profiler.dart'

Profiler p = openRootProfiler("root");
// do something expensive

Or this:

Profiler p = openRootProfiler("root");
for (int a=0; a<3; a++) {
    Profiler ch = p.openChild("child");
    // do something nested

Or even this:

Profiler p = openRootProfiler("root");
await p.profileFuture("future", someFuture);

Yes, it's pretty straightforward, even naive, but it works. Run your code, check the results at the end, find the bottleneck, optimize and repeat.


Please see the full example. Example generates this output:

name                   |     calls|  avg (ms)|  min (ms)|  max (ms)|
root                   |         1|    1219.0|      1219|      1219|
root.child0            |         1|     116.0|       116|       116|
root.child0.grandchild |         5|      22.6|        21|        24|
root.child1            |         1|     125.0|       125|       125|
root.child1.grandchild |         5|      24.6|        22|        26|
root.child2            |         1|     123.0|       123|       123|
root.child2.grandchild |         5|      24.2|        23|        25|
root.myFunction        |        10|      44.2|        42|        45|
root.myFuture          |        10|      33.4|        30|        35|

Features and bugs

Please file feature requests and bugs on Github.



  • fixed typo in documentation: beginRootProfiler should be openRootProfiler


  • Initial version, created by Stagehand


// Copyright (c) 2016, Tomucha. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'package:fnx_profiler/fnx_profiler.dart' as p;

main() async {

  // open the root profiler, father of all
  p.Profiler root = p.openRootProfiler("root");

  // do something expensive
  await createDelayFuture(50);

  for (int a=0; a<10; a++) {
    // open child profiler
    p.Profiler child = root.openChild("myFunction");
    await createDelayFuture(40);
    // close it after execution

  for (int a=0; a<10; a++) {
    // profile Future with this helper method
    await root.profileFuture("myFuture", createDelayFuture(30));

  for (int a=0; a<3; a++) {
    p.Profiler child = root.openChild("child${a}");
    for (int b=0; b<5; b++) {
      // nest your profilers as needed and drill down to the bottleneck
      p.Profiler grandChild = child.openChild("grandchild");
      await new Future.delayed(new Duration(milliseconds: 20));
      // just remember to close them

  // close profiler

  // print results, find the bottleneck, optimize, repeat!

Future createDelayFuture(int milliseconds) {
  return new Future.delayed(new Duration(milliseconds: milliseconds));

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  fnx_profiler: ^0.9.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:fnx_profiler/fnx_profiler.dart';
Version Uploaded Documentation Archive
0.9.1 Jan 12, 2017 Go to the documentation of fnx_profiler 0.9.1 Download fnx_profiler 0.9.1 archive
0.9.0 Sep 15, 2016 Go to the documentation of fnx_profiler 0.9.0 Download fnx_profiler 0.9.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0