MCPcopy Create free account
hub / github.com/apache/impala / JvmThreadsUrlCallback

Function JvmThreadsUrlCallback

be/src/util/thread.cc:471–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471void JvmThreadsUrlCallback(const Webserver::WebRequest& req, Document* doc) {
472 DCHECK(doc != NULL);
473 TGetJvmThreadsInfoRequest request;
474 request.get_complete_info = true;
475 TGetJvmThreadsInfoResponse response;
476 Status status = JniUtil::GetJvmThreadsInfo(request, &response);
477 if (!status.ok()) {
478 Value error(Substitute("Couldn't retrieve information about JVM threads: $0",
479 status.GetDetail()).c_str(), doc->GetAllocator());
480 doc->AddMember("error", error, doc->GetAllocator());
481 return;
482 }
483 Value overview(kObjectType);
484 overview.AddMember("thread_count", response.total_thread_count, doc->GetAllocator());
485 overview.AddMember("daemon_count", response.daemon_thread_count, doc->GetAllocator());
486 overview.AddMember("peak_count", response.peak_thread_count, doc->GetAllocator());
487 overview.AddMember("timestamp", ToStringFromUnixMillis(UnixMillis(),
488 TimePrecision::Millisecond), doc->GetAllocator());
489 doc->AddMember("overview", overview, doc->GetAllocator());
490
491 Value lst(kArrayType);
492 for (const TJvmThreadInfo& thread: response.threads) {
493 Value val(kObjectType);
494 Value summary(thread.summary.c_str(), doc->GetAllocator());
495 val.AddMember("summary", summary, doc->GetAllocator());
496 val.AddMember("cpu_time_sec", static_cast<double>(thread.cpu_time_in_ns) / 1e9,
497 doc->GetAllocator());
498 val.AddMember("user_time_sec", static_cast<double>(thread.user_time_in_ns) / 1e9,
499 doc->GetAllocator());
500 val.AddMember("blocked_time_ms", thread.blocked_time_in_ms, doc->GetAllocator());
501 val.AddMember("blocked_count", thread.blocked_count, doc->GetAllocator());
502 val.AddMember("is_native", thread.is_in_native, doc->GetAllocator());
503 lst.PushBack(val, doc->GetAllocator());
504 }
505 doc->AddMember("jvm-threads", lst, doc->GetAllocator());
506}
507
508}
509

Callers 1

RegisterUrlCallbacksFunction · 0.85

Calls 6

SubstituteFunction · 0.85
UnixMillisFunction · 0.85
GetDetailMethod · 0.80
PushBackMethod · 0.80
okMethod · 0.45
AddMemberMethod · 0.45

Tested by

no test coverage detected