| 226 | } |
| 227 | |
| 228 | void ThreadMgr::GetThreadOverview(Document* document) { |
| 229 | lock_guard<mutex> l(lock_); |
| 230 | if (metrics_enabled_) { |
| 231 | document->AddMember("total_threads", current_num_threads_metric_->GetValue(), |
| 232 | document->GetAllocator()); |
| 233 | } |
| 234 | Value lst(kArrayType); |
| 235 | for (const ThreadCategoryMap::value_type& category: thread_categories_) { |
| 236 | Value val(kObjectType); |
| 237 | Value name(category.first.c_str(), document->GetAllocator()); |
| 238 | val.AddMember("name", name, document->GetAllocator()); |
| 239 | val.AddMember("size", static_cast<uint64_t>(category.second.threads_by_id.size()), |
| 240 | document->GetAllocator()); |
| 241 | val.AddMember("num_created", |
| 242 | static_cast<uint64_t>(category.second.num_threads_created), |
| 243 | document->GetAllocator()); |
| 244 | // TODO: URLEncode() name? |
| 245 | lst.PushBack(val, document->GetAllocator()); |
| 246 | } |
| 247 | document->AddMember("thread-groups", lst, document->GetAllocator()); |
| 248 | } |
| 249 | |
| 250 | void ThreadMgr::ThreadGroupUrlCallback(const Webserver::WebRequest& req, |
| 251 | Document* document) { |
no test coverage detected