@@ -5,6 +5,7 @@ namespace VirtualClient.Actions
5
5
{
6
6
using System ;
7
7
using System . Collections . Generic ;
8
+ using System . Diagnostics ;
8
9
using System . Globalization ;
9
10
using System . IO . Abstractions ;
10
11
using System . Linq ;
@@ -147,7 +148,13 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
147
148
}
148
149
else
149
150
{
150
-
151
+ using ( IProcessProxy executeBinary = await this . ExecuteCommandAsync ( $ "{ this . BinaryName } ", this . BinaryCommandLine , this . LMbenchPackage . Path , telemetryContext , cancellationToken ) )
152
+ {
153
+ await this . LogProcessDetailsAsync ( executeBinary , telemetryContext ) ;
154
+ executeBinary . ThrowIfErrored < WorkloadException > ( ProcessProxy . DefaultSuccessCodes , errorReason : ErrorReason . WorkloadFailed ) ;
155
+ LatMemRdMetricsParser latMemRdMetricsParser = new LatMemRdMetricsParser ( executeBinary . StandardOutput . ToString ( ) ) ;
156
+ this . CaptureMetrics ( executeBinary , latMemRdMetricsParser , telemetryContext ) ;
157
+ }
151
158
}
152
159
}
153
160
@@ -209,7 +216,7 @@ private Task BuildSourceCodeAsync(EventContext telemetryContext, CancellationTok
209
216
} ) ;
210
217
}
211
218
212
- private void CaptureMetrics ( IProcessProxy process , EventContext telemetryContext )
219
+ private void CaptureMetrics ( IProcessProxy process , MetricsParser metricsParser , EventContext telemetryContext )
213
220
{
214
221
this . MetadataContract . AddForScenario (
215
222
"LMbench" ,
@@ -218,8 +225,7 @@ private void CaptureMetrics(IProcessProxy process, EventContext telemetryContext
218
225
219
226
this . MetadataContract . Apply ( telemetryContext ) ;
220
227
221
- LMbenchMetricsParser parser = new LMbenchMetricsParser ( process . StandardOutput . ToString ( ) ) ;
222
- IList < Metric > metrics = parser . Parse ( ) ;
228
+ IList < Metric > metrics = metricsParser . Parse ( ) ;
223
229
224
230
this . Logger . LogMetrics (
225
231
toolName : "LMbench" ,
@@ -297,7 +303,8 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
297
303
298
304
// The use of the original telemetry context created at the top
299
305
// is purposeful.
300
- this . CaptureMetrics ( process , relatedContext ) ;
306
+ LMbenchMetricsParser lmbenchMetricsParser = new LMbenchMetricsParser ( process . StandardOutput . ToString ( ) ) ;
307
+ this . CaptureMetrics ( process , lmbenchMetricsParser , relatedContext ) ;
301
308
}
302
309
} ) ;
303
310
}
0 commit comments