Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: src/heap.cc

Issue 10854043: Add histograms for total allocated/live heap size, as well as allocated size and percentage of tota… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/v8-counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 static_cast<int>(SizeOfObjects())); 446 static_cast<int>(SizeOfObjects()));
447 447
448 isolate_->counters()->symbol_table_capacity()->Set( 448 isolate_->counters()->symbol_table_capacity()->Set(
449 symbol_table()->Capacity()); 449 symbol_table()->Capacity());
450 isolate_->counters()->number_of_symbols()->Set( 450 isolate_->counters()->number_of_symbols()->Set(
451 symbol_table()->NumberOfElements()); 451 symbol_table()->NumberOfElements());
452 452
453 if (CommittedMemory() > 0) { 453 if (CommittedMemory() > 0) {
454 isolate_->counters()->external_fragmentation_total()->AddSample( 454 isolate_->counters()->external_fragmentation_total()->AddSample(
455 static_cast<int>(100 - (SizeOfObjects() * 100.0) / CommittedMemory())); 455 static_cast<int>(100 - (SizeOfObjects() * 100.0) / CommittedMemory()));
456
457 isolate_->counters()->heap_fraction_map_space()->AddSample(
458 static_cast<int>(
459 (map_space()->CommittedMemory() * 100.0) / CommittedMemory()));
460 isolate_->counters()->heap_fraction_cell_space()->AddSample(
461 static_cast<int>(
462 (cell_space()->CommittedMemory() * 100.0) / CommittedMemory()));
463
464 isolate_->counters()->heap_sample_total_committed()->AddSample(
465 CommittedMemory() / KB);
466 isolate_->counters()->heap_sample_total_used()->AddSample(
467 SizeOfObjects() / KB);
468 isolate_->counters()->heap_sample_map_space_committed()->AddSample(
469 map_space()->CommittedMemory() / KB);
470 isolate_->counters()->heap_sample_cell_space_committed()->AddSample(
471 cell_space()->CommittedMemory() / KB);
456 } 472 }
457 473
458 #define UPDATE_COUNTERS_FOR_SPACE(space) \ 474 #define UPDATE_COUNTERS_FOR_SPACE(space) \
459 isolate_->counters()->space##_bytes_available()->Set( \ 475 isolate_->counters()->space##_bytes_available()->Set( \
460 static_cast<int>(space()->Available())); \ 476 static_cast<int>(space()->Available())); \
461 isolate_->counters()->space##_bytes_committed()->Set( \ 477 isolate_->counters()->space##_bytes_committed()->Set( \
462 static_cast<int>(space()->CommittedMemory())); \ 478 static_cast<int>(space()->CommittedMemory())); \
463 isolate_->counters()->space##_bytes_used()->Set( \ 479 isolate_->counters()->space##_bytes_used()->Set( \
464 static_cast<int>(space()->SizeOfObjects())); 480 static_cast<int>(space()->SizeOfObjects()));
465 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \ 481 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \
(...skipping 6781 matching lines...) Expand 10 before | Expand all | Expand 10 after
7247 static_cast<int>(object_sizes_last_time_[index])); 7263 static_cast<int>(object_sizes_last_time_[index]));
7248 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7264 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7249 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7265 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7250 7266
7251 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7267 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7252 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7268 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7253 ClearObjectStats(); 7269 ClearObjectStats();
7254 } 7270 }
7255 7271
7256 } } // namespace v8::internal 7272 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698