[Accumulators] How to extract P90, P99?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Accumulators] How to extract P90, P99?

Boost - Users mailing list
I'm already using the accumulator below to keep track of request processing times of a server.

    using ProcAcc = acc::accumulator_set<
        double, acc::stats<
            acc::tag::min,
            acc::tag::max,
            acc::tag::mean,
            acc::tag::median,
            acc::tag::sum
        >
    >;

But now I'm interested in also extracting the P90 and P99 values,
to get insight in how much of an outlier the max could be.

AFAIK, the median is the P50, but it's not readily obvious to me what tag
to use for the P90 or P(N) in general. Could someone help please? Thanks, --DD

PS: Does accumulator allow to keep the top(N) values as well? How?

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Accumulators] How to extract P90, P99?

Boost - Users mailing list
Hi,

On Thu, Dec 17, 2020 at 4:50 PM Dominique Devienne via Boost-users <[hidden email]> wrote:
I'm already using the accumulator below to keep track of request processing times of a server.

    using ProcAcc = acc::accumulator_set<
        double, acc::stats<
            acc::tag::min,
            acc::tag::max,
            acc::tag::mean,
            acc::tag::median,
            acc::tag::sum
        >
    >;

But now I'm interested in also extracting the P90 and P99 values,
to get insight in how much of an outlier the max could be.

AFAIK, the median is the P50, but it's not readily obvious to me what tag
to use for the P90 or P(N) in general. Could someone help please? Thanks, --DD

PS: Does accumulator allow to keep the top(N) values as well? How?

The Boost.Accumulators documentation provides examples on how to compute quantiles:
  https://www.boost.org/doc/libs/1_75_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.extended_p_square

In particular, to compute both P90 and P99, together with min, max, mean, ..., just add the "extended_p_square" tag (or the "extended_p_square_quantile" tag) and specify probabilities 0.90 and 0.99 in the constructor:

    typedef accumulator_set<double,
                                             stats<tag::extended_p_square,
                                                       tag::min,
                                                       tag::max,
                                                       tag::mean,
                                                       tag::median,
                                                       tag::sum
                                                    >
                                           > acc_t;
    double probs[] = {0.90, 0.99);
    acc_t acc(extended_p_square_probabilities = probs);
    ...
    acc(value1);
    acc(value2);
    ...
    std::cout << "-- SUMMARY STATS:\n";
    std::cout << "Min: " << min(acc) << "\n";
    std::cout << "Max: " << max(acc) << "\n";
    std::cout << "Mean: " << mean(acc) << "\n";
    std::cout << "Median: " << median(acc) << "\n";
    std::cout << "Sum: " << sum(acc) << "\n";
    std::cout << "P90: " << extended_p_square(acc)[0] << "\n";
    std::cout << "P99: " << extended_p_square(acc)[1] << "\n";

Hope this helps.
Regards,
Marco

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Accumulators] How to extract P90, P99?

Boost - Users mailing list
On Sat, Dec 19, 2020 at 2:59 PM Marco Guazzone via Boost-users <[hidden email]> wrote:
On Thu, Dec 17, 2020 at 4:50 PM Dominique Devienne via Boost-users <[hidden email]> wrote:
But now I'm interested in also extracting the P90 and P99 values,
Hope this helps.

It did. Thanks a bunch Marco. --DD

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users