Skip to content

Instantly share code, notes, and snippets.

@nmicic
Created August 4, 2022 14:07
Show Gist options
  • Select an option

  • Save nmicic/e6a463ee69db6cb1ab56c81a095facff to your computer and use it in GitHub Desktop.

Select an option

Save nmicic/e6a463ee69db6cb1ab56c81a095facff to your computer and use it in GitHub Desktop.
ucad_buffers_delta_icp.sh
#!/bin/bash
PREVALLOC1=0
PREVALLOC2=0
PREVALLOC3=0
PREVALLOC4=0
PREVFREE1=0
PREVFREE2=0
PREVFREE3=0
PREVFREE4=0
#while [ 1 ]; do
for((i=0;i<=20;i++));do
read -r TIME ALLOC1 ALLOC2 ALLOC3 ALLOC4 FREE1 FREE2 FREE3 FREE4 <<< $( grep ESP /proc/ucad/debug/stats_cooked | grep -v fai | awk 'BEGIN{printf "%x",systime()} {printf "%s" substr($0,25)} END{printf "\n"}' | sed -E "s/\s+/ /"g | awk '{for (i=1;i<=NF; i++){printf("%d ","0x"$i)}}' )
DELTA1=$(( $ALLOC1 - $FREE1 ))
DELTA2=$(( $ALLOC2 - $FREE2 ))
DELTA3=$(( $ALLOC3 - $FREE3 ))
DELTA4=$(( $ALLOC4 - $FREE4 ))
DELTA_ALLOC1=$(( $ALLOC1 - $PREVALLOC1 ))
DELTA_ALLOC2=$(( $ALLOC2 - $PREVALLOC2 ))
DELTA_ALLOC3=$(( $ALLOC3 - $PREVALLOC3 ))
DELTA_ALLOC4=$(( $ALLOC4 - $PREVALLOC4 ))
DELTA_FREE1=$(( $FREE1 - $PREVFREE1 ))
DELTA_FREE2=$(( $FREE2 - $PREVFREE2 ))
DELTA_FREE3=$(($FREE3 - $PREVFREE3 ))
DELTA_FREE4=$(( $FREE4 - $PREVFREE4 ))
PREVALLOC1=$ALLOC1
PREVALLOC2=$ALLOC2
PREVALLOC3=$ALLOC3
PREVALLOC4=$ALLOC4
PREVFREE1=$FREE1
PREVFREE2=$FREE2
PREVFREE3=$FREE3
PREVFREE4=$FREE4
DELALLOC12=$(( $ALLOC1 - $ALLOC2 ))
DELALLOC13=$(( $ALLOC1 - $ALLOC3 ))
DELALLOC14=$(( $ALLOC1 - $ALLOC4 ))
SUM1=$(( $DELTA1 + $DELTA2 + $DELTA3 + $DELTA4 ))
SUM2=$(( $DELTA_ALLOC1 + $DELTA_ALLOC2 + $DELTA_ALLOC3 + $DELTA_ALLOC4 ))
echo $TIME :: $DELTA1 $DELTA2 $DELTA3 $DELTA4 :: sum1:$SUM1 :: $DELTA_ALLOC1 $DELTA_ALLOC2 $DELTA_ALLOC3 $DELTA_ALLOC4 :: sum2:$SUM2 :: $ALLOC1 $ALLOC2 $ALLOC3 $ALLOC4 :: 0 $DELALLOC12 $DELALLOC13 $DELALLOC14
cat /proc/icp_dh89xxcc_dev0/et_ring_ctrl/*/conf | grep inflights | grep -v 'inflights: 0,'
sleep 0.1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment