| 534 | } |
| 535 | |
| 536 | static std::string getHeatMapUrl(const NameMap &nm, |
| 537 | const std::unordered_map<int, int> &con_counts, |
| 538 | int max_count) |
| 539 | { |
| 540 | /// get heat map |
| 541 | |
| 542 | std::unordered_map<std::string, int> loc_intensity; |
| 543 | |
| 544 | for (const auto& it : con_counts) |
| 545 | { |
| 546 | const auto con = std::to_string(it.first); |
| 547 | const auto count = it.second; |
| 548 | |
| 549 | const auto &path = nm.getPath(con); |
| 550 | |
| 551 | const auto path_head_elements = utils::getPathPair(path, true).model_level; |
| 552 | |
| 553 | if (path_head_elements.empty()) |
| 554 | continue; |
| 555 | |
| 556 | const auto path_head = path_head_elements.back(); |
| 557 | |
| 558 | const auto location_etc = utils::split(path_head, utils::minor_sep); |
| 559 | |
| 560 | // print("path: {}", path); |
| 561 | |
| 562 | // for (auto e : new_loc) { |
| 563 | // print("element: {}", e); |
| 564 | // } |
| 565 | |
| 566 | /// path plus four ints |
| 567 | if (location_etc.size() < 5) |
| 568 | continue; |
| 569 | |
| 570 | std::vector<std::string> new_loc(location_etc.begin(), location_etc.begin() + 5); |
| 571 | |
| 572 | int val = static_cast<int>(std::floor(count * (255.0 / max_count))); |
| 573 | |
| 574 | const auto loc_str = utils::join(new_loc, utils::minor_sep); |
| 575 | |
| 576 | loc_intensity[loc_str] = std::max(loc_intensity[loc_str], val); |
| 577 | } |
| 578 | |
| 579 | /// highlight url |
| 580 | std::stringstream url; |
| 581 | url << "highlight://?"; |
| 582 | |
| 583 | for (auto it : loc_intensity) |
| 584 | url << it.first << utils::minor_sep << it.second << ";"; |
| 585 | |
| 586 | return url.str(); |
| 587 | } |
| 588 | |
| 589 | void Conductor::computeHeatMap(ExecID eid, std::vector<NodeID> ns) |
| 590 | { |
no test coverage detected