Exemple #1
0
                void print(std::ostream &out,
                        size_t level, double total, size_t width) const
                {
                    using namespace std;
                    print_line(out, name, watch.total(), 100 * watch.total() / total, width, level);

                    if (watch.tics() > 1) {
                        out << " (" << setw(6) << watch.tics()
                            << "x; avg: " << setprecision(6) << scientific
                            << (watch.average() * 1e6) << " usec.)";
                    }

                    out << endl;

                    if (!children.empty()) {
                        double sec = watch.total() - children_time();
                        double perc = 100 * sec / total;
                        if(perc > 1e-1) {
                            print_line(out, "self", sec, perc, width, level + 1);
                            out << endl;
                        }
                    }

                    for(auto c = children.begin(); c != children.end(); c++)
                        (*c)->print(out, level + shift_width, total, width);
                }
Exemple #2
0
                size_t max_line_width(size_t level) const {
                    size_t w = name.size() + level;

                    for(auto c = children.begin(); c != children.end(); c++)
                        w = std::max(w, (*c)->max_line_width(level + shift_width));

                    return w;
                }
Exemple #3
0
                double children_time() const {
                    double tm = 0;

                    for(auto c = children.begin(); c != children.end(); c++)
                        tm += (*c)->watch.total();

                    return tm;
                }
Exemple #4
0
                double children_time() const {
                    double tm = 0;

                    for(auto c = children.begin(); c != children.end(); c++)
                        tm += (*c)->length;

                    return tm;
                }
bool serialize(boost::multi_index_container<T, Indexes>& value, Common::StringView name, ISerializer& s) {
    if (s.type() == ISerializer::INPUT) {
        readSequence<T>(std::inserter(value, value.end()), name, s);
    } else {
        writeSequence<T>(value.begin(), value.end(), name, s);
    }

    return true;
}
Exemple #6
0
                void print(std::ostream &out,
                        uint level, double total, uint width) const
                {
                    using namespace std;
                    out << "[" << setw(level) << "";
                    print_line(out, name, length, 100 * length / total, width - level);

                    if (!children.empty()) {
                        double sec = length - children_time();
                        double perc = 100 * sec / total;

                        if (perc > 1e-1) {
                            out << "[" << setw(level + 1) << "";
                            print_line(out, "self", sec, perc, width - level - 1);
                        }
                    }

                    for(auto c = children.begin(); c != children.end(); c++)
                        (*c)->print(out, level + shift_width, total, width);
                }