| 143 | } |
| 144 | |
| 145 | std::vector<ScopeNode*> TFScope::PrintScope(const std::vector<ScopeNode*> roots, |
| 146 | const Options& opts, int depth, |
| 147 | int last_ident) { |
| 148 | std::vector<ScopeNode*> show_nodes; |
| 149 | |
| 150 | for (ScopeNode* node : roots) { |
| 151 | int ident = last_ident; |
| 152 | bool show = ShouldShow(node, opts, depth); |
| 153 | if (show) ident += 2; |
| 154 | |
| 155 | std::vector<ScopeNode*> show_cnodes; |
| 156 | if (!ShouldTrim(node, opts.trim_name_regexes) && depth <= opts.max_depth) { |
| 157 | show_cnodes = PrintScope(node->show_children, opts, depth + 1, ident); |
| 158 | } |
| 159 | if (show) { |
| 160 | node->show_children.clear(); |
| 161 | if (opts.account_displayed_op_only) { |
| 162 | node->ResetTotalStats(); |
| 163 | node->AddSelfToTotalStats(); |
| 164 | } |
| 165 | |
| 166 | show_cnodes = SortNodes(show_cnodes, opts); |
| 167 | for (ScopeNode* sc : show_cnodes) { |
| 168 | node->show_children.push_back(sc); |
| 169 | if (opts.account_displayed_op_only) { |
| 170 | node->AggregateTotalStats(sc); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | node->formatted_str = |
| 175 | strings::Printf("%s%s\n", string(last_ident, ' ').c_str(), |
| 176 | FormatNode(node, opts).c_str()); |
| 177 | |
| 178 | if (opts.select.find(kShown[4]) != opts.select.end()) { |
| 179 | std::unique_ptr<TFProfTensor> tfprof_tensor; |
| 180 | if (LookUpCheckPoint(node->name(), &tfprof_tensor)) { |
| 181 | string value_str; |
| 182 | tfprof_tensor->Display(&value_str, |
| 183 | node->mutable_proto()->mutable_tensor_value()); |
| 184 | node->formatted_str += value_str; |
| 185 | } |
| 186 | } |
| 187 | show_nodes.push_back(node); |
| 188 | } else { |
| 189 | show_nodes.insert(show_nodes.end(), show_cnodes.begin(), |
| 190 | show_cnodes.end()); |
| 191 | } |
| 192 | } |
| 193 | return show_nodes; |
| 194 | } |
| 195 | |
| 196 | std::vector<ScopeNode*> TFScope::Account(const std::vector<ScopeNode*>& roots, |
| 197 | const Options& opts) { |
nothing calls this directly
no test coverage detected