| 272 | } |
| 273 | |
| 274 | int64_t JvmMetricCache::GetPoolMetric(const std::string& mempool_name, |
| 275 | JvmMemoryMetricType type) { |
| 276 | GrabMetricsIfNecessary(); |
| 277 | |
| 278 | shared_lock<shared_mutex> shared_l(lock_); |
| 279 | for (const TJvmMemoryPool& pool : last_response_.memory_pools) { |
| 280 | if (pool.name == mempool_name) { |
| 281 | switch (type) { |
| 282 | case MAX: |
| 283 | return pool.max; |
| 284 | case INIT: |
| 285 | return pool.init; |
| 286 | case CURRENT: |
| 287 | return pool.used; |
| 288 | case COMMITTED: |
| 289 | return pool.committed; |
| 290 | case PEAK_MAX: |
| 291 | return pool.peak_max; |
| 292 | case PEAK_INIT: |
| 293 | return pool.peak_init; |
| 294 | case PEAK_CURRENT: |
| 295 | return pool.peak_used; |
| 296 | case PEAK_COMMITTED: |
| 297 | return pool.peak_committed; |
| 298 | default: |
| 299 | DCHECK(false) << "Unknown JvmMemoryMetricType: " << type; |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | DCHECK(false) << "Could not find pool: " << mempool_name; |
| 304 | return 0; |
| 305 | } |
| 306 | |
| 307 | vector<string> JvmMetricCache::GetPoolNames() { |
| 308 | GrabMetricsIfNecessary(); |