3
3
//
4
4
// This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
5
5
// It is available from http://www.codeplex.com/hyperAddin
6
- // using Microsoft.Diagnostics.Tracing.Parsers;
6
+
7
7
using Microsoft . Diagnostics . Tracing . Analysis . GC ;
8
8
using Microsoft . Diagnostics . Tracing . Analysis . JIT ;
9
9
using Microsoft . Diagnostics . Tracing . Etlx ;
@@ -874,16 +874,10 @@ internal static void SetupCallbacks(TraceEventDispatcher source)
874
874
GCStats . ProcessCommittedUsage ( stats , committedUsage ) ;
875
875
} ;
876
876
877
- source . Clr . GCDynamicEvent . GCHeapCountTuning += delegate ( HeapCountTuningTraceEvent heapCountTuning )
878
- {
879
- var stats = currentManagedProcess ( heapCountTuning . UnderlyingEvent ) ;
880
- GCStats . ProcessHeapCountTuning ( stats , heapCountTuning ) ;
881
- } ;
882
-
883
- source . Clr . GCDynamicEvent . GCHeapCountSample += delegate ( HeapCountSampleTraceEvent heapCountSample )
877
+ source . Clr . GCDynamicEvent . GCDynamicTraceEvent += delegate ( GCDynamicTraceEvent gcDynamic )
884
878
{
885
- var stats = currentManagedProcess ( heapCountSample . UnderlyingEvent ) ;
886
- GCStats . ProcessHeapCountSample ( stats , heapCountSample ) ;
879
+ var stats = currentManagedProcess ( gcDynamic . UnderlyingEvent ) ;
880
+ GCStats . ProcessGCDynamicEvent ( stats , gcDynamic ) ;
887
881
} ;
888
882
889
883
source . Clr . GCGlobalHeapHistory += delegate ( GCGlobalHeapHistoryTraceData data )
@@ -2143,8 +2137,6 @@ public double PromotedMB
2143
2137
}
2144
2138
}
2145
2139
2146
- public HeapCountTuning HeapCountTuning { get ; internal set ; }
2147
- public HeapCountSample HeapCountSample { get ; internal set ; }
2148
2140
public CommittedUsage CommittedUsageBefore { get ; internal set ; }
2149
2141
public CommittedUsage CommittedUsageAfter { get ; internal set ; }
2150
2142
@@ -2416,7 +2408,7 @@ public GCCondemnedReasons[] PerHeapCondemnedReasons
2416
2408
}
2417
2409
2418
2410
public enum TimingType
2419
- {
2411
+ {
2420
2412
/// <summary>
2421
2413
/// This field records the time spent for marking roots (except objects pointed by sizedref handle and their descendents)
2422
2414
///
@@ -2522,7 +2514,8 @@ public int FindFirstHighestCondemnedHeap()
2522
2514
if ( gen == GenNumberHighest )
2523
2515
{
2524
2516
return HeapIndex ;
2525
- } }
2517
+ }
2518
+ }
2526
2519
2527
2520
return 0 ;
2528
2521
}
@@ -3328,6 +3321,18 @@ public PinnedPlug(ulong s, ulong e)
3328
3321
3329
3322
private float [ ] GCCpuServerGCThreads = null ;
3330
3323
3324
+ private List < GCDynamicEvent > dynamicEvents = new List < GCDynamicEvent > ( ) ;
3325
+
3326
+ public List < GCDynamicEvent > DynamicEvents
3327
+ {
3328
+ get { return this . dynamicEvents ; }
3329
+ }
3330
+
3331
+ internal void AddDynamicEvent ( GCDynamicEvent dynamicEvent )
3332
+ {
3333
+ dynamicEvents . Add ( dynamicEvent ) ;
3334
+ }
3335
+
3331
3336
#endregion
3332
3337
}
3333
3338
@@ -4933,12 +4938,12 @@ internal static void ProcessCommittedUsage(TraceLoadedDotNetRuntime proc, Commit
4933
4938
{
4934
4939
CommittedUsage traceData = new CommittedUsage
4935
4940
{
4936
- Version = committedUsage . Version ,
4937
- TotalCommittedInUse = committedUsage . TotalCommittedInUse ,
4941
+ Version = committedUsage . Version ,
4942
+ TotalCommittedInUse = committedUsage . TotalCommittedInUse ,
4938
4943
TotalCommittedInGlobalDecommit = committedUsage . TotalCommittedInGlobalDecommit ,
4939
- TotalCommittedInFree = committedUsage . TotalCommittedInFree ,
4940
- TotalCommittedInGlobalFree = committedUsage . TotalCommittedInGlobalFree ,
4941
- TotalBookkeepingCommitted = committedUsage . TotalBookkeepingCommitted
4944
+ TotalCommittedInFree = committedUsage . TotalCommittedInFree ,
4945
+ TotalCommittedInGlobalFree = committedUsage . TotalCommittedInGlobalFree ,
4946
+ TotalBookkeepingCommitted = committedUsage . TotalBookkeepingCommitted
4942
4947
} ;
4943
4948
4944
4949
if ( _event . CommittedUsageBefore == null )
@@ -4953,41 +4958,17 @@ internal static void ProcessCommittedUsage(TraceLoadedDotNetRuntime proc, Commit
4953
4958
}
4954
4959
}
4955
4960
4956
- internal static void ProcessHeapCountTuning ( TraceLoadedDotNetRuntime proc , HeapCountTuningTraceEvent heapCountTuning )
4957
- {
4958
- TraceGC _event = GetGC ( proc , heapCountTuning . GCIndex ) ;
4959
- if ( _event != null )
4960
- {
4961
- // Copy over the contents of the dynamic data to prevent issues when the event is reused.
4962
- _event . HeapCountTuning = new HeapCountTuning
4963
- {
4964
- Version = heapCountTuning . Version ,
4965
- NewHeapCount = heapCountTuning . NewHeapCount ,
4966
- GCIndex = heapCountTuning . GCIndex ,
4967
- MedianThroughputCostPercent = heapCountTuning . MedianThroughputCostPercent ,
4968
- SmoothedMedianThroughputCostPercent = heapCountTuning . SmoothedMedianThroughputCostPercent ,
4969
- ThroughputCostPercentReductionPerStepUp = heapCountTuning . ThroughputCostPercentReductionPerStepUp ,
4970
- ThroughputCostPercentIncreasePerStepDown = heapCountTuning . ThroughputCostPercentIncreasePerStepDown ,
4971
- SpaceCostPercentIncreasePerStepUp = heapCountTuning . SpaceCostPercentIncreasePerStepUp ,
4972
- SpaceCostPercentDecreasePerStepDown = heapCountTuning . SpaceCostPercentDecreasePerStepDown
4973
- } ;
4974
- }
4975
- }
4976
-
4977
- internal static void ProcessHeapCountSample ( TraceLoadedDotNetRuntime proc , HeapCountSampleTraceEvent heapCountSample )
4961
+ internal static void ProcessGCDynamicEvent ( TraceLoadedDotNetRuntime proc , GCDynamicTraceEvent gcDynamic )
4978
4962
{
4979
4963
TraceGC _event = GetLastGC ( proc ) ;
4980
4964
if ( _event != null )
4981
4965
{
4982
- _event . HeapCountSample = new HeapCountSample
4983
- {
4984
- Version = heapCountSample . Version ,
4985
- GCIndex = heapCountSample . GCIndex ,
4986
- // Convert the microsecond properties to MSec to be consistent with the other time based metrics.
4987
- ElapsedTimeBetweenGCsMSec = heapCountSample . ElapsedTimeBetweenGCs / 1000.0 ,
4988
- GCPauseTimeMSec = heapCountSample . GCPauseTime / 1000.0 ,
4989
- MslWaitTimeMSec = heapCountSample . MslWaitTime / 1000.0
4990
- } ;
4966
+ _event . AddDynamicEvent ( new GCDynamicEvent
4967
+ (
4968
+ gcDynamic . UnderlyingEvent . Name ,
4969
+ gcDynamic . UnderlyingEvent . TimeStamp ,
4970
+ gcDynamic . DataField
4971
+ ) ) ;
4991
4972
}
4992
4973
}
4993
4974
0 commit comments