Exemplo n.º 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);
                }
Exemplo n.º 2
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);
                }