summaryrefslogtreecommitdiffstats
path: root/runtime/gc
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-04-11 15:31:09 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-04-11 15:37:40 -0700
commitd20aba14a3cb522e933800a164f7dc10eba21da3 (patch)
treed21dac8bacfdf4db8fd3c95f9271d4294199fa9d /runtime/gc
parent6a12a03cd4f4f2a145567362b016538beb13733b (diff)
downloadart-d20aba14a3cb522e933800a164f7dc10eba21da3.zip
art-d20aba14a3cb522e933800a164f7dc10eba21da3.tar.gz
art-d20aba14a3cb522e933800a164f7dc10eba21da3.tar.bz2
Fix an occasional ThreadStress crash.
Also, fix the NativeAllocations test for the case with the GSS collector as the default GC. Since kGcCauseForAlloc (incorrect) was being passed into the collector instead of kGcCauseForNativeAlloc (correct) from Heap::RegisterNativeAllocation(), the GCC collector never invoked a whole heap collection which was necessary to do sufficent finalizations to pass the test. Bug: 13988451 Bug: 11650816 Change-Id: Ib02f061751cd777e0d3bfa81b29e04a874dc58a0
Diffstat (limited to 'runtime/gc')
-rw-r--r--runtime/gc/heap.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 91f249a..35ec297 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -667,7 +667,8 @@ void Heap::DumpGcPerformanceInfo(std::ostream& os) {
for (auto& collector : garbage_collectors_) {
const CumulativeLogger& logger = collector->GetCumulativeTimings();
const size_t iterations = logger.GetIterations();
- if (iterations != 0) {
+ const Histogram<uint64_t>& pause_histogram = collector->GetPauseHistogram();
+ if (iterations != 0 && pause_histogram.SampleSize() != 0) {
os << ConstDumpable<CumulativeLogger>(logger);
const uint64_t total_ns = logger.GetTotalNs();
const uint64_t total_pause_ns = collector->GetTotalPausedTimeNs();
@@ -675,8 +676,8 @@ void Heap::DumpGcPerformanceInfo(std::ostream& os) {
const uint64_t freed_bytes = collector->GetTotalFreedBytes();
const uint64_t freed_objects = collector->GetTotalFreedObjects();
Histogram<uint64_t>::CumulativeData cumulative_data;
- collector->GetPauseHistogram().CreateHistogram(&cumulative_data);
- collector->GetPauseHistogram().PrintConfidenceIntervals(os, 0.99, cumulative_data);
+ pause_histogram.CreateHistogram(&cumulative_data);
+ pause_histogram.PrintConfidenceIntervals(os, 0.99, cumulative_data);
os << collector->GetName() << " total time: " << PrettyDuration(total_ns)
<< " mean time: " << PrettyDuration(total_ns / iterations) << "\n"
<< collector->GetName() << " freed: " << freed_objects
@@ -2797,7 +2798,7 @@ void Heap::RegisterNativeAllocation(JNIEnv* env, int bytes) {
if (IsGcConcurrent()) {
RequestConcurrentGC(self);
} else {
- CollectGarbageInternal(gc_type, kGcCauseForAlloc, false);
+ CollectGarbageInternal(gc_type, kGcCauseForNativeAlloc, false);
}
}
}