OLD | NEW |
1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 return true; | 671 return true; |
672 } | 672 } |
673 | 673 |
674 if (strcmp(name, "generic.heap_size") == 0) { | 674 if (strcmp(name, "generic.heap_size") == 0) { |
675 TCMallocStats stats; | 675 TCMallocStats stats; |
676 ExtractStats(&stats, NULL, NULL, NULL); | 676 ExtractStats(&stats, NULL, NULL, NULL); |
677 *value = stats.pageheap.system_bytes; | 677 *value = stats.pageheap.system_bytes; |
678 return true; | 678 return true; |
679 } | 679 } |
680 | 680 |
| 681 if (strcmp(name, "generic.total_physical_bytes") == 0) { |
| 682 TCMallocStats stats; |
| 683 ExtractStats(&stats, NULL, NULL, NULL); |
| 684 *value = stats.pageheap.system_bytes + stats.metadata_bytes - |
| 685 stats.pageheap.unmapped_bytes - stats.metadata_unmapped_bytes; |
| 686 return true; |
| 687 } |
| 688 |
681 if (strcmp(name, "tcmalloc.slack_bytes") == 0) { | 689 if (strcmp(name, "tcmalloc.slack_bytes") == 0) { |
682 // Kept for backwards compatibility. Now defined externally as: | 690 // Kept for backwards compatibility. Now defined externally as: |
683 // pageheap_free_bytes + pageheap_unmapped_bytes. | 691 // pageheap_free_bytes + pageheap_unmapped_bytes. |
684 SpinLockHolder l(Static::pageheap_lock()); | 692 SpinLockHolder l(Static::pageheap_lock()); |
685 PageHeap::Stats stats = Static::pageheap()->stats(); | 693 PageHeap::Stats stats = Static::pageheap()->stats(); |
686 *value = stats.free_bytes + stats.unmapped_bytes; | 694 *value = stats.free_bytes + stats.unmapped_bytes; |
687 return true; | 695 return true; |
688 } | 696 } |
689 | 697 |
690 if (strcmp(name, "tcmalloc.pageheap_free_bytes") == 0) { | 698 if (strcmp(name, "tcmalloc.pageheap_free_bytes") == 0) { |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 *mark = ~allocated_mark; // Distinctively not allocated. | 1896 *mark = ~allocated_mark; // Distinctively not allocated. |
1889 } | 1897 } |
1890 | 1898 |
1891 static void MarkAllocatedRegion(void* ptr) { | 1899 static void MarkAllocatedRegion(void* ptr) { |
1892 if (ptr == NULL) return; | 1900 if (ptr == NULL) return; |
1893 MarkType* mark = GetMarkLocation(ptr); | 1901 MarkType* mark = GetMarkLocation(ptr); |
1894 *mark = GetMarkValue(ptr, mark); | 1902 *mark = GetMarkValue(ptr, mark); |
1895 } | 1903 } |
1896 | 1904 |
1897 #endif // TCMALLOC_VALIDATION | 1905 #endif // TCMALLOC_VALIDATION |
OLD | NEW |