comparison src/share/vm/services/memTracker.cpp @ 10148:fbca7eaeac2e

8011218: Kitchensink hanged, likely NMT is to blame Summary: Made NMT query safepoint aware. Reviewed-by: dholmes, coleenp
author zgu
date Wed, 24 Apr 2013 14:55:04 -0400
parents 35f8765422b9
children fb14e9ed1594
comparison
equal deleted inserted replaced
10147:cc70cbbd422e 10148:fbca7eaeac2e
571 } 571 }
572 } 572 }
573 573
574 // baseline current memory snapshot 574 // baseline current memory snapshot
575 bool MemTracker::baseline() { 575 bool MemTracker::baseline() {
576 MutexLockerEx lock(_query_lock, true); 576 MutexLocker lock(_query_lock);
577 MemSnapshot* snapshot = get_snapshot(); 577 MemSnapshot* snapshot = get_snapshot();
578 if (snapshot != NULL) { 578 if (snapshot != NULL) {
579 return _baseline.baseline(*snapshot, false); 579 return _baseline.baseline(*snapshot, false);
580 } 580 }
581 return false; 581 return false;
582 } 582 }
583 583
584 // print memory usage from current snapshot 584 // print memory usage from current snapshot
585 bool MemTracker::print_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) { 585 bool MemTracker::print_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) {
586 MemBaseline baseline; 586 MemBaseline baseline;
587 MutexLockerEx lock(_query_lock, true); 587 MutexLocker lock(_query_lock);
588 MemSnapshot* snapshot = get_snapshot(); 588 MemSnapshot* snapshot = get_snapshot();
589 if (snapshot != NULL && baseline.baseline(*snapshot, summary_only)) { 589 if (snapshot != NULL && baseline.baseline(*snapshot, summary_only)) {
590 BaselineReporter reporter(out, unit); 590 BaselineReporter reporter(out, unit);
591 reporter.report_baseline(baseline, summary_only); 591 reporter.report_baseline(baseline, summary_only);
592 return true; 592 return true;
595 } 595 }
596 596
597 // Whitebox API for blocking until the current generation of NMT data has been merged 597 // Whitebox API for blocking until the current generation of NMT data has been merged
598 bool MemTracker::wbtest_wait_for_data_merge() { 598 bool MemTracker::wbtest_wait_for_data_merge() {
599 // NMT can't be shutdown while we're holding _query_lock 599 // NMT can't be shutdown while we're holding _query_lock
600 MutexLockerEx lock(_query_lock, true); 600 MutexLocker lock(_query_lock);
601 assert(_worker_thread != NULL, "Invalid query"); 601 assert(_worker_thread != NULL, "Invalid query");
602 // the generation at query time, so NMT will spin till this generation is processed 602 // the generation at query time, so NMT will spin till this generation is processed
603 unsigned long generation_at_query_time = SequenceGenerator::current_generation(); 603 unsigned long generation_at_query_time = SequenceGenerator::current_generation();
604 unsigned long current_processing_generation = _processing_generation; 604 unsigned long current_processing_generation = _processing_generation;
605 // if generation counter overflown 605 // if generation counter overflown
639 return false; 639 return false;
640 } 640 }
641 641
642 // compare memory usage between current snapshot and baseline 642 // compare memory usage between current snapshot and baseline
643 bool MemTracker::compare_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) { 643 bool MemTracker::compare_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) {
644 MutexLockerEx lock(_query_lock, true); 644 MutexLocker lock(_query_lock);
645 if (_baseline.baselined()) { 645 if (_baseline.baselined()) {
646 MemBaseline baseline; 646 MemBaseline baseline;
647 MemSnapshot* snapshot = get_snapshot(); 647 MemSnapshot* snapshot = get_snapshot();
648 if (snapshot != NULL && baseline.baseline(*snapshot, summary_only)) { 648 if (snapshot != NULL && baseline.baseline(*snapshot, summary_only)) {
649 BaselineReporter reporter(out, unit); 649 BaselineReporter reporter(out, unit);