< prev index next >

src/hotspot/share/services/virtualMemoryTracker.cpp

Print this page
rev 57511 : [mq]: metaspace-improvement


 585 
 586 // Transition virtual memory tracking level.
 587 bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
 588   assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything");
 589   if (to == NMT_minimal) {
 590     assert(from == NMT_summary || from == NMT_detail, "Just check");
 591     // Clean up virtual memory tracking data structures.
 592     ThreadCritical tc;
 593     // Check for potential race with other thread calling transition
 594     if (_reserved_regions != NULL) {
 595       delete _reserved_regions;
 596       _reserved_regions = NULL;
 597     }
 598   }
 599 
 600   return true;
 601 }
 602 
 603 // Metaspace Support
 604 MetaspaceSnapshot::MetaspaceSnapshot() {
 605   for (int index = (int)Metaspace::ClassType; index < (int)Metaspace::MetadataTypeCount; index ++) {
 606     Metaspace::MetadataType type = (Metaspace::MetadataType)index;
 607     assert_valid_metadata_type(type);
 608     _reserved_in_bytes[type]  = 0;
 609     _committed_in_bytes[type] = 0;
 610     _used_in_bytes[type]      = 0;
 611     _free_in_bytes[type]      = 0;
 612   }
 613 }
 614 
 615 void MetaspaceSnapshot::snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& mss) {
 616   assert_valid_metadata_type(type);
 617 
 618   mss._reserved_in_bytes[type]   = MetaspaceUtils::reserved_bytes(type);
 619   mss._committed_in_bytes[type]  = MetaspaceUtils::committed_bytes(type);
 620   mss._used_in_bytes[type]       = MetaspaceUtils::used_bytes(type);
 621 
 622   size_t free_in_bytes = (MetaspaceUtils::capacity_bytes(type) - MetaspaceUtils::used_bytes(type))
 623                        + MetaspaceUtils::free_chunks_total_bytes(type)
 624                        + MetaspaceUtils::free_in_vs_bytes(type);
 625   mss._free_in_bytes[type] = free_in_bytes;
 626 }
 627 
 628 void MetaspaceSnapshot::snapshot(MetaspaceSnapshot& mss) {
 629   snapshot(Metaspace::ClassType, mss);
 630   if (Metaspace::using_class_space()) {
 631     snapshot(Metaspace::NonClassType, mss);
 632   }
 633 }


 585 
 586 // Transition virtual memory tracking level.
 587 bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
 588   assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything");
 589   if (to == NMT_minimal) {
 590     assert(from == NMT_summary || from == NMT_detail, "Just check");
 591     // Clean up virtual memory tracking data structures.
 592     ThreadCritical tc;
 593     // Check for potential race with other thread calling transition
 594     if (_reserved_regions != NULL) {
 595       delete _reserved_regions;
 596       _reserved_regions = NULL;
 597     }
 598   }
 599 
 600   return true;
 601 }
 602 
 603 // Metaspace Support
 604 MetaspaceSnapshot::MetaspaceSnapshot() {
 605   for (int index = (int)metaspace::ClassType; index < (int)metaspace::MetadataTypeCount; index ++) {
 606     metaspace::MetadataType type = (metaspace::MetadataType)index;
 607     assert_valid_metadata_type(type);
 608     _reserved_in_bytes[type]  = 0;
 609     _committed_in_bytes[type] = 0;
 610     _used_in_bytes[type]      = 0;
 611     _free_in_bytes[type]      = 0;
 612   }
 613 }
 614 
 615 void MetaspaceSnapshot::snapshot(metaspace::MetadataType type, MetaspaceSnapshot& mss) {
 616   assert_valid_metadata_type(type);
 617 
 618   mss._reserved_in_bytes[type]   = MetaspaceUtils::reserved_bytes(type);
 619   mss._committed_in_bytes[type]  = MetaspaceUtils::committed_bytes(type);
 620   mss._used_in_bytes[type]       = MetaspaceUtils::used_bytes(type);
 621 
 622   size_t free_in_bytes = 0;// TODO fix(MetaspaceUtils::capacity_bytes(type) - MetaspaceUtils::used_bytes(type))
 623                      //  + MetaspaceUtils::free_chunks_total_bytes(type)
 624                      //  + MetaspaceUtils::free_in_vs_bytes(type);
 625   mss._free_in_bytes[type] = free_in_bytes;
 626 }
 627 
 628 void MetaspaceSnapshot::snapshot(MetaspaceSnapshot& mss) {
 629   snapshot(metaspace::ClassType, mss);
 630   if (Metaspace::using_class_space()) {
 631     snapshot(metaspace::NonClassType, mss);
 632   }
 633 }
< prev index next >