Function histogram

Source
pub fn histogram()
Expand description

Show histogram of parser call count.

The statistics information to generate histogram is reset at each parser call. Therefore histogram should be called before next parser call. The information is thread independent because it is stored at thread local storage.

    let ret = term(LocatedSpan::new_extra("1", TracableInfo::new()));
    histogram(); // Show histogram of "1" parsing

    let ret = term(LocatedSpan::new_extra("11", TracableInfo::new()));
    histogram(); // Show histogram of "11" parsing
Examples found in repository?
examples/str_parser.rs (line 53)
47fn main() {
48    // Configure trace setting
49    let info = TracableInfo::new().parser_width(64).fold("term");
50    let _ret = expr(LocatedSpan::new_extra("1-1+1+1-1", info));
51
52    // Show histogram
53    histogram();
54    cumulative_histogram();
55}
More examples
Hide additional examples
examples/u8_parser.rs (line 56)
47fn main() {
48    // Configure trace setting
49    let info = TracableInfo::new()
50        .parser_width(64)
51        .fragment_width(20)
52        .fold("term");
53    let _ret = expr(LocatedSpan::new_extra("1-1+1+1-1".as_bytes(), info));
54
55    // Show histogram
56    histogram();
57    cumulative_histogram();
58}
examples/u8_custom_parser.rs (line 127)
118fn main() {
119    // Configure trace setting
120    let info = TracableInfo::new()
121        .parser_width(64)
122        .fragment_width(20)
123        .fold("term");
124    let _ret = expr(Span(LocatedSpan::new_extra("1-1+1+1-1".as_bytes(), info)));
125
126    // Show histogram
127    histogram();
128    cumulative_histogram();
129}