Skip to content

Commit

Permalink
Adding gc_index based filter for generational analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Aug 15, 2020
1 parent 41d6be2 commit 5ff3fea
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/env/gcenv.ee.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GCToEEInterface
static uint32_t GetTotalNumSizedRefHandles();

static bool AnalyzeSurvivorsRequested(int condemnedGeneration);
static void AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)());
static void AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)());

static void VerifySyncTableEntry();
static void UpdateGCEventStatus(int publicLevel, int publicKeywords, int privateLevel, int privateKeywords);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20921,7 +20921,7 @@ void gc_heap::mark_phase (int condemned_gen_number, BOOL mark_only_p)
promoted_bytes_global = promoted_bytes (0);
#endif //MULTIPLE_HEAPS

GCToEEInterface::AnalyzeSurvivorsFinished (condemned_gen_number, promoted_bytes_global, GCHeap::ReportGenerationBounds);
GCToEEInterface::AnalyzeSurvivorsFinished (settings.gc_index, condemned_gen_number, promoted_bytes_global, GCHeap::ReportGenerationBounds);
#endif // HEAP_ANALYZE
GCToEEInterface::AfterGcScanRoots (condemned_gen_number, max_generation, &sc);

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/gc/gcenv.ee.standalone.inl
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ inline bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
return g_theGCToCLR->AnalyzeSurvivorsRequested(condemnedGeneration);
}

inline void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
inline void GCToEEInterface::AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
{
assert(g_theGCToCLR != nullptr);
g_theGCToCLR->AnalyzeSurvivorsFinished(condemnedGeneration, promoted_bytes, reportGenerationBounds);
g_theGCToCLR->AnalyzeSurvivorsFinished(gcIndex, condemnedGeneration, promoted_bytes, reportGenerationBounds);
}

inline void GCToEEInterface::VerifySyncTableEntry()
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/gcinterface.ee.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class IGCToCLR {
bool AnalyzeSurvivorsRequested(int condemnedGeneration) = 0;

virtual
void AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)()) = 0;
void AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)()) = 0;

virtual
void VerifySyncTableEntry() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/sample/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ inline bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
return false;
}

inline void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
inline void GCToEEInterface::AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
{

}
5 changes: 3 additions & 2 deletions src/coreclr/src/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,9 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeProcNumbers, W("EventPipeProcNumbers"
//
// Generational Aware Analysis
//
RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCGenAnalysisGen, W("GCGenAnalysisGen"), 0, "TBD")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCGenAnalysisBytes, W("GCGenAnalysisBytes"), 0, "TBD")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCGenAnalysisGen, W("GCGenAnalysisGen"), 0, "The generation to trigger generational aware analysis")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCGenAnalysisBytes, W("GCGenAnalysisBytes"), 0, "The number of bytes to trigger generational aware analysis")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCGenAnalysisIndex, W("GCGenAnalysisIndex"), 0, "The gc index to trigger generational aware analysis")

//
// Diagnostics Ports
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/vm/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
return false;
}

void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
void GCToEEInterface::AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)())
{
LIMITED_METHOD_CONTRACT;

Expand All @@ -1600,7 +1600,7 @@ void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t
if (gcGenAnalysisState == GcGenAnalysisState::Enabled)
{
#ifndef GEN_ANALYSIS_STRESS
if ((condemnedGeneration == gcGenAnalysisGen) && (promoted_bytes > (uint64_t)gcGenAnalysisBytes))
if ((condemnedGeneration == gcGenAnalysisGen) && (promoted_bytes > (uint64_t)gcGenAnalysisBytes) && (gcIndex > (uint64_t)gcGenAnalysisIndex))
#endif
{
gcGenAnalysisEventPipeSession->Resume();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/gcenv.ee.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GCToEEInterface : public IGCToCLR {
uint32_t GetTotalNumSizedRefHandles();

bool AnalyzeSurvivorsRequested(int condemnedGeneration);
void AnalyzeSurvivorsFinished(int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)());
void AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)());

void VerifySyncTableEntry();

Expand Down
11 changes: 10 additions & 1 deletion src/coreclr/src/vm/genanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ uint64_t gcGenAnalysisEventPipeSessionId = (uint64_t)-1;
GcGenAnalysisState gcGenAnalysisConfigured = GcGenAnalysisState::Uninitialized;
int64_t gcGenAnalysisGen = -1;
int64_t gcGenAnalysisBytes = 0;
int64_t gcGenAnalysisIndex = 0;

/* static */ void GenAnalysis::Initialize()
{
Expand All @@ -22,7 +23,15 @@ int64_t gcGenAnalysisBytes = 0;
if (CLRConfig::IsConfigOptionSpecified(W("GCGenAnalysisBytes")))
{
gcGenAnalysisBytes = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_GCGenAnalysisBytes);
gcGenAnalysisConfigured = GcGenAnalysisState::Enabled;
if (CLRConfig::IsConfigOptionSpecified(W("GCGenAnalysisIndex")))
{
gcGenAnalysisIndex = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_GCGenAnalysisIndex);
gcGenAnalysisConfigured = GcGenAnalysisState::Enabled;
}
else
{
gcGenAnalysisConfigured = GcGenAnalysisState::Disabled;
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/vm/genanalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern uint64_t gcGenAnalysisEventPipeSessionId;
extern GcGenAnalysisState gcGenAnalysisConfigured;
extern int64_t gcGenAnalysisGen;
extern int64_t gcGenAnalysisBytes;
extern int64_t gcGenAnalysisIndex;

class GenAnalysis
{
Expand Down

0 comments on commit 5ff3fea

Please sign in to comment.