Skip to content

Commit e55b25f

Browse files
committed
Adding Lmbench
1 parent 7fd41a2 commit e55b25f

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace VirtualClient.Actions
55
{
66
using System;
77
using System.Collections.Generic;
8+
using System.Diagnostics;
89
using System.Globalization;
910
using System.IO.Abstractions;
1011
using System.Linq;
@@ -147,7 +148,13 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
147148
}
148149
else
149150
{
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+
}
151158
}
152159
}
153160

@@ -209,7 +216,7 @@ private Task BuildSourceCodeAsync(EventContext telemetryContext, CancellationTok
209216
});
210217
}
211218

212-
private void CaptureMetrics(IProcessProxy process, EventContext telemetryContext)
219+
private void CaptureMetrics(IProcessProxy process, MetricsParser metricsParser, EventContext telemetryContext)
213220
{
214221
this.MetadataContract.AddForScenario(
215222
"LMbench",
@@ -218,8 +225,7 @@ private void CaptureMetrics(IProcessProxy process, EventContext telemetryContext
218225

219226
this.MetadataContract.Apply(telemetryContext);
220227

221-
LMbenchMetricsParser parser = new LMbenchMetricsParser(process.StandardOutput.ToString());
222-
IList<Metric> metrics = parser.Parse();
228+
IList<Metric> metrics = metricsParser.Parse();
223229

224230
this.Logger.LogMetrics(
225231
toolName: "LMbench",
@@ -297,7 +303,8 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
297303

298304
// The use of the original telemetry context created at the top
299305
// is purposeful.
300-
this.CaptureMetrics(process, relatedContext);
306+
LMbenchMetricsParser lmbenchMetricsParser = new LMbenchMetricsParser(process.StandardOutput.ToString());
307+
this.CaptureMetrics(process, lmbenchMetricsParser, relatedContext);
301308
}
302309
});
303310
}

src/VirtualClient/VirtualClient.Main/profiles/PERF-MEM-LMBENCH.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"Scenario": "MemoryPerformance",
2121
"PackageName": "lmbench",
2222
"CompilerFlags": "$.Parameters.CompilerFlags",
23-
"MemorySizeMB": "$.Parameters.MemorySizeMB"
23+
"MemorySizeMB": "$.Parameters.MemorySizeMB",
24+
"BinaryName": "lat_mem_rd",
25+
"BinaryCommandLine": "2048 128"
2426
}
2527
}
2628
],

0 commit comments

Comments
 (0)