#manual #time #profiler #profile #end #crude

crude-profiler

simple library for crude manual profiling

8 releases

Uses old Rust 2015

0.1.7 Jun 22, 2017
0.1.6 Jun 22, 2017

#30 in #manual

26 downloads per month
Used in fac

GPL-2.0+

12KB
260 lines

Crude profiler

A library for some simple manual profiling.

This is a slightly silly profiling library, which requires you to manually annotate your code to obtain profiling information. On the plus side, this means you aren't overwhelmed with detail, and that you can profile portions of functions, or just the functions you care about. On the down side, you end up having to insert a bunch of annotations just to get information. You also need to write the profiling information to a file or stdout on your own.

One possible use is to print out a simple table of where time was spent, e.g. 5% initializing, 95% computing. Another would be if you want to profile while ensuring that all time spent sleeping (or waiting for another process) is accounted for.

Example

let _g = crude_profiler::push("test one");
// ... do some work here
_g.replace("test two");
println!("{}", crude_profiler::report());

lib.rs:

A library for some simple manual profiling.

This is a slightly silly profiling library, which requires you to manually annotate your code to obtain profiling information. On the plus side, this means you aren't overwhelmed with detail, and that you can profile portions of functions, or just the functions you care about. On the down side, you end up having to insert a bunch of annotations just to get information. You also need to write the profiling information to a file or stdout on your own.

One possible use is to print out a simple table of where time was spent, e.g. 5% initializing, 95% computing. Another would be if you want to profile while ensuring that all time spent sleeping (or waiting for another process) is accounted for.

Example

let _g = crude_profiler::push("test one");
// ... do some work here
_g.replace("test two");
println!("{}", crude_profiler::report());

Dependencies

~14KB