pub fn cumulative_histogram()
Expand description

Show cumulative histogram of parser call count.

The call count includes the counts of children parsers.

The statistics information to generate histogram is reset at each parser call. Therefore cumulative_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()));
    cumulative_histogram(); // Show cumulative histogram of "1" parsing

    let ret = term(LocatedSpan::new_extra("11", TracableInfo::new()));
    cumulative_histogram(); // Show cumulative histogram of "11" parsing
Examples found in repository?
examples/str_parser.rs (line 54)
47
48
49
50
51
52
53
54
55
fn main() {
    // Configure trace setting
    let info = TracableInfo::new().parser_width(64).fold("term");
    let _ret = expr(LocatedSpan::new_extra("1-1+1+1-1", info));

    // Show histogram
    histogram();
    cumulative_histogram();
}
More examples
Hide additional examples
examples/u8_parser.rs (line 57)
47
48
49
50
51
52
53
54
55
56
57
58
fn main() {
    // Configure trace setting
    let info = TracableInfo::new()
        .parser_width(64)
        .fragment_width(20)
        .fold("term");
    let _ret = expr(LocatedSpan::new_extra("1-1+1+1-1".as_bytes(), info));

    // Show histogram
    histogram();
    cumulative_histogram();
}
examples/u8_custom_parser.rs (line 128)
118
119
120
121
122
123
124
125
126
127
128
129
fn main() {
    // Configure trace setting
    let info = TracableInfo::new()
        .parser_width(64)
        .fragment_width(20)
        .fold("term");
    let _ret = expr(Span(LocatedSpan::new_extra("1-1+1+1-1".as_bytes(), info)));

    // Show histogram
    histogram();
    cumulative_histogram();
}