| 313 | } |
| 314 | |
| 315 | void* Server::UpdateDerivedVars(void* arg) { |
| 316 | const int64_t start_us = butil::cpuwide_time_us(); |
| 317 | |
| 318 | Server* server = static_cast<Server*>(arg); |
| 319 | const std::string prefix = server->ServerPrefix(); |
| 320 | std::vector<SocketId> conns; |
| 321 | std::vector<SocketId> internal_conns; |
| 322 | |
| 323 | server->_nerror_bvar.expose_as(prefix, "error"); |
| 324 | |
| 325 | server->_eps_bvar.expose_as(prefix, "eps"); |
| 326 | |
| 327 | server->_concurrency_bvar.expose_as(prefix, "concurrency"); |
| 328 | |
| 329 | bvar::PassiveStatus<timeval> uptime_st( |
| 330 | prefix, "uptime", GetUptime, (void*)(intptr_t)start_us); |
| 331 | |
| 332 | bvar::PassiveStatus<std::string> start_time_st( |
| 333 | prefix, "start_time", PrintStartTime, server); |
| 334 | |
| 335 | bvar::PassiveStatus<int32_t> nconn_st( |
| 336 | prefix, "connection_count", GetConnectionCount, server); |
| 337 | |
| 338 | bvar::PassiveStatus<int32_t> nservice_st( |
| 339 | prefix, "service_count", GetServiceCount, server); |
| 340 | |
| 341 | bvar::PassiveStatus<int32_t> nbuiltinservice_st( |
| 342 | prefix, "builtin_service_count", GetBuiltinServiceCount, server); |
| 343 | |
| 344 | bvar::PassiveStatus<bvar::Vector<unsigned, 2> > nsessiondata_st( |
| 345 | GetSessionLocalDataCount, server); |
| 346 | if (server->session_local_data_pool()) { |
| 347 | nsessiondata_st.expose_as(prefix, "session_local_data_count"); |
| 348 | nsessiondata_st.set_vector_names("using,free"); |
| 349 | } |
| 350 | |
| 351 | std::string mprefix = prefix; |
| 352 | for (MethodMap::iterator it = server->_method_map.begin(); |
| 353 | it != server->_method_map.end(); ++it) { |
| 354 | // Not expose counters on builtin services. |
| 355 | if (!it->second.is_builtin_service) { |
| 356 | mprefix.resize(prefix.size()); |
| 357 | mprefix.push_back('_'); |
| 358 | bvar::to_underscored_name(&mprefix, it->second.method->full_name()); |
| 359 | it->second.status->Expose(mprefix); |
| 360 | } |
| 361 | } |
| 362 | if (server->options().baidu_master_service) { |
| 363 | server->options().baidu_master_service->Expose(prefix); |
| 364 | } |
| 365 | if (server->options().nshead_service) { |
| 366 | server->options().nshead_service->Expose(prefix); |
| 367 | } |
| 368 | |
| 369 | #ifdef ENABLE_THRIFT_FRAMED_PROTOCOL |
| 370 | if (server->options().thrift_service) { |
| 371 | server->options().thrift_service->Expose(prefix); |
| 372 | } |
nothing calls this directly
no test coverage detected