| 427 | } |
| 428 | |
| 429 | virtual bool GetNumericProperty(const char* name, size_t* value) { |
| 430 | ASSERT(name != NULL); |
| 431 | |
| 432 | if (strcmp(name, "generic.current_allocated_bytes") == 0) { |
| 433 | TCMallocStats stats; |
| 434 | ExtractStats(&stats, NULL); |
| 435 | *value = stats.system_bytes |
| 436 | - stats.thread_bytes |
| 437 | - stats.central_bytes |
| 438 | - stats.transfer_bytes |
| 439 | - stats.pageheap_bytes; |
| 440 | return true; |
| 441 | } |
| 442 | |
| 443 | if (strcmp(name, "generic.heap_size") == 0) { |
| 444 | TCMallocStats stats; |
| 445 | ExtractStats(&stats, NULL); |
| 446 | *value = stats.system_bytes; |
| 447 | return true; |
| 448 | } |
| 449 | |
| 450 | if (strcmp(name, "tcmalloc.slack_bytes") == 0) { |
| 451 | // We assume that bytes in the page heap are not fragmented too |
| 452 | // badly, and are therefore available for allocation. |
| 453 | SpinLockHolder l(Static::pageheap_lock()); |
| 454 | *value = Static::pageheap()->FreeBytes(); |
| 455 | return true; |
| 456 | } |
| 457 | |
| 458 | if (strcmp(name, "tcmalloc.max_total_thread_cache_bytes") == 0) { |
| 459 | SpinLockHolder l(Static::pageheap_lock()); |
| 460 | *value = ThreadCache::overall_thread_cache_size(); |
| 461 | return true; |
| 462 | } |
| 463 | |
| 464 | if (strcmp(name, "tcmalloc.current_total_thread_cache_bytes") == 0) { |
| 465 | TCMallocStats stats; |
| 466 | ExtractStats(&stats, NULL); |
| 467 | *value = stats.thread_bytes; |
| 468 | return true; |
| 469 | } |
| 470 | |
| 471 | return false; |
| 472 | } |
| 473 | |
| 474 | virtual bool SetNumericProperty(const char* name, size_t value) { |
| 475 | ASSERT(name != NULL); |
nothing calls this directly
no test coverage detected