Skip to content

Commit

Permalink
[MERGE chakra-core#5414 @mike-kaufman] Updating telemetry reporting t…
Browse files Browse the repository at this point in the history
…o include a variety of boolean flags from the recyclerFlagsTable

Merge pull request chakra-core#5414 from mike-kaufman:build/mkaufman/gc-telemetry-tweaks-2018-07-02
  • Loading branch information
Mike Kaufman committed Jul 6, 2018
2 parents caf407c + a189ca8 commit e782dc3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
10 changes: 8 additions & 2 deletions lib/Common/Memory/Recycler.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,17 @@ class Recycler
virtual void ValueChanged(const CollectionState& newVal, const CollectionState& oldVal)
{
#ifdef ENABLE_BASIC_TELEMETRY
if (oldVal == CollectionState::CollectionStateNotCollecting && newVal != CollectionState::CollectionStateNotCollecting && newVal != CollectionState::Collection_PreCollection)
if (oldVal == CollectionState::CollectionStateNotCollecting &&
newVal != CollectionState::CollectionStateNotCollecting &&
newVal != CollectionState::Collection_PreCollection &&
newVal != CollectionState::CollectionStateExit)
{
this->recycler->GetRecyclerTelemetryInfo().StartPass(newVal);
}
else if (oldVal != CollectionState::CollectionStateNotCollecting && oldVal != CollectionState::Collection_PreCollection && newVal == CollectionState::CollectionStateNotCollecting)
else if (oldVal != CollectionState::CollectionStateNotCollecting &&
oldVal != CollectionState::Collection_PreCollection &&
oldVal != CollectionState::CollectionStateExit &&
newVal == CollectionState::CollectionStateNotCollecting)
{
this->recycler->GetRecyclerTelemetryInfo().EndPass(oldVal);
}
Expand Down
25 changes: 22 additions & 3 deletions lib/Common/Memory/RecyclerTelemetryInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,29 @@ namespace Memory
return this->recycler->GetRecyclerID();
}

bool RecyclerTelemetryInfo::GetIsConcurrentEnabled() const
RecyclerFlagsTableSummary RecyclerTelemetryInfo::GetRecyclerConfigFlags() const
{
return this->recycler->IsConcurrentEnabled();

// select set of config flags that we can pack into an uint32
RecyclerFlagsTableSummary flags = RecyclerFlagsTableSummary::None;

if (this->recycler->IsMemProtectMode()) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::IsMemProtectMode); }
if (this->recycler->IsConcurrentEnabled()) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::IsConcurrentEnabled); }
if (this->recycler->enableScanInteriorPointers) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::EnableScanInteriorPointers); }
if (this->recycler->enableScanImplicitRoots) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::EnableScanImplicitRoots); }
if (this->recycler->disableCollectOnAllocationHeuristics) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::DisableCollectOnAllocationHeuristics); }
#ifdef RECYCLER_STRESS
if (this->recycler->recyclerStress) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::RecyclerStress); }
#if ENABLE_CONCURRENT_GC
if (this->recycler->recyclerBackgroundStress) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::RecyclerBackgroundStress); }
if (this->recycler->recyclerConcurrentStress) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::RecyclerConcurrentStress); }
if (this->recycler->recyclerConcurrentRepeatStress) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::RecyclerConcurrentRepeatStress); }
#endif
#if ENABLE_PARTIAL_GC
if (this->recycler->recyclerPartialStress) { flags = static_cast<RecyclerFlagsTableSummary>(flags | RecyclerFlagsTableSummary::RecyclerPartialStress); }
#endif
#endif
return flags;
}

bool RecyclerTelemetryInfo::ShouldStartTelemetryCapture() const
Expand All @@ -65,7 +85,6 @@ namespace Memory
this->hostInterface->IsTelemetryProviderEnabled();
}


void RecyclerTelemetryInfo::FillInSizeData(IdleDecommitPageAllocator* allocator, AllocatorSizes* sizes) const
{
sizes->committedBytes = allocator->GetCommittedBytes();
Expand Down
21 changes: 20 additions & 1 deletion lib/Common/Memory/RecyclerTelemetryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ namespace Memory
#endif
};

/**
* Consolidated summary of data from RecyclerFlagsTable that we want to
* transmit via telemetry. Goal is to pack this into maximum of 64-bits.
*/
enum RecyclerFlagsTableSummary : uint32
{
None = 0x0000,
IsMemProtectMode = 0x0001,
IsConcurrentEnabled = 0x0002,
EnableScanInteriorPointers = 0x0004,
EnableScanImplicitRoots = 0x0008,
DisableCollectOnAllocationHeuristics = 0x0016,
RecyclerStress = 0x0032,
RecyclerBackgroundStress = 0x0064,
RecyclerConcurrentStress = 0x0128,
RecyclerConcurrentRepeatStress = 0x0256,
RecyclerPartialStress = 0x0512,
};

typedef SList<RecyclerTelemetryGCPassStats, HeapAllocator> GCPassStatsList;

/**
Expand All @@ -109,9 +128,9 @@ namespace Memory
inline const Js::Tick& GetLastTransmitTime() const { return this->lastTransmitTime; }
inline const uint16 GetPassCount() const { return this->passCount; }
const GUID& GetRecyclerID() const;
bool GetIsConcurrentEnabled() const;
bool IsOnScriptThread() const;
GCPassStatsList::Iterator GetGCPassStatsIterator() const;
RecyclerFlagsTableSummary GetRecyclerConfigFlags() const;

AllocatorDecommitStats* GetThreadPageAllocator_decommitStats() { return &this->threadPageAllocator_decommitStats; }
AllocatorDecommitStats* GetRecyclerLeafPageAllocator_decommitStats() { return &this->recyclerLeafPageAllocator_decommitStats; }
Expand Down

0 comments on commit e782dc3

Please sign in to comment.