All pastes #189 Raw Edit

EvilElf Bash

public text v1 · immutable
#189 ·published 2004-06-09 20:56 UTC
rendered paste body
phasespeedsplit() {
        ## This basically split the total bandwidth into 4 stages for incremental throughput
        ## behavior testing.
        local x
        local y

        x=$SPEED
        y=$(( x / 4 ))

        STAGE1=$y
        STAGE2=$(( $y * 2 ))
        STAGE3=$(( $y * 3 ))

        # This is pretty self explanative... 

        local stg_temp
        if [ $STAGE == 1 ]; then
                stg_temp=$STAGE1
        elif [ $STAGE == 2 ]; then
                stg_temp=$STAGE2
        elif [ $STAGE == 3 ]; then
                stg_temp=$STAGE3  
        elif [ $STAGE == 4 ]; then
                stg_temp=$SPEED
        fi

        ## Ok, now that we got our stage speed set, we need to split that bandwidth into         
        ## queues to match the traffic we expect to send.

        local cal
        for cal in $STAGE; do
                Q8_BW=$(( $stg_temp % 0.01 ))
                Q7_BW=$(( $stg_temp % 0.01 ))
                Q6_BW=$(( $stg_temp % 0.05 ))
                Q5_BW=$(( $stg_temp % 0.10 ))
                Q4_BW=$(( $stg_temp % 0.01 ))
                Q3_BW=$(( $stg_temp % 0.10 ))
                Q2_BW=$(( $stg_temp % 0.01 ))
                Q1_BW=$(( $stg_temp % 0.70 ))
        done
}