| 105 | } |
| 106 | |
| 107 | void TFStats::BuildView(const string& cmd) { |
| 108 | if (cmd == kCmds[0] && !scope_view_) { |
| 109 | scope_view_.reset(new TFScope(ckpt_reader_.get())); |
| 110 | for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) { |
| 111 | scope_view_->AddNode(it->second.get()); |
| 112 | } |
| 113 | scope_view_->Build(); |
| 114 | } |
| 115 | if (cmd == kCmds[1] && !graph_view_) { |
| 116 | graph_view_.reset(new TFGraph(ckpt_reader_.get())); |
| 117 | for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) { |
| 118 | graph_view_->AddNode(it->second.get()); |
| 119 | } |
| 120 | graph_view_->Build(); |
| 121 | } |
| 122 | if (cmd == kCmds[2] && !code_view_) { |
| 123 | code_view_.reset(new TFCode()); |
| 124 | for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) { |
| 125 | code_view_->AddNode(it->second.get()); |
| 126 | } |
| 127 | code_view_->Build(); |
| 128 | } |
| 129 | if (cmd == kCmds[3] && !op_view_) { |
| 130 | op_view_.reset(new TFOp()); |
| 131 | for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) { |
| 132 | op_view_->AddNode(it->second.get()); |
| 133 | } |
| 134 | op_view_->Build(); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void TFStats::BuildAllViews() { |
| 139 | std::vector<string> cmds_str(kCmds, kCmds + sizeof(kCmds) / sizeof(*kCmds)); |
no test coverage detected