* Capture the completion of a sprite group resolution. */
| 61 | * Capture the completion of a sprite group resolution. |
| 62 | */ |
| 63 | void NewGRFProfiler::EndResolve(const ResolverResult &result) |
| 64 | { |
| 65 | using namespace std::chrono; |
| 66 | this->cur_call.time = (uint32_t)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count() - this->cur_call.time; |
| 67 | |
| 68 | struct visitor { |
| 69 | uint32_t operator()(std::monostate) |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | uint32_t operator()(CallbackResult cb_result) |
| 74 | { |
| 75 | return cb_result; |
| 76 | } |
| 77 | uint32_t operator()(const ResultSpriteGroup *group) |
| 78 | { |
| 79 | return group == nullptr ? 0 : GetSpriteLocalID(group->sprite); |
| 80 | } |
| 81 | uint32_t operator()(const TileLayoutSpriteGroup *group) |
| 82 | { |
| 83 | return group == nullptr ? 0 : group->nfo_line; |
| 84 | } |
| 85 | uint32_t operator()(const IndustryProductionSpriteGroup *group) |
| 86 | { |
| 87 | return group == nullptr ? 0 : group->nfo_line; |
| 88 | } |
| 89 | }; |
| 90 | this->cur_call.result = std::visit(visitor{}, result); |
| 91 | |
| 92 | this->calls.push_back(this->cur_call); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Capture a recursive sprite group resolution. |