change tcp udp config
This commit is contained in:
Родитель
6a26a7a1ce
Коммит
c0dae2211c
|
@ -39,37 +39,53 @@ function banner {
|
|||
function test_recv {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[parameter(Mandatory=$true)] [int] $Port,
|
||||
[parameter(Mandatory=$true)] [String] $RecvDir
|
||||
[parameter(Mandatory=$true)] [int] $Port
|
||||
)
|
||||
[string] $cmd = "./lagscope -r -p$Port $($global:Config.Options)"
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:logRecv
|
||||
[string] $cmd = "./lagscope -r -p$Port $($g_Config.Options)"
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_logRecv
|
||||
Write-Host $cmd
|
||||
} # test_recv()
|
||||
|
||||
function test_send {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[parameter(Mandatory=$false)] [string] $Oper,
|
||||
[parameter(Mandatory=$true)] [string] $Oper,
|
||||
[parameter(Mandatory=$true)] [int] $Port,
|
||||
[parameter(Mandatory=$false)] [String] $Options,
|
||||
[parameter(Mandatory=$true)] [String] $OutDir,
|
||||
[parameter(Mandatory=$true)] [String] $Fname,
|
||||
[parameter(Mandatory=$false)] [bool] $NoDumpParam = $false,
|
||||
[parameter(Mandatory=$true)] [String] $SendDir
|
||||
|
||||
[parameter(Mandatory=$true)] [String] $SendDir,
|
||||
[parameter(Mandatory=$true)] [string] $OutDir
|
||||
)
|
||||
[int] $rangeus = 10
|
||||
[int] $rangemax = 98
|
||||
|
||||
[string] $out = (Join-Path -Path $SendDir -ChildPath "$Fname")
|
||||
[string] $cmd = "./lagscope $Oper -s`"$g_DestIp`" -p$Port -V $($global:Config.Options) -H -c$rangemax -l$rangeus -P`"$out.per.json`" -R`"$out.data.csv`" > `"$out.txt`""
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:logSend
|
||||
[string] $cmd = "./lagscope $Oper -s`"$g_DestIp`" -p$Port -V $($g_Config.Options) -H -c$rangemax -l$rangeus -P`"$out.per.json`" -R`"$out.data.csv`" > `"$out.txt`""
|
||||
[string] $cmdOut = (Join-Path -Path $OutDir -ChildPath "$Fname")
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append "$cmdOut.txt"
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_logSend
|
||||
Write-Host $cmd
|
||||
} # test_send()
|
||||
|
||||
function test_operations {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[parameter(Mandatory=$true)] [String] $OutDir,
|
||||
[parameter(Mandatory=$true)] [string] $SendDir,
|
||||
[parameter(Mandatory=$true)] [string] $RecvDir,
|
||||
[parameter(Mandatory=$true)] [string] $Fname,
|
||||
[parameter(Mandatory=$true)] [string] $Oper
|
||||
)
|
||||
|
||||
for ($i=0; $i -lt $g_Config.Iterations; $i++)
|
||||
{
|
||||
[int] $portstart = $g_Config.StartPort + ($i * $g_Config.Iterations)
|
||||
test_send -Port $portstart -Oper $Oper -SendDir $SendDir -Fname "$Fname.iter$i" -OutDir $OutDir
|
||||
test_recv -Port $portstart
|
||||
}
|
||||
}
|
||||
|
||||
function test_lagscope_generate {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
|
@ -80,29 +96,17 @@ function test_lagscope_generate {
|
|||
|
||||
# Iteration Tests capturing each transaction time
|
||||
# - Measures over input samples
|
||||
if ($global:Config.PingIterations -gt 0)
|
||||
if ($g_Config.PingIterations -gt 0)
|
||||
{
|
||||
banner -Msg "Iteration Tests: [tcp] operations per bounded iterations"
|
||||
for ($i=0; $i -lt $global:Config.Iterations; $i++)
|
||||
{
|
||||
[int] $portstart = $global:Config.StartPort + ($i * $global:Config.Iterations)
|
||||
|
||||
test_send -Oper "-n$($global:Config.PingIterations)" -Port $portstart -OutDir $OutDir -Fname "tcp.i$($global:Config.PingIterations).iter$i" -SendDir $SendDir
|
||||
test_recv -Port $portstart -RecvDir $RecvDir
|
||||
}
|
||||
test_protocol -Oper "-n$($g_Config.PingIterations)" -OutDir $OutDir -Fname "tcp.i$($g_Config.PingIterations)" -SendDir $SendDir -RecvDir
|
||||
}
|
||||
# Transactions per 10s
|
||||
# - Measures operations per bounded time.
|
||||
if ($global:Config.Time -gt 0)
|
||||
if ($g_Config.Time -gt 0)
|
||||
{
|
||||
banner -Msg "Time Tests: [tcp] operations per bounded time"
|
||||
for ($i=0; $i -lt $global:Config.Iterations; $i++)
|
||||
{
|
||||
[int] $portstart = $global:Config.StartPort + ($i * $global:Config.Iterations)
|
||||
|
||||
test_send -Oper "-t$($global:Config.Time)" -Port $portstart -OutDir $OutDir -Fname "tcp.t$($global:Config.Time).iter$i" -SendDir $SendDir
|
||||
test_recv -Port $portstart -RecvDir $RecvDir
|
||||
}
|
||||
test_protocol -Oper "-t$($g_Config.Time)" -OutDir $OutDir -Fname "tcp.t$($g_Config.Time)" -SendDir $SendDir -RecvDir $RecvDir
|
||||
}
|
||||
} # test_lagscope_generate()
|
||||
|
||||
|
@ -121,13 +125,13 @@ function test_main {
|
|||
)
|
||||
input_display
|
||||
$allConfig = Get-Content ./lagscope/lagscope.Config.json | ConvertFrom-Json
|
||||
[Object] $global:Config = $allConfig.("Lagscope$ConfigName")
|
||||
[string] $global:DestIp = $DestIp.Trim()
|
||||
[string] $global:SrcIp = $SrcIp.Trim()
|
||||
[Object] $g_Config = $allConfig.("Lagscope$ConfigName")
|
||||
[string] $g_DestIp = $DestIp.Trim()
|
||||
[string] $g_SrcIp = $SrcIp.Trim()
|
||||
[string] $dir = (Join-Path -Path $OutDir -ChildPath "lagscope")
|
||||
[string] $global:log = "$dir/LAGSCOPE.Commands.txt"
|
||||
[string] $global:logSend = "$dir/LAGSCOPE.Commands.Send.txt"
|
||||
[string] $global:logRecv = "$dir/LAGSCOPE.Commands.Recv.txt"
|
||||
[string] $g_log = "$dir/LAGSCOPE.Commands.txt"
|
||||
[string] $g_logSend = "$dir/LAGSCOPE.Commands.Send.txt"
|
||||
[string] $g_logRecv = "$dir/LAGSCOPE.Commands.Recv.txt"
|
||||
[string] $sendDir = (Join-Path -Path $SrcDir -ChildPath "lagscope")
|
||||
[string] $recvDir = (Join-Path -Path $DestDir -ChildPath "lagscope")
|
||||
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
"NtttcpDefault": {
|
||||
"Iterations": 6,
|
||||
"StartPort": 50002,
|
||||
"Tcp" : true,
|
||||
"Udp" : true,
|
||||
"BufferLenTcp": [65536],
|
||||
"BufferLenUdp": [1450],
|
||||
"tcp" : {
|
||||
"BufferLen": [65536],
|
||||
"Connections": [64]
|
||||
},
|
||||
"udp" : {
|
||||
"BufferLen": [1450],
|
||||
"Connections": [64]
|
||||
},
|
||||
"Warmup" : 2,
|
||||
"Cooldown" : 2,
|
||||
"Time" : 60,
|
||||
"ConnectionsTcp" : [64],
|
||||
"ConnectionsUdp" : [64],
|
||||
"RecvOptions" : "-e",
|
||||
"SendOptions" : "-e"
|
||||
},
|
||||
|
@ -18,15 +20,17 @@
|
|||
"NtttcpDetail": {
|
||||
"Iterations": 6,
|
||||
"StartPort": 50002,
|
||||
"Tcp" : true,
|
||||
"Udp" : true,
|
||||
"BufferLenTcp": [65536],
|
||||
"BufferLenUdp": [1450],
|
||||
"tcp" : {
|
||||
"BufferLen": [65536],
|
||||
"Connections": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
|
||||
},
|
||||
"udp" : {
|
||||
"BufferLen": [1450],
|
||||
"Connections": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
|
||||
},
|
||||
"Warmup" : 2,
|
||||
"Cooldown" : 2,
|
||||
"Time" : 60,
|
||||
"ConnectionsTcp" : [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
|
||||
"ConnectionsUdp" : [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
|
||||
"RecvOptions" : "-e",
|
||||
"SendOptions" : "-e"
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ function test_recv {
|
|||
)
|
||||
|
||||
[string] $out = (Join-Path -Path $RecvDir -ChildPath "$Fname")
|
||||
[string] $cmd = "./ntttcp -r -m `"$Conn,*,$global:DestIp`" $Proto -V -b $BufferLen -W $($global:Config.Warmup) -C $($global:Config.Cooldown) -p $Port -t $($global:Config.Time) $($global:Config.RecvOptions) -x $out.xml > $out.txt"
|
||||
[string] $cmd = "./ntttcp -r -m `"$Conn,*,$g_DestIp`" $Proto -V -b $BufferLen -W $($g_Config.Warmup) -C $($g_Config.Cooldown) -p $Port -t $($g_Config.Time) $($g_Config.RecvOptions) -x $out.xml > $out.txt"
|
||||
[string] $cmdOut = (Join-Path -Path $OutDir -ChildPath "$Fname")
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append "$cmdOut.txt"
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:logRecv
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_logRecv
|
||||
Write-Host $cmd
|
||||
|
||||
} # test_recv()
|
||||
|
@ -62,11 +62,11 @@ function test_send {
|
|||
)
|
||||
|
||||
[string] $out = (Join-Path -Path $SendDir -ChildPath "$Fname")
|
||||
[string] $cmd = "./ntttcp -s -m `"$Conn,*,$global:DestIp`" $Proto -V -b $BufferLen -W $($global:Config.Warmup) -C $($global:Config.Cooldown) -p $Port -t $($global:Config.Time) $($global:Config.SendOptions) -x $out.xml > $out.txt"
|
||||
[string] $cmd = "./ntttcp -s -m `"$Conn,*,$g_DestIp`" $Proto -V -b $BufferLen -W $($g_Config.Warmup) -C $($g_Config.Cooldown) -p $Port -t $($g_Config.Time) $($g_Config.SendOptions) -x $out.xml > $out.txt"
|
||||
[string] $cmdOut = (Join-Path -Path $OutDir -ChildPath "$Fname")
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append "$cmdOut.txt"
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $global:logSend
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_log
|
||||
Write-Output $cmd | Out-File -Encoding ascii -Append $g_logSend
|
||||
Write-Host $cmd
|
||||
} # test_send()
|
||||
|
||||
|
@ -74,21 +74,24 @@ function test_protocol {
|
|||
[CmdletBinding()]
|
||||
Param(
|
||||
[parameter(Mandatory=$true)] [String] $OutDir,
|
||||
[parameter(Mandatory=$true)] [Object[]] $ConnList,
|
||||
[parameter(Mandatory=$true)] [string] $SendDir,
|
||||
[parameter(Mandatory=$true)] [string] $RecvDir,
|
||||
[parameter(Mandatory=$true)] [Object[]] $BufferLenList,
|
||||
[parameter(Mandatory=$true)] [String] $Proto
|
||||
)
|
||||
banner -Msg "$Proto Tests"
|
||||
$ProtoOutDir = (Join-Path -Path $OutDir -ChildPath "$Proto")
|
||||
$ProtoSendDir = (Join-Path -Path $SendDir -ChildPath "$Proto")
|
||||
$ProtoRecvDir = (Join-Path -Path $RecvDir -ChildPath "$Proto")
|
||||
New-Item -ItemType directory -Path $ProtoOutDir | Out-Null
|
||||
$protoParam = if ($Proto -eq "udp") {"-u"} else {""};
|
||||
foreach ($BufferLen in $BufferLenList)
|
||||
foreach ($BufferLen in $g_Config.($Proto).BufferLen)
|
||||
{
|
||||
foreach ($Conn in $ConnList)
|
||||
foreach ($Conn in $g_Config.($Proto).Connections)
|
||||
{
|
||||
for ($i=0; $i -lt $global:Config.Iterations; $i++)
|
||||
for ($i=0; $i -lt $g_Config.Iterations; $i++)
|
||||
{
|
||||
test_recv -Conn $Conn -Port ($global:Config.StartPort+$i) -Proto $protoParam -OutDir $OutDir -Fname "$Proto.recv.m$Conn.iter$i" -RecvDir $RecvDir -BufferLen $BufferLen
|
||||
test_send -Conn $Conn -Port ($global:Config.StartPort+$i) -Proto $protoParam -OutDir $OutDir -Fname "$Proto.send.m$Conn.iter$i" -SendDir $SendDir -BufferLen $BufferLen
|
||||
test_recv -Conn $Conn -Port ($g_Config.StartPort+$i) -Proto $protoParam -OutDir $ProtoOutDir -Fname "$Proto.recv.m$Conn.l$BufferLen.iter$i" -RecvDir $ProtoRecvDir -BufferLen $BufferLen
|
||||
test_send -Conn $Conn -Port ($g_Config.StartPort+$i) -Proto $protoParam -OutDir $ProtoOutDir -Fname "$Proto.send.m$Conn.l$BufferLen.iter$i" -SendDir $ProtoSendDir -BufferLen $BufferLen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,28 +113,17 @@ function test_ntttcp {
|
|||
[CmdletBinding()]
|
||||
Param(
|
||||
[parameter(Mandatory=$true)] [String] $OutDir,
|
||||
[parameter(Mandatory=$true)] [Object] $global:Config,
|
||||
[parameter(Mandatory=$true)] [string] $SendDir,
|
||||
[parameter(Mandatory=$true)] [string] $RecvDir
|
||||
)
|
||||
if ($global:Config.Tcp)
|
||||
if ($null -ne $g_Config.tcp)
|
||||
{
|
||||
banner -Msg "TCP Tests"
|
||||
$tcpDir = (Join-Path -Path $OutDir -ChildPath "tcp")
|
||||
$tcpDirSend = (Join-Path -Path $SendDir -ChildPath "tcp")
|
||||
$tcpDirRecv = (Join-Path -Path $RecvDir -ChildPath "tcp")
|
||||
New-Item -ItemType directory -Path $tcpDir | Out-Null
|
||||
test_protocol -OutDir $tcpDir -SendDir $tcpDirSend -RecvDir $tcpDirRecv -ConnList $global:Config.ConnectionsTcp -BufferLenList $global:Config.BufferLenTcp -Proto "tcp"
|
||||
test_protocol -OutDir $OutDir -SendDir $SendDir -RecvDir $RecvDir -Proto "tcp"
|
||||
}
|
||||
|
||||
if ($global:Config.Udp)
|
||||
if ($null -ne $g_Config.udp)
|
||||
{
|
||||
banner -Msg "UDP Tests"
|
||||
$udpDir = (Join-Path -Path $OutDir -ChildPath "udp")
|
||||
$udpDirSend = (Join-Path -Path $SendDir -ChildPath "udp")
|
||||
$udpDirRecv = (Join-Path -Path $RecvDir -ChildPath "udp")
|
||||
New-Item -ItemType directory -Path $udpDir | Out-Null
|
||||
test_protocol -OutDir $udpDir -SendDir $udpDirSend -RecvDir $udpDirRecv -ConnList $global:Config.ConnectionsUdp -BufferLenList $global:Config.BufferLenUdp -Proto "udp"
|
||||
test_protocol -OutDir $OutDir -SendDir $SendDir -RecvDir $RecvDir -Proto "udp"
|
||||
}
|
||||
|
||||
} # test_ntttcp()
|
||||
|
@ -150,13 +142,13 @@ function test_main {
|
|||
)
|
||||
input_display
|
||||
$allConfig = Get-Content ./ntttcp/ntttcp.Config.json | ConvertFrom-Json
|
||||
$global:Config = $allConfig.("Ntttcp$ConfigName")
|
||||
[string] $global:DestIp = $DestIp.Trim()
|
||||
[string] $global:SrcIp = $SrcIp.Trim()
|
||||
$g_Config = $allConfig.("Ntttcp$ConfigName")
|
||||
[string] $g_DestIp = $DestIp.Trim()
|
||||
[string] $g_SrcIp = $SrcIp.Trim()
|
||||
[string] $dir = (Join-Path -Path $OutDir -ChildPath "ntttcp")
|
||||
[string] $global:log = "$dir/NTTTCP.Commands.txt"
|
||||
[string] $global:logSend = "$dir/NTTTCP.Commands.Send.txt"
|
||||
[string] $global:logRecv = "$dir/NTTTCP.Commands.Recv.txt"
|
||||
[string] $g_log = "$dir/NTTTCP.Commands.txt"
|
||||
[string] $g_logSend = "$dir/NTTTCP.Commands.Send.txt"
|
||||
[string] $g_logRecv = "$dir/NTTTCP.Commands.Recv.txt"
|
||||
[string] $sendDir = (Join-Path -Path $SrcDir -ChildPath "ntttcp")
|
||||
[string] $recvDir = (Join-Path -Path $DestDir -ChildPath "ntttcp")
|
||||
|
||||
|
@ -164,7 +156,7 @@ function test_main {
|
|||
$dir = $dir -replace ' ','` '
|
||||
|
||||
New-Item -ItemType directory -Path $dir | Out-Null
|
||||
Write-Host "test_ntttcp -OutDir $dir -ConfigName $global:ConfigName"
|
||||
Write-Host "test_ntttcp -OutDir $dir -ConfigName $g_ConfigName"
|
||||
|
||||
test_ntttcp -OutDir $dir -Config $global:Config -SendDir $sendDir -RecvDir $recvDir
|
||||
test_ntttcp -OutDir $dir -Config $g_Config -SendDir $sendDir -RecvDir $recvDir
|
||||
} test_main @PSBoundParameters # Entry Point
|
Загрузка…
Ссылка в новой задаче