public void RegisterMetrics(MetricFactory metrics)
        {
            if (!_jitVerbose.Enabled && !_runtimeCounters.Enabled)
            {
                return;
            }

            if (_runtimeCounters.Enabled)
            {
                BytesJitted = metrics.CreateGauge("dotnet_jit_il_bytes", "Total bytes of IL compiled by the JIT compiler");
                _runtimeCounters.Events.IlBytesJitted += e => BytesJitted.Set(e.Mean);
            }

            if (_jitVerbose.Enabled)
            {
                MethodsJittedTotal        = metrics.CreateCounter("dotnet_jit_method_total", "Total number of methods compiled by the JIT compiler, broken down by compilation for dynamic code", DynamicLabel);
                MethodsJittedSecondsTotal = metrics.CreateCounter("dotnet_jit_method_seconds_total", "Total number of seconds spent in the JIT compiler, broken down by compilation for dynamic code", DynamicLabel);
                _jitVerbose.Events.CompilationComplete += e =>
                {
                    MethodsJittedTotal.Labels(e.IsMethodDynamic.ToLabel()).Inc();
                    MethodsJittedSecondsTotal.Labels(e.IsMethodDynamic.ToLabel()).Inc(e.CompilationDuration.TotalSeconds);
                };

                CpuRatio = metrics.CreateGauge("dotnet_jit_cpu_ratio", "The amount of total CPU time consumed spent JIT'ing");
            }
            else
            {
                MethodsJittedTotal = metrics.CreateCounter("dotnet_jit_method_total", "Total number of methods compiled by the JIT compiler");
                _runtimeCounters.Events.MethodsJittedCount += e => MethodsJittedTotal.Inc(e.Mean - MethodsJittedTotal.Value);
            }
        }
示例#2
0
        public void ProcessEvent(EventWrittenEventArgs e)
        {
            if (_eventPairTimer.TryGetEventPairDuration(e, out var duration))
            {
                // dynamic methods are of special interest to us- only a certain number of JIT'd dynamic methods
                // will be cached. Frequent use of dynamic can cause methods to be evicted from the cache and re-JIT'd
                var methodFlags       = (uint)e.Payload[5];
                var dynamicLabelValue = (methodFlags & 0x1) == 0x1 ? LabelValueTrue : LabelValueFalse;

                MethodsJittedTotal.TrackValue(1, dynamicLabelValue);
                MethodsJittedSecondsTotal.TrackValue(duration.TotalSeconds, dynamicLabelValue);
            }
        }
示例#3
0
        public void ProcessEvent(EventWrittenEventArgs e)
        {
            if (_eventPairTimer.TryGetDuration(e, out var duration) == DurationResult.FinalWithDuration)
            {
                // dynamic methods are of special interest to us- only a certain number of JIT'd dynamic methods
                // will be cached. Frequent use of dynamic can cause methods to be evicted from the cache and re-JIT'd
                var methodFlags       = (uint)e.Payload[5];
                var dynamicLabelValue = (methodFlags & 0x1) == 0x1 ? LabelValueTrue : LabelValueFalse;

                MethodsJittedTotal.Labels(dynamicLabelValue).Inc(_samplingRate.SampleEvery);
                MethodsJittedSecondsTotal.Labels(dynamicLabelValue).Inc(duration.TotalSeconds * _samplingRate.SampleEvery);
            }
        }
示例#4
0
        public void RegisterMetrics(MetricFactory metrics)
        {
            if (!_jitVerbose.Enabled)
            {
                return;
            }

            MethodsJittedTotal        = metrics.CreateCounter("dotnet_jit_method_total", "Total number of methods compiled by the JIT compiler", DynamicLabel);
            MethodsJittedSecondsTotal = metrics.CreateCounter("dotnet_jit_method_seconds_total", "Total number of seconds spent in the JIT compiler", DynamicLabel);
            _jitVerbose.Events.CompilationComplete += e =>
            {
                MethodsJittedTotal.Labels(e.IsMethodDynamic.ToLabel()).Inc();
                MethodsJittedSecondsTotal.Labels(e.IsMethodDynamic.ToLabel()).Inc(e.CompilationDuration.TotalSeconds);
            };

            CpuRatio = metrics.CreateGauge("dotnet_jit_cpu_ratio", "The amount of total CPU time consumed spent JIT'ing");
        }