| 324 | } |
| 325 | |
| 326 | void TFStats::SerializeToString(string* content) { |
| 327 | ProfileProto profile; |
| 328 | for (const auto& entry : id_to_string_) { |
| 329 | (*profile.mutable_id_to_string())[entry.first] = entry.second; |
| 330 | } |
| 331 | for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) { |
| 332 | if (it->second->id() < 0) { |
| 333 | continue; |
| 334 | } |
| 335 | (*profile.mutable_nodes())[it->second->id()].MergeFrom( |
| 336 | it->second->ToProto(nodes_map_)); |
| 337 | } |
| 338 | |
| 339 | profile.set_has_trace(has_code_traces_); |
| 340 | profile.set_miss_accelerator_stream(miss_accelerator_stream_); |
| 341 | for (int64 s : steps_) { |
| 342 | profile.add_steps(s); |
| 343 | } |
| 344 | *content = profile.SerializeAsString(); |
| 345 | } |
| 346 | |
| 347 | void TFStats::WriteProfile(const string& filename) { |
| 348 | string content; |
no test coverage detected