22 #ifdef DO_MEMORY_USAGE 25 if (info->is_size_known()) {
26 _size += info->get_size();
28 _unknown_size_count++;
36 void MemoryUsagePointerCounts::
37 output(std::ostream &out)
const {
38 #ifdef DO_MEMORY_USAGE 39 out << _count <<
" pointers";
40 if (_unknown_size_count < _count) {
42 output_bytes(out, _size);
44 output_bytes(out, _size / (_count - _unknown_size_count));
47 if (_unknown_size_count != 0) {
48 out <<
" (" << _unknown_size_count <<
" of unknown size)";
58 void MemoryUsagePointerCounts::
59 output_bytes(std::ostream &out,
size_t size) {
60 #ifdef DO_MEMORY_USAGE 61 if (size < 4 * 1024) {
62 out << size <<
" bytes";
64 }
else if (size < 4 * 1024 * 1024) {
65 out << size / 1024 <<
" Kb";
68 out << size / (1024 * 1024) <<
" Mb";
void add_info(MemoryInfo *info)
Adds a pointer definition to the counter.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.