| 436 | } |
| 437 | |
| 438 | string GetDeviceClass(const string& device_name) { |
| 439 | // TODO(dyoon): channel device name follows the convention we currently have |
| 440 | // in VirtualScheduler. This should be revised with VirtualScheduler as well |
| 441 | // as VirtualPlacer in the future. |
| 442 | if (device_name.find("Channel") != string::npos) { |
| 443 | const string from = "_from_"; |
| 444 | const string to = "_to_"; |
| 445 | const auto from_loc = device_name.find(from); |
| 446 | const auto to_loc = device_name.find(to); |
| 447 | const auto src_device_full = device_name.substr( |
| 448 | from_loc + from.size(), to_loc - (from_loc + from.size())); |
| 449 | const auto dst_device_full = device_name.substr(to_loc + to.size()); |
| 450 | return strings::StrCat( |
| 451 | "Channel", ": ", GetDeviceClassForNonChannelDevice(src_device_full), |
| 452 | " -> ", GetDeviceClassForNonChannelDevice(dst_device_full)); |
| 453 | } else { |
| 454 | return GetDeviceClassForNonChannelDevice(device_name); |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | string GetStatsStringFromRunMetadata(const RunMetadata& run_metadata, |
| 459 | bool verbosity) { |