ixCollectStats
ixCollectStats - collect a particular statistic on a group of ports
SYNOPSIS
ixCollectStats rxList statName rxStats totalStats
DESCRIPTION
The ixCollectStats command gathers the same specified statistic from a number of ports and places the results in a return array.
ARGUMENTS
rxList
(By value) The list of ports in one of the following formats:
One of the following literal strings, or a reference to a variable with the $ (for example, $pl after set pl ...)
{{1 1 1}}
{{1 1 1} {1 1 2} {1 1 3} {1 1 4}}
{{1 1 *} {1 2 1} {1 2 2}}
{1,1,* 1,2,1 1,2,2}
statName
(By value or reference) The name of the statistic to poll. This has to match one of the standard options defined in the stat command.
rxStats
(By reference) The array containing the returned statistics per port. Each element is accessed with three comma separated arguments corresponding to the chassis, card and port being accessed. For example, $rxStats(1, 1, 1)
totalStats
(By reference) The total of the values in RxStats.
RETURNS
0
No error; the command was successfully delivered to the IxServer.
1
Error; the command was delivered to the IxServer but it could not process the message.
EXAMPLES
package require IxTclHal
set host galaxy
set username user
# Check if we're running on UNIX - connect to the TCL Server
# which must be running on the chassis
if [isUNIX] {
if [ixConnectToTclServer $host] {
ixPuts "Could not connect to $host"
return 1
}
}
# Now connect to the chassis
if [ixConnectToChassis $host] {
ixPuts $::ixErrorInfo
return 1
}
# Get the chassis ID to use in port lists
set chas [ixGetChassisID $host]
set chas 1
set cardA 1
set portA 1
set cardB 1
set portB 2
set portList [list [list $chas $cardA $portA] [list $chas $cardB $portB]]
# Login before taking ownership
if [ixLogin $username] {
ixPuts $::ixErrorInfo
return 1
}
# Take ownership of the ports we'll use
if [ixTakeOwnership $portList] {
ixPuts $::ixErrorInfo
return 1
}
# Setup start
map new -type one2one
map config -type one2one
map add $chas $cardA $portA $chas $cardB $portB
map add $chas $cardB $portB $chas $cardA $portA
port setDefault
port set $chas $cardA $portA
port set $chas $cardB $portB
stream setDefault
stream config -dma stopStream
stream config -numFrames 100000
stream set $chas $cardA $portA 1
stream config -numFrames 200000
stream set $chas $cardB $portB 1
# Set up the ports
ixWritePortsToHardware one2oneArray
after 1000
if {[ixCheckLinkState one2oneArray] != 0} {
ixPuts "Link is not up"
exit
}
# Clear statistics before starting
if {[ixClearStats portList] != 0} {
ixPuts "Could not clear statistics on $portList"
}
# Start transmit and wait a bit
ixStartTransmit one2oneArray
after 1000
# Check if the both ports have stopped
ixCheckTransmitDone portList
ixPuts "Ports stopped transmitting"
if {[ixCollectStats $portList framesSent myArray myTotal] != 0} {
ixPuts "Could not collect statistics on $portList"
}
ixPuts "Total number is $myTotal"
foreach p $portList {
scan $p "%d %d %d" ch ca po
ixPuts "Port $p is $myArray($ch,$ca,$po)"
}
# Let go of the ports that we reserved
ixClearOwnership $portList
# Disconnect from the chassis we're using
ixDisconnectFromChassis $host
# If we're running on UNIX, disconnect from the TCL Server
if [isUNIX] {
ixDisconnectTclServer $host
}