#!@zsh@/bin/zsh

base=$(basename $0)
suffix=${base##*.}

#sent=$(cat /var/queuesize.$suffix)
#uustat -s $suffix | grep 'Executing recv-media' | sed -r 's/^.*\(sending ([0-9]+) bytes\)/\1/' | awk "BEGIN{s=${sent}}{s+=\$1}END{print s}"

awk 'BEGIN{s=0}{s+=$1}END{print s;}' @queueDir@/${suffix}.queuesize

# typeset -a queued
# queued=()

# ids=$({ uustat -s $suffix | cut -d ' ' -f 1; cut -d ' ' -f 2 /var/queuesize.$suffix } | sort | uniq -d )
# queued=(${(f)ids})

# sum=0

# while read size id; do
#     [[ ${queued[(r)$id]} == ${(q)id} ]] || continue
#     sum=$((sum + size))
# done < /var/queuesize.$suffix

# print $sum