Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void NetworkingWorkloadStateInstancesAreJsonSerializable(bool? noSyncEnab
"Profiling_Scenario_1",
"00:00:30",
"00:00:05",
1,
noSyncEnabled,
Guid.NewGuid());

Expand Down Expand Up @@ -126,6 +127,7 @@ public void NetworkingWorkloadStateInstancesAreJsonSerializable_2()
"Profiling_Scenario_1",
"00:00:30",
"00:00:05",
1,
false,
Guid.NewGuid(),
//
Expand Down Expand Up @@ -174,6 +176,7 @@ public void NetworkingWorkloadStateInstancesAreJsonSerializable_3()
"Profiling_Scenario_1",
"00:00:30",
"00:00:05",
1,
false,
Guid.NewGuid(),
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,158 @@ public CPSClientExecutor(VirtualClientComponent component)
public CPSClientExecutor(IServiceCollection dependencies, IDictionary<string, IConvertible> parameters)
: base(dependencies, parameters)
{
this.InitializeWindowsClientCommandline();
this.InitializeLinuxClientCommandline();
}

/// <summary>
/// Returns the CPS client-side command line arguments.
/// </summary>
protected override string GetCommandLineArguments()

private void InitializeWindowsClientCommandline()
{
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
string clientIPAddress = this.GetLayoutClientInstances(ClientRole.Client).First().IPAddress;

// Ensure base string isn't null.
this.CommandLineWindowsClient ??= string.Empty;

// Normalize: keep a trailing space so appends don't glue together.
if (this.CommandLineWindowsClient.Length > 0 && !char.IsWhiteSpace(this.CommandLineWindowsClient[^1]))
{
this.CommandLineWindowsClient += " ";
}

// -c (client mode)
if (!this.CommandLineWindowsClient.Contains("-c", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsClient += " -c";
}

// -r {Connections}
// Your reference includes "-c -r {Connections}"
if (!this.CommandLineWindowsClient.Contains("-r", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsClient += $"-r {this.Connections} ";
}

// Endpoint tuple:
// {clientIPAddress},0,{serverIPAddress},{Port},{ConnectionsPerThread},{MaxPendingRequestsPerThread},{ConnectionDuration},{DataTransferMode}
// Add it only if we don't already see the server IP (good heuristic to avoid duplication).
if (!this.CommandLineWindowsClient.Contains(serverIPAddress, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsClient +=
$"{clientIPAddress},0,{serverIPAddress},{this.Port},{this.ConnectionsPerThread},{this.MaxPendingRequestsPerThread},{this.ConnectionDuration},{this.DataTransferMode} ";
}

// -i {DisplayInterval}
if (!this.CommandLineWindowsClient.Contains("-i", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsClient += $"-i {this.DisplayInterval} ";
}

// -wt {WarmupTime.TotalSeconds}
if (!this.CommandLineWindowsClient.Contains("-wt", StringComparison.OrdinalIgnoreCase) && this.WarmupTime != null)
{
this.CommandLineWindowsClient += $"-wt {this.WarmupTime.TotalSeconds} ";
}

// -t {TestDuration.TotalSeconds}
if (!this.CommandLineWindowsClient.Contains("-t", StringComparison.OrdinalIgnoreCase) && this.TestDuration != null)
{
this.CommandLineWindowsClient += $"-t {this.TestDuration.TotalSeconds} ";
}

// Optional: -ds {DelayTime.TotalSeconds} only if DelayTime != 0
if (!this.CommandLineWindowsClient.Contains("-ds", StringComparison.OrdinalIgnoreCase) &&
this.DelayTime != TimeSpan.Zero)
{
this.CommandLineWindowsClient += $"-ds {this.DelayTime.TotalSeconds} ";
}

// Additional params (append once)
if (!string.IsNullOrWhiteSpace(this.AdditionalParams))
{
// Optional: prevent double-appending if already present.
// You can remove this block if AdditionalParams is expected to be dynamic.
if (!this.CommandLineWindowsClient.Contains(this.AdditionalParams, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsClient += $"{this.AdditionalParams} ";
}
}

this.CommandLineWindowsClient = this.CommandLineWindowsClient.Trim();
}

private void InitializeLinuxClientCommandline()
{
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
string clientIPAddress = this.GetLayoutClientInstances(ClientRole.Client).First().IPAddress;

// Ensure base string isn't null.
this.CommandLineLinuxClient ??= string.Empty;

// Normalize: keep a trailing space so appends don't glue together.
if (this.CommandLineLinuxClient.Length > 0 && !char.IsWhiteSpace(this.CommandLineLinuxClient[^1]))
{
this.CommandLineLinuxClient += " ";
}

// -c (client mode)
if (!this.CommandLineLinuxClient.Contains("-c", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxClient += " -c";
}

// -r {Connections}
// Your reference includes "-c -r {Connections}"
if (!this.CommandLineLinuxClient.Contains("-r", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxClient += $"-r {this.Connections} ";
}

// Endpoint tuple:
// {clientIPAddress},0,{serverIPAddress},{Port},{ConnectionsPerThread},{MaxPendingRequestsPerThread},{ConnectionDuration},{DataTransferMode}
// Add it only if we don't already see the server IP (good heuristic to avoid duplication).
if (!this.CommandLineLinuxClient.Contains(serverIPAddress, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxClient +=
$"{clientIPAddress},0,{serverIPAddress},{this.Port},{this.ConnectionsPerThread},{this.MaxPendingRequestsPerThread},{this.ConnectionDuration},{this.DataTransferMode} ";
}

// -i {DisplayInterval}
if (!this.CommandLineLinuxClient.Contains("-i", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxClient += $"-i {this.DisplayInterval} ";
}

// -wt {WarmupTime.TotalSeconds}
if (!this.CommandLineLinuxClient.Contains("-wt", StringComparison.OrdinalIgnoreCase) && this.WarmupTime != null)
{
this.CommandLineLinuxClient += $"-wt {this.WarmupTime.TotalSeconds} ";
}

// -t {TestDuration.TotalSeconds}
if (!this.CommandLineLinuxClient.Contains("-t", StringComparison.OrdinalIgnoreCase) && this.TestDuration != null)
{
this.CommandLineLinuxClient += $"-t {this.TestDuration.TotalSeconds} ";
}

// Optional: -ds {DelayTime.TotalSeconds} only if DelayTime != 0
if (!this.CommandLineLinuxClient.Contains("-ds", StringComparison.OrdinalIgnoreCase) &&
this.DelayTime != TimeSpan.Zero)
{
this.CommandLineLinuxClient += $"-ds {this.DelayTime.TotalSeconds} ";
}

// Additional params (append once)
if (!string.IsNullOrWhiteSpace(this.AdditionalParams))
{
// Optional: prevent double-appending if already present.
// You can remove this block if AdditionalParams is expected to be dynamic.
if (!this.CommandLineLinuxClient.Contains(this.AdditionalParams, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxClient += $"{this.AdditionalParams} ";
}
}

return $"-c -r {this.Connections} " +
$"{clientIPAddress},0,{serverIPAddress},{this.Port},{this.ConnectionsPerThread},{this.MaxPendingRequestsPerThread},{this.ConnectionDuration},{this.DataTransferMode} " +
$"-i {this.DisplayInterval} -wt {this.WarmupTime.TotalSeconds} -t {this.TestDuration.TotalSeconds} " +
$"{((this.DelayTime != TimeSpan.Zero) ? $"-ds {this.DelayTime.TotalSeconds}" : string.Empty)} " +
$"{this.AdditionalParams}".Trim();
this.CommandLineLinuxClient = this.CommandLineLinuxClient.Trim();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ private static void AddStatisticalMetrics(IList<Metric> metrics, List<double> ti
double lowerCI = mean - t;
double upperCI = mean + t;

metrics.Add(new Metric("ConnectsPerSec_Min", connectsPerSec.Min()));
metrics.Add(new Metric("ConnectsPerSec_Max", connectsPerSec.Max()));
metrics.Add(new Metric("ConnectsPerSec_Med", connectsPerSec.Median()));
metrics.Add(new Metric("ConnectsPerSec_Min", connectsPerSec.Min(), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_Max", connectsPerSec.Max(), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_Med", connectsPerSec.Median(), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_Avg", connectsPerSec.Average(), MetricUnit.TransactionsPerSec, MetricRelativity.HigherIsBetter, verbosity: 0));
metrics.Add(new Metric("ConnectsPerSec_P25", connectsPerSec.Percentile(25)));
metrics.Add(new Metric("ConnectsPerSec_P50", connectsPerSec.Percentile(50)));
metrics.Add(new Metric("ConnectsPerSec_P75", connectsPerSec.Percentile(75)));
metrics.Add(new Metric("ConnectsPerSec_P90", connectsPerSec.Percentile(90)));
metrics.Add(new Metric("ConnectsPerSec_P99", connectsPerSec.Percentile(99)));
metrics.Add(new Metric("ConnectsPerSec_P99_9", Statistics.QuantileCustom(connectsPerSec, 1d - 0.001d, QuantileDefinition.R3)));
metrics.Add(new Metric("ConnectsPerSec_P99_99", Statistics.QuantileCustom(connectsPerSec, 1d - 0.0001d, QuantileDefinition.R3)));
metrics.Add(new Metric("ConnectsPerSec_P99_999", Statistics.QuantileCustom(connectsPerSec, 1d - 0.00001d, QuantileDefinition.R3)));
metrics.Add(new Metric("ConnectsPerSec_P25", connectsPerSec.Percentile(25), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P50", connectsPerSec.Percentile(50), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P75", connectsPerSec.Percentile(75), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P90", connectsPerSec.Percentile(90), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P99", connectsPerSec.Percentile(99), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P99_9", Statistics.QuantileCustom(connectsPerSec, 1d - 0.001d, QuantileDefinition.R3), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P99_99", Statistics.QuantileCustom(connectsPerSec, 1d - 0.0001d, QuantileDefinition.R3), relativity: MetricRelativity.HigherIsBetter));
metrics.Add(new Metric("ConnectsPerSec_P99_999", Statistics.QuantileCustom(connectsPerSec, 1d - 0.00001d, QuantileDefinition.R3), relativity: MetricRelativity.HigherIsBetter));
double median = Statistics.Median(connectsPerSec);
double[] absoluteDeviations = connectsPerSec.Select(x => Math.Abs(x - median)).ToArray();
metrics.Add(new Metric("ConnectsPerSec_Mad", Statistics.Median(absoluteDeviations), MetricUnit.TransactionsPerSec, MetricRelativity.LowerIsBetter, verbosity: 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,132 @@ public CPSServerExecutor(IServiceCollection dependencies, IDictionary<string, IC
{
}

/// <summary>
/// Returns the CPS client-side command line arguments.
/// </summary>
protected override string GetCommandLineArguments()
private void InitializeLinuxServerCommandline()
{
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
string clientIPAddress = this.GetLayoutClientInstances(ClientRole.Client).First().IPAddress;

// Ensure base string isn't null.
this.CommandLineLinuxServer ??= string.Empty;

// Normalize: keep a trailing space so appends don't glue together.
if (this.CommandLineLinuxServer.Length > 0 && !char.IsWhiteSpace(this.CommandLineLinuxServer[^1]))
{
this.CommandLineLinuxServer += " ";
}

// -c (client mode)
if (!this.CommandLineLinuxServer.Contains("-s", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxServer += " -s";
}

// -r {Connections}
// Your reference includes "-c -r {Connections}"
if (!this.CommandLineLinuxServer.Contains("-r", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxServer += $" -r {this.Connections} ";
}

// Endpoint tuple:
// {clientIPAddress},0,{serverIPAddress},{Port},{ConnectionsPerThread},{MaxPendingRequestsPerThread},{ConnectionDuration},{DataTransferMode}
// Add it only if we don't already see the server IP (good heuristic to avoid duplication).
if (!this.CommandLineLinuxServer.Contains(serverIPAddress, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxServer +=
$"{serverIPAddress},{this.Port} ";
}

// -i {DisplayInterval}
if (!this.CommandLineLinuxServer.Contains("-i", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineLinuxServer += $" -i {this.DisplayInterval} ";
}

// -wt {WarmupTime.TotalSeconds}
if (!this.CommandLineLinuxServer.Contains("-wt", StringComparison.OrdinalIgnoreCase) && this.WarmupTime != null)
{
this.CommandLineLinuxServer += $" -wt {this.WarmupTime.TotalSeconds} ";
}

// -t {TestDuration.TotalSeconds}
if (!this.CommandLineLinuxServer.Contains("-t", StringComparison.OrdinalIgnoreCase) && this.TestDuration != null)
{
this.CommandLineLinuxServer += $" -t {this.TestDuration.TotalSeconds} ";
}

// Optional: -ds {DelayTime.TotalSeconds} only if DelayTime != 0
if (!this.CommandLineLinuxServer.Contains("-ds", StringComparison.OrdinalIgnoreCase) &&
this.DelayTime != TimeSpan.Zero)
{
this.CommandLineLinuxServer += $" -ds {this.DelayTime.TotalSeconds} ";
}

this.CommandLineLinuxServer = this.CommandLineLinuxServer.Trim();
}

private void InitializeWindowsServerCommandline()
{
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
return $"-s -r {this.Connections} {serverIPAddress},{this.Port} -i {this.DisplayInterval} -wt {this.WarmupTime.TotalSeconds} -t {this.TestDuration.TotalSeconds} " +
$"{((this.DelayTime != TimeSpan.Zero) ? $"-ds {this.DelayTime.TotalSeconds}" : string.Empty)} ";
string clientIPAddress = this.GetLayoutClientInstances(ClientRole.Client).First().IPAddress;

// Ensure base string isn't null.
this.CommandLineWindowsServer ??= string.Empty;

// Normalize: keep a trailing space so appends don't glue together.
if (this.CommandLineWindowsServer.Length > 0 && !char.IsWhiteSpace(this.CommandLineWindowsServer[^1]))
{
this.CommandLineWindowsServer += " ";
}

// -c (client mode)
if (!this.CommandLineWindowsServer.Contains("-s", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsServer += " -s";
}

// -r {Connections}
// Your reference includes "-c -r {Connections}"
if (!this.CommandLineWindowsServer.Contains("-r", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsServer += $" -r {this.Connections} ";
}

// Endpoint tuple:
// {clientIPAddress},0,{serverIPAddress},{Port},{ConnectionsPerThread},{MaxPendingRequestsPerThread},{ConnectionDuration},{DataTransferMode}
// Add it only if we don't already see the server IP (good heuristic to avoid duplication).
if (!this.CommandLineWindowsServer.Contains(serverIPAddress, StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsServer +=
$"{serverIPAddress},{this.Port} ";
}

// -i {DisplayInterval}
if (!this.CommandLineWindowsServer.Contains("-i", StringComparison.OrdinalIgnoreCase))
{
this.CommandLineWindowsServer += $" -i {this.DisplayInterval} ";
}

// -wt {WarmupTime.TotalSeconds}
if (!this.CommandLineWindowsServer.Contains("-wt", StringComparison.OrdinalIgnoreCase) && this.WarmupTime != null)
{
this.CommandLineWindowsServer += $" -wt {this.WarmupTime.TotalSeconds} ";
}

// -t {TestDuration.TotalSeconds}
if (!this.CommandLineWindowsServer.Contains("-t", StringComparison.OrdinalIgnoreCase) && this.TestDuration != null)
{
this.CommandLineWindowsServer += $" -t {this.TestDuration.TotalSeconds} ";
}

// Optional: -ds {DelayTime.TotalSeconds} only if DelayTime != 0
if (!this.CommandLineWindowsServer.Contains("-ds", StringComparison.OrdinalIgnoreCase) &&
this.DelayTime != TimeSpan.Zero)
{
this.CommandLineWindowsServer += $" -ds {this.DelayTime.TotalSeconds} ";
}

this.CommandLineWindowsServer = this.CommandLineWindowsServer.Trim();
}
}
}
Loading