Skip to content

Commit 9bd1005

Browse files
author
Mike Kaufman
committed
Capture and tranmission of Recycler Telemetry stats.
1 parent cdba159 commit 9bd1005

29 files changed

+875
-93
lines changed

bin/GCStress/GCStress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void SimpleRecyclerTest()
273273
AUTO_NESTED_HANDLED_EXCEPTION_TYPE(ExceptionType_DisableCheck);
274274
#endif
275275

276-
recyclerInstance = HeapNewZ(Recycler, nullptr, &pageAllocator, Js::Throw::OutOfMemory, Js::Configuration::Global.flags);
276+
recyclerInstance = HeapNewZ(Recycler, nullptr, &pageAllocator, Js::Throw::OutOfMemory, Js::Configuration::Global.flags, nullptr);
277277

278278
recyclerInstance->Initialize(false /* forceInThread */, nullptr /* threadService */);
279279

bin/GCStress/GCStress.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
$(ChakraCommonMemoryLib);
3232
$(ChakraRuntimePlatformAgnostic);
3333
$(ChakraCommonLinkDependencies);
34+
Ole32.lib;
3435
Advapi32.lib;
35-
%(AdditionalDependencies)</AdditionalDependencies>
36+
%(AdditionalDependencies)
37+
</AdditionalDependencies>
3638
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories);$(SdkLibPath)</AdditionalLibraryDirectories>
3739
<SubSystem>Console</SubSystem>
3840
</Link>

lib/Common/Common/Chakra.Common.Common.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<ClInclude Include="MathUtil.h" />
7070
<ClInclude Include="NumberUtilities.h" />
7171
<ClInclude Include="NumberUtilitiesBase.h" />
72+
<ClInclude Include="ObservableValue.h" />
7273
<ClInclude Include="RejitReason.h" />
7374
<ClInclude Include="RejitReasons.h" />
7475
<ClInclude Include="SmartFpuControl.h" />

lib/Common/Common/Chakra.Common.Common.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
4-
<ClCompile Include="$(MSBuildThisFileDirectory)Api.cpp" />
54
<ClCompile Include="$(MSBuildThisFileDirectory)DateUtilities.cpp" />
65
<ClCompile Include="$(MSBuildThisFileDirectory)Event.cpp" />
76
<ClCompile Include="$(MSBuildThisFileDirectory)Int32Math.cpp" />
@@ -38,6 +37,7 @@
3837
<ClInclude Include="NumberUtilitiesBase.h" />
3938
<ClInclude Include="SmartFpuControl.h" />
4039
<ClInclude Include="Int64Math.h" />
40+
<ClInclude Include="ObservableValue.h" />
4141
</ItemGroup>
4242
<ItemGroup>
4343
<None Include="Jobs.inl" />

lib/Common/Common/ObservableValue.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
#pragma once
7+
8+
template<class T>
9+
class ObservableValueObserver
10+
{
11+
public:
12+
virtual void ValueChanged(const T& newVal, const T& oldVal) = 0;
13+
};
14+
15+
16+
template<class T>
17+
class ObservableValue final
18+
{
19+
private:
20+
T value;
21+
ObservableValueObserver<T>* observer;
22+
23+
void SetValue(const T newValue)
24+
{
25+
if (observer != nullptr && newValue != this->value)
26+
{
27+
observer->ValueChanged(newValue, this->value);
28+
}
29+
this->value = newValue;
30+
}
31+
32+
public:
33+
ObservableValue(T val, ObservableValueObserver<T>* observer) :
34+
observer(observer),
35+
value(val)
36+
{
37+
}
38+
39+
ObservableValue(ObservableValue<T>& other) = delete;
40+
41+
void operator= (const T value)
42+
{
43+
this->SetValue(value);
44+
}
45+
46+
operator T() const
47+
{
48+
return this->value;
49+
}
50+
};
51+

lib/Common/Common/Tick.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ namespace Js {
109109
// Construction
110110
public:
111111
TickDelta();
112-
private:
113112
TickDelta(int64 lnDelta);
114113

115114
// Properties
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
#pragma once
7+
8+
#include "Common/Tick.h"
9+
10+
struct AllocatorDecommitStats
11+
{
12+
Js::Tick lastLeaveDecommitRegion;
13+
Js::TickDelta maxDeltaBetweenDecommitRegionLeaveAndDecommit;
14+
int64 numDecommitCalls;
15+
int64 numPagesDecommitted;
16+
int64 numFreePageCount;
17+
};
18+
19+
struct AllocatorSizes
20+
{
21+
size_t usedBytes;
22+
size_t reservedBytes;
23+
size_t committedBytes;
24+
size_t numberOfSegments;
25+
};

lib/Common/Memory/BucketStatsReporter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// Copyright (C) Microsoft. All rights reserved.
33
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
44
//-------------------------------------------------------------------------------------------------------
5+
6+
#pragma once
7+
8+
#include "HeapBucketStats.h"
9+
510
namespace Memory
611
{
712

@@ -68,6 +73,8 @@ class BucketStatsReporter
6873
DUMP_FRAGMENTATION_STATS_ONLY(DumpHeader());
6974
}
7075

76+
HeapBucketStats* GetTotalStats() { return &total; }
77+
7178
bool IsEtwEnabled() const
7279
{
7380
return IS_GCETW_Enabled(GC_BUCKET_STATS);

lib/Common/Memory/Chakra.Common.Memory.vcxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerObjectGraphDumper.cpp" />
7777
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerPageAllocator.cpp" />
7878
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerSweep.cpp" />
79+
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerTelemetryInfo.cpp" />
7980
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerWriteBarrierManager.cpp" />
8081
<ClCompile Include="$(MSBuildThisFileDirectory)SmallFinalizableHeapBlock.cpp" />
8182
<ClCompile Include="$(MSBuildThisFileDirectory)SmallFinalizableHeapBucket.cpp" />
@@ -98,6 +99,7 @@
9899
<ItemGroup>
99100
<ClInclude Include="AllocationPolicyManager.h" />
100101
<ClInclude Include="Allocator.h" />
102+
<ClInclude Include="AllocatorTelemetryStats.h" />
101103
<ClInclude Include="amd64\XDataAllocator.h">
102104
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
103105
</ClInclude>
@@ -144,6 +146,7 @@
144146
<ClInclude Include="RecyclerRootPtr.h" />
145147
<ClInclude Include="RecyclerSweep.h" />
146148
<ClInclude Include="RecyclerSweepManager.h" />
149+
<ClInclude Include="RecyclerTelemetryInfo.h" />
147150
<ClInclude Include="RecyclerWeakReference.h" />
148151
<ClInclude Include="RecyclerWriteBarrierManager.h" />
149152
<ClInclude Include="SectionAllocWrapper.h" />
@@ -157,6 +160,8 @@
157160
<ClInclude Include="MemoryLogger.h" />
158161
<ClInclude Include="StressTest.h" />
159162
<ClInclude Include="VirtualAllocWrapper.h" />
163+
<ClInclude Include="RecyclerWaitReason.h" />
164+
<ClInclude Include="RecyclerWaitReasonInc.h" />
160165
<ClInclude Include="WriteBarrierMacros.h" />
161166
<ClInclude Include="XDataAllocator.h" />
162167
</ItemGroup>

lib/Common/Memory/Chakra.Common.Memory.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerSweepManager.cpp" />
6060
<ClCompile Include="$(MSBuildThisFileDirectory)DelayDeletingFunctionTable.cpp" />
6161
<ClCompile Include="$(MSBuildThisFileDirectory)HeapBucketStats.cpp" />
62+
<ClCompile Include="$(MSBuildThisFileDirectory)RecyclerTelemetryInfo.cpp" />
6263
</ItemGroup>
6364
<ItemGroup>
6465
<ClInclude Include="Allocator.h" />
@@ -124,6 +125,11 @@
124125
<ClInclude Include="BucketStatsReporter.h" />
125126
<ClInclude Include="RecyclerSweepManager.h" />
126127
<ClInclude Include="HeapBucketStats.h" />
128+
<ClInclude Include="RecyclerTelemetryInfo.h" />
129+
<ClInclude Include="AllocatorTelemetryStats.h" />
130+
<ClInclude Include="HeapBucketStats.h" />
131+
<ClInclude Include="RecyclerWaitReason.h" />
132+
<ClInclude Include="RecyclerWaitReasonInc.h" />
127133
</ItemGroup>
128134
<ItemGroup>
129135
<None Include="HeapBlock.inl" />

0 commit comments

Comments
 (0)