performance_timer 1.0.1 copy "performance_timer: ^1.0.1" to clipboard
performance_timer: ^1.0.1 copied to clipboard

A timer and utils to count time spent on methods and calculations

Performance Timer #

Performance Timer is a package that allows you to time function and method calls, allowing for nesting/children timers, real and own time spent inside each timer.

Also allows for printing the results and exporting them to Trace Event Format, which can then be parsed and analyzed by a lot of Trace analyzers, like Google Perfetto (https://ui.perfetto.dev/)

Features #

  • Track time spent inside a method with timer.ownDuration and timer.child
  • Track all time spent in all methods with timer.realDuration
  • Store additional data linked to each timer with timer.setTag
  • Print results with PerformanceTimerSerializerString
  • Export results to TraceEventFormat with PerformanceTimerSerializerTraceEvent

Usage #

  • Create a timer
final timer = PerformanceTimer(name: 'rootTimer', tags: {'key': 'value'});
// Do some work
timer.finish()
  • Serialize the results
const stringSerializer = PerformanceTimerSerializerString();
print(await stringSerializer.serialize(timer));

const traceEventSerializer = PerformanceTimerSerializerTraceEvent();
print(jsonEncode(await traceEventSerializer.serialize(timer)));
7
likes
0
points
706
downloads

Publisher

verified publishernicobritos.com

Weekly Downloads

A timer and utils to count time spent on methods and calculations

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

duration

More

Packages that depend on performance_timer