| 121 | } |
| 122 | |
| 123 | double AddStep(int64 step, const string* graph, const string* run_meta, |
| 124 | const string* op_log) { |
| 125 | CHECK(tf_stat); |
| 126 | |
| 127 | if (graph && !graph->empty()) { |
| 128 | std::unique_ptr<GraphDef> graph_ptr(new GraphDef()); |
| 129 | if (!graph_ptr->ParseFromString(*graph)) { |
| 130 | if (!protobuf::TextFormat::ParseFromString(*graph, graph_ptr.get())) { |
| 131 | fprintf(stderr, "Failed to parse graph\n"); |
| 132 | } |
| 133 | } |
| 134 | tf_stat->AddGraph(std::move(graph_ptr)); |
| 135 | } |
| 136 | |
| 137 | CHECK(run_meta && !run_meta->empty()); |
| 138 | // TODO(xpan): Better error handling. |
| 139 | std::unique_ptr<RunMetadata> run_meta_ptr(new RunMetadata()); |
| 140 | run_meta_ptr->ParseFromString(*run_meta); |
| 141 | tf_stat->AddRunMeta(step, std::move(run_meta_ptr)); |
| 142 | |
| 143 | if (op_log && !op_log->empty()) { |
| 144 | std::unique_ptr<OpLogProto> op_log_ptr; |
| 145 | op_log_ptr.reset(new OpLogProto()); |
| 146 | op_log_ptr->ParseFromString(*op_log); |
| 147 | tf_stat->AddOpLogProto(std::move(op_log_ptr)); |
| 148 | } |
| 149 | return tf_stat->run_coverage(); |
| 150 | } |
| 151 | |
| 152 | string Profile(const string* command, const string* options) { |
| 153 | CHECK(tf_stat); |
nothing calls this directly
no test coverage detected