Function nom_tracable::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)
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 56)
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 127)
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();
}