private static List <PerformanceMetricBase> CreateMetricsForAction(ActionInfo actionInfo) { List <PerformanceMetricBase> metrics = new List <PerformanceMetricBase>(); // Add the standard metrics metrics.Add(new TotalCallsMetric(actionInfo)); metrics.Add(new TotalElapsedTimeMetric(actionInfo)); metrics.Add(new DeltaCallsMetric(actionInfo)); metrics.Add(new DeltaElapsedTimeMetric(actionInfo)); metrics.Add(new AverageCallTimeMetric(actionInfo)); metrics.Add(new CallsPerSecondMetric(actionInfo)); metrics.Add(new CallsInProgressMetric(actionInfo)); metrics.Add(new LastCallElapsedTimeMetric(actionInfo)); metrics.Add(new TotalExceptionsThrownMetric(actionInfo)); metrics.Add(new DeltaExceptionsThrownMetric(actionInfo)); // Now add any custom metrics the user may have added foreach (var x in customMetrics) { PerformanceMetricBase customMetric = x(); metrics.Add(customMetric); } return(metrics); }
// This is called as the values of a trade metric are saved, which occurs e.g. in the strategy analyzer on optimizer runs protected override void OnCopyTo(PerformanceMetricBase target) { // You need to cast, in order to access the right type SampleCumProfit targetMetrics = (target as SampleCumProfit); if (targetMetrics != null) { Array.Copy(Values, targetMetrics.Values, Values.Length); } }
// This is called as the trade metric is merged, which occurs e.g. in the strategy analyzer for the total row and for aggregate protected override void OnMergePerformanceMetric(PerformanceMetricBase target) { // You need to cast, in order to access the right type SampleCumProfit targetMetrics = (target as SampleCumProfit); // This is just a simple weighted average sample if (targetMetrics != null && TradesPerformance.TradesCount + targetMetrics.TradesPerformance.TradesCount > 0) { for (int i = 0; i < Values.Length; i++) { targetMetrics.Values[i] = (targetMetrics.Values[i] * targetMetrics.TradesPerformance.TradesCount + Values[i] * TradesPerformance.TradesCount) / (TradesPerformance.TradesCount + targetMetrics.TradesPerformance.TradesCount); } } }
private static List <PerformanceMetricBase> CreateMetricsForAction(ActionInfo actionInfo) { List <PerformanceMetricBase> metrics = new List <PerformanceMetricBase>(); // Add the standard metrics metrics.Add(new TimerForEachRequestMetric(actionInfo.GetTrackInfo())); metrics.Add(new ActiveRequestsMetric(actionInfo.GetTrackInfo())); metrics.Add(new LastCallElapsedTimeMetric(actionInfo.GetTrackInfo())); // Now add any custom metrics the user may have added foreach (var x in customMetrics) { PerformanceMetricBase customMetric = x(); metrics.Add(customMetric); } return(metrics); }
private static List <PerformanceMetricBase> CreateMetricsForAction(ActionInfo actionInfo) { List <PerformanceMetricBase> metrics = new List <PerformanceMetricBase>(); // Add the standard metrics metrics.Add(new DeltaCallsMetric(actionInfo)); metrics.Add(new TimerForEachRequestMetric(actionInfo)); metrics.Add(new ActiveRequestsMetric(actionInfo)); metrics.Add(new LastCallElapsedTimeMetric(actionInfo)); metrics.Add(new DeltaExceptionsThrownMetric(actionInfo)); metrics.Add(new PostAndPutRequestSizeMetric(actionInfo)); // Now add any custom metrics the user may have added foreach (var x in customMetrics) { PerformanceMetricBase customMetric = x(); metrics.Add(customMetric); } return(metrics); }