atmtm_ns_hist_combo_per_stream.tcl
来自「smartbits二次开发示例代码」· TCL 代码 · 共 380 行 · 第 1/2 页
TCL
380 行
set PFRPerStream [expr round( floor($PCRPerStream / $CellsPerFrame)) ]
#set up frame rate of streams
LIBCMD HTSetStructure $L3_DEFINE_STREAM_EXTENSION 0 0 0 - 0 $TxHub $TxSlot $TxPort\
-ulFrameRate $PFRPerStream
struct_new ext L3StreamExtension
set ext(ulFrameRate) 0
LIBCMD HTSetStructure $L3_DEFINE_MULTI_STREAM_EXTENSION 1 $num2Add 0 ext 0 $TxHub $TxSlot $TxPort
unset ext
###########################################################################
# All streams are bound to VC of index 1on Tx Card. #
###########################################################################
puts "Binding streams to VCs ..."
struct_new binding L3StreamBinding
set binding(ucBindMode) $STREAM_BIND_VC
set binding(uiBindIndex) 1 ;#This is the VC index to be bound
set binding(uiATMFlags) $AT_CLP_OFF
LIBCMD HTSetStructure $L3_DEFINE_STREAM_BINDING 0 0 0 binding 0 $TxHub $TxSlot $TxPort
set binding(uiBindIndex) 0 ;#This is the delta VC index
LIBCMD HTSetStructure $L3_DEFINE_MULTI_STREAM_BINDING 1 $num2Add 0 binding 0 $TxHub $TxSlot $TxPort
#Unset the structure
unset binding
###########################################################################
# Commit streams to VCs on Tx Card. #
###########################################################################
puts "Committing streams..."
LIBCMD HTSetCommand $NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
after 2000
#############################################
# Check for L3 streams. Test will not #
# work if there are no streams transmitting #
# The DEFINED_STREAM_COUNT will return the #
# total stream count (including the first, #
# hidden stream, so we have to adjust the #
# count to show the count of transmitting #
# streams. #
#############################################
struct_new DefStreams ULong
LIBCMD HTGetStructure $L3_DEFINED_STREAM_COUNT_INFO 0 0 0 DefStreams 0 $TxHub $TxSlot $TxPort
set TOTAL_STREAMS [expr $DefStreams(ul) - 1]
if { $TOTAL_STREAMS < 2 } {
puts "No L3 streams on card - Aborting Test!"
puts "Press ENTER key to exit"
gets stdin response
exit
} else {
puts "Testing with $TOTAL_STREAMS streams"
}
#Unset the structure
unset DefStreams
############################################################################
# Set distribution intervals. #
# - They are set to variables here so the same variables can be referenced #
# when setting up the display. #
############################################################################
LIBCMD HTSetCommand $NS_HIST_COMBO_PER_STREAM 0 0 0 - $RxHub $RxSlot $RxPort\
-ulInterval.0.ul $R0 \
-ulInterval.1.ul $R1 \
-ulInterval.2.ul $R2 \
-ulInterval.3.ul $R3 \
-ulInterval.4.ul $R4 \
-ulInterval.5.ul $R5 \
-ulInterval.6.ul $R6 \
-ulInterval.7.ul $R7 \
-ulInterval.8.ul $R8 \
-ulInterval.9.ul $R9 \
-ulInterval.10.ul $R10 \
-ulInterval.11.ul $R11 \
-ulInterval.12.ul $R12 \
-ulInterval.13.ul $R13 \
-ulInterval.14.ul $R14 \
-ulInterval.15.ul $R15
LIBCMD HTSetCommand $NS_HIST_START 0 0 0 NULL $RxHub $RxSlot $RxPort
# Create the group and set to transmit a single burst of 10000 packets
LIBCMD HGSetGroup ""
LIBCMD HGAddtoGroup $TxHub $TxSlot $TxPort
LIBCMD HGAddtoGroup $RxHub $RxSlot $RxPort
###########################################################################
# Transmit packets. #
###########################################################################
#LIBCMD HTRun $HTRUN $TxHub $TxSlot $TxPort
LIBCMD HGRun $::HTRUN
after 2000
###########################################################################
# Check the histogram setup and number of records generated is correct. #
###########################################################################
struct_new test_info Layer3HistActiveTest
# Check that the histogram setup on the port and the number of
# records generated is correct
LIBCMD HTGetStructure $NS_HIST_ACTIVE_TEST_INFO 0 0 0 test_info 0 $RxHub $RxSlot $RxPort
if {$test_info(ulTest) != $NS_HIST_TEST_COMBO_PER_STREAM} {
puts "Expected: 16(NS_HIST_COMBO_PER_STREAM) Actual: $test_info(ulTest) \
The histogram test reported is incorrect"\
}
if {$test_info(ulRecords) != $TOTAL_STREAMS} {
puts "Expected: $TOTAL_STREAMS Actual: $test_info(ulRecords) \
The number of histogram records generated is incorrect"
}
unset test_info
###########################################################################
# Display histograms. #
###########################################################################
struct_new HistComboPerStrmInfo NSHistComboPerStreamInfo*$TOTAL_STREAMS
LIBCMD HTGetStructure $NS_HIST_COMBO_PER_STREAM_INFO 0 0 0 HistComboPerStrmInfo 0 $RxHub $RxSlot $RxPort
for {set i 0} {$i < $TOTAL_STREAMS} {incr i} {
# pull out data from ulStreamID
#set BOX [expr ($HistComboPerStrmInfo($i.ulStreamID) & 0x0F000000) / 0x010000000]
set SLOT [expr ($HistComboPerStrmInfo($i.ulStreamID) & 0x00FF0000) / 0x00010000]
set STREAM [expr $HistComboPerStrmInfo($i.ulStreamID) & 0x0000FFFF]
puts "==================================================================="
puts "SEQUENCE TRACKING - Card [expr $RxSlot +1]"
#puts " $HistComboPerStrmInfo($i.u64TotalFrames.low) Frames received from CARD [expr $SLOT + 1], BOX [expr $BOX + 1], STREAM $STREAM"
puts " $HistComboPerStrmInfo($i.u64TotalFrames.low) Frames received from CARD [expr $SLOT + 1], STREAM $STREAM"
puts " Frames in Sequence => $HistComboPerStrmInfo($i.u64InSequence.low)"
puts " Duplicate Frames => $HistComboPerStrmInfo($i.u64OutOfSequence)"
#puts " Lost Frames => $HistComboPerStrmInfo($i.ulLost)"
puts "==================================================================="
puts "PER STREAM LATENCY"
puts " Min Frame Latency for Stream $STREAM => [expr $HistComboPerStrmInfo($i.ulMinLatency) * 0.1] uS"
puts " Max Frame Latency for Stream $STREAM => [expr $HistComboPerStrmInfo($i.ulMaxLatency) * 0.1] uS"
puts "==================================================================="
puts "LATENCY DISTRIBUTION in 0.1uS"
puts "========================================================================="
puts -nonewline "|[format "%7d" $R0] |[format "%7d" $R1] |[format "%7d" $R2] |[format "%7d" $R3] |"
puts "[format "%7d" $R4] |[format "%7d" $R5] |[format "%7d" $R6] |[format "%7d" $R7] |"
puts "-------------------------------------------------------------------------"
puts -nonewline "|"
for {set j 0} {$j < 8} {incr j} {
puts -nonewline "[format "%7d" $HistComboPerStrmInfo($i.u64Frames.$j.low)] |"
}
puts ""
puts "-------------------------------------------------------------------------\n"
puts "========================================================================="
puts -nonewline "|[format "%7d" $R8] |[format "%7d" $R9] |[format "%7d" $R10] |[format "%7d" $R11] |"
puts "[format "%7d" $R12] |[format "%7d" $R13] |[format "%7d" $R14] |[format "%7d" $R15] |"
puts "-------------------------------------------------------------------------"
puts -nonewline "|"
for {set j 8} {$j < 16} {incr j} {
puts -nonewline "[format "%7d" $HistComboPerStrmInfo($i.u64Frames.$j.low)] |"
}
puts ""
puts "-------------------------------------------------------------------------"
puts "Press ENTER key for next stream data"
gets stdin response
}
#Unset the structure
unset HistComboPerStrmInfo
puts "UnLinking from the chassis now.."
ETUnLink
puts ""
puts "DONE!"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?