| 991 | } |
| 992 | |
| 993 | void Coordinator::BackendState::InstanceStats::ToJson(Value* value, Document* document) { |
| 994 | Value instance_id_val( |
| 995 | PrintId(exec_params_.instance_id()), document->GetAllocator()); |
| 996 | value->AddMember("instance_id", instance_id_val, document->GetAllocator()); |
| 997 | |
| 998 | // We send 'done' explicitly so we don't have to infer it by comparison with a string |
| 999 | // constant in the debug page JS code. |
| 1000 | value->AddMember("done", done_, document->GetAllocator()); |
| 1001 | |
| 1002 | Value state_val(FragmentInstanceState::ExecStateToString(current_state_), |
| 1003 | document->GetAllocator()); |
| 1004 | value->AddMember("current_state", state_val, document->GetAllocator()); |
| 1005 | |
| 1006 | Value fragment_name_val(fragment_->display_name, document->GetAllocator()); |
| 1007 | value->AddMember("fragment_name", fragment_name_val, document->GetAllocator()); |
| 1008 | |
| 1009 | value->AddMember("first_status_update_received", last_report_time_ms_ > 0, |
| 1010 | document->GetAllocator()); |
| 1011 | int64_t elapsed_time_ms = |
| 1012 | std::max(static_cast<int64_t>(0), UnixMillis() - last_report_time_ms_); |
| 1013 | value->AddMember("time_since_last_heard_from", elapsed_time_ms, |
| 1014 | document->GetAllocator()); |
| 1015 | } |
| 1016 | |
| 1017 | Coordinator::FragmentStats::FragmentStats(const string& agg_profile_name, |
| 1018 | const string& root_profile_name, int num_instances, ObjectPool* obj_pool) |