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

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 1372313003: Oilpan: Add TRACE_DISABLED_BY_DEFAULT to trace counters in oilpan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 return estimationBaseSize - sizeRetainedByCollectedPersistents; 576 return estimationBaseSize - sizeRetainedByCollectedPersistents;
577 } 577 }
578 578
579 double ThreadState::heapGrowingRate() 579 double ThreadState::heapGrowingRate()
580 { 580 {
581 size_t currentSize = Heap::allocatedObjectSize() + Heap::markedObjectSize(); 581 size_t currentSize = Heap::allocatedObjectSize() + Heap::markedObjectSize();
582 size_t estimatedSize = estimatedLiveSize(Heap::markedObjectSizeAtLastComplet eSweep(), Heap::markedObjectSizeAtLastCompleteSweep()); 582 size_t estimatedSize = estimatedLiveSize(Heap::markedObjectSizeAtLastComplet eSweep(), Heap::markedObjectSizeAtLastCompleteSweep());
583 583
584 // If the estimatedSize is 0, we set a high growing rate to trigger a GC. 584 // If the estimatedSize is 0, we set a high growing rate to trigger a GC.
585 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100; 585 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100;
586 TRACE_COUNTER1("blink_gc", "ThreadState::heapEstimatedSizeKB", std::min(esti matedSize / 1024, static_cast<size_t>(INT_MAX))); 586 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::heapEsti matedSizeKB", std::min(estimatedSize / 1024, static_cast<size_t>(INT_MAX)));
587 TRACE_COUNTER1("blink_gc", "ThreadState::heapGrowingRate", static_cast<int>( 100 * growingRate)); 587 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::heapGrow ingRate", static_cast<int>(100 * growingRate));
588 return growingRate; 588 return growingRate;
589 } 589 }
590 590
591 double ThreadState::partitionAllocGrowingRate() 591 double ThreadState::partitionAllocGrowingRate()
592 { 592 {
593 size_t currentSize = WTF::Partitions::totalSizeOfCommittedPages(); 593 size_t currentSize = WTF::Partitions::totalSizeOfCommittedPages();
594 size_t estimatedSize = estimatedLiveSize(currentSize, Heap::partitionAllocSi zeAtLastGC()); 594 size_t estimatedSize = estimatedLiveSize(currentSize, Heap::partitionAllocSi zeAtLastGC());
595 595
596 // If the estimatedSize is 0, we set a high growing rate to trigger a GC. 596 // If the estimatedSize is 0, we set a high growing rate to trigger a GC.
597 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100; 597 double growingRate = estimatedSize > 0 ? 1.0 * currentSize / estimatedSize : 100;
598 TRACE_COUNTER1("blink_gc", "ThreadState::partitionAllocEstimatedSizeKB", std ::min(estimatedSize / 1024, static_cast<size_t>(INT_MAX))); 598 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocEstimatedSizeKB", std::min(estimatedSize / 1024, static_cast<size_t>(INT_M AX)));
599 TRACE_COUNTER1("blink_gc", "ThreadState::partitionAllocGrowingRate", static_ cast<int>(100 * growingRate)); 599 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::partitio nAllocGrowingRate", static_cast<int>(100 * growingRate));
600 return growingRate; 600 return growingRate;
601 } 601 }
602 602
603 // TODO(haraken): We should improve the GC heuristics. The heuristics affect 603 // TODO(haraken): We should improve the GC heuristics. The heuristics affect
604 // performance significantly. 604 // performance significantly.
605 bool ThreadState::judgeGCThreshold(size_t totalMemorySizeThreshold, double heapG rowingRateThreshold) 605 bool ThreadState::judgeGCThreshold(size_t totalMemorySizeThreshold, double heapG rowingRateThreshold)
606 { 606 {
607 // If the allocated object size or the total memory size is small, don't tri gger a GC. 607 // If the allocated object size or the total memory size is small, don't tri gger a GC.
608 if (Heap::allocatedObjectSize() < 100 * 1024 || totalMemorySize() < totalMem orySizeThreshold) 608 if (Heap::allocatedObjectSize() < 100 * 1024 || totalMemorySize() < totalMem orySizeThreshold)
609 return false; 609 return false;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 case SweepingAndPreciseGCScheduled: 964 case SweepingAndPreciseGCScheduled:
965 ASSERT(checkThread()); 965 ASSERT(checkThread());
966 VERIFY_STATE_TRANSITION(m_gcState == Sweeping || m_gcState == SweepingAn dIdleGCScheduled || m_gcState == SweepingAndPreciseGCScheduled); 966 VERIFY_STATE_TRANSITION(m_gcState == Sweeping || m_gcState == SweepingAn dIdleGCScheduled || m_gcState == SweepingAndPreciseGCScheduled);
967 break; 967 break;
968 default: 968 default:
969 ASSERT_NOT_REACHED(); 969 ASSERT_NOT_REACHED();
970 } 970 }
971 m_gcState = gcState; 971 m_gcState = gcState;
972 #if ENABLE(GC_PROFILING) 972 #if ENABLE(GC_PROFILING)
973 if (isMainThread()) 973 if (isMainThread())
974 TRACE_COUNTER1("blink_gc", "ThreadState::gcState", static_cast<int>(m_gc State)); 974 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::gcSt ate", static_cast<int>(m_gcState));
975 #endif 975 #endif
976 } 976 }
977 977
978 #undef VERIFY_STATE_TRANSITION 978 #undef VERIFY_STATE_TRANSITION
979 979
980 ThreadState::GCState ThreadState::gcState() const 980 ThreadState::GCState ThreadState::gcState() const
981 { 981 {
982 return m_gcState; 982 return m_gcState;
983 } 983 }
984 984
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 1210
1211 void ThreadState::postSweep() 1211 void ThreadState::postSweep()
1212 { 1212 {
1213 ASSERT(checkThread()); 1213 ASSERT(checkThread());
1214 Heap::reportMemoryUsageForTracing(); 1214 Heap::reportMemoryUsageForTracing();
1215 1215
1216 if (isMainThread()) { 1216 if (isMainThread()) {
1217 double collectionRate = 0; 1217 double collectionRate = 0;
1218 if (Heap::objectSizeAtLastGC() > 0) 1218 if (Heap::objectSizeAtLastGC() > 0)
1219 collectionRate = 1 - 1.0 * Heap::markedObjectSize() / Heap::objectSi zeAtLastGC(); 1219 collectionRate = 1 - 1.0 * Heap::markedObjectSize() / Heap::objectSi zeAtLastGC();
1220 TRACE_COUNTER1("blink_gc", "ThreadState::collectionRate", static_cast<in t>(100 * collectionRate)); 1220 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), "ThreadState::coll ectionRate", static_cast<int>(100 * collectionRate));
1221 1221
1222 #if PRINT_HEAP_STATS 1222 #if PRINT_HEAP_STATS
1223 dataLogF("ThreadState::postSweep (collectionRate=%d%%)\n", static_cast<i nt>(100 * collectionRate)); 1223 dataLogF("ThreadState::postSweep (collectionRate=%d%%)\n", static_cast<i nt>(100 * collectionRate));
1224 #endif 1224 #endif
1225 1225
1226 // Heap::markedObjectSize() may be underestimated here if any other 1226 // Heap::markedObjectSize() may be underestimated here if any other
1227 // thread has not yet finished lazy sweeping. 1227 // thread has not yet finished lazy sweeping.
1228 Heap::setMarkedObjectSizeAtLastCompleteSweep(Heap::markedObjectSize()); 1228 Heap::setMarkedObjectSizeAtLastCompleteSweep(Heap::markedObjectSize());
1229 } 1229 }
1230 1230
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 json->beginArray(it->key.ascii().data()); 1661 json->beginArray(it->key.ascii().data());
1662 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1662 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1663 json->pushInteger(it->value.ages[age]); 1663 json->pushInteger(it->value.ages[age]);
1664 json->endArray(); 1664 json->endArray();
1665 } 1665 }
1666 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1666 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1667 } 1667 }
1668 #endif 1668 #endif
1669 1669
1670 } // namespace blink 1670 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698