| 78 | } |
| 79 | |
| 80 | const ShowNode* TFScope::ShowInternal(const Options& opts, Timeline* timeline) { |
| 81 | root_->ResetTotalStats(); |
| 82 | if (opts.output_type == kOutput[3]) { |
| 83 | fprintf(stderr, "Only 'code' view supports pprof output now.\n"); |
| 84 | return root_; |
| 85 | } |
| 86 | |
| 87 | std::vector<ScopeNode*> roots = Account(root_->children, opts); |
| 88 | root_->show_children.clear(); |
| 89 | for (ScopeNode* n : roots) { |
| 90 | root_->AggregateTotalStats(n); |
| 91 | } |
| 92 | |
| 93 | if (opts.start_name_regexes.size() != 1 || |
| 94 | opts.start_name_regexes[0] != ".*") { |
| 95 | roots = SearchRoot(roots, opts.start_name_regexes); |
| 96 | } |
| 97 | |
| 98 | root_->show_children.assign(roots.begin(), roots.end()); |
| 99 | ScopeNode* root = PrintScope({root_}, opts, 1, 0)[0]; |
| 100 | |
| 101 | root->formatted_str = FormatLegend(opts) + root->formatted_str; |
| 102 | Format(root->show_children, &root->formatted_str, root->mutable_proto()); |
| 103 | |
| 104 | if (timeline) { |
| 105 | timeline->GenerateScopeTimeline(root); |
| 106 | } |
| 107 | return root; |
| 108 | } |
| 109 | |
| 110 | void TFScope::Format(const std::vector<ScopeNode*> roots, string* display_str, |
| 111 | GraphNodeProto* proto) { |
nothing calls this directly
no test coverage detected