The cpu speed is 222MHz as an example, processing data rate is 44100, each block has 8192 samples, and the total calls to foo is 532.
#!/bin/bash
rate=44100
blksize=8192
cpu=222
call=532
# the following val is got from gprof as percentage cpu time, 30.11%.
pcpu_foo=30.11
duration=`echo "scale=4; $blksize * $call / $rate" | bc`
echo "duration: " $duration
secs_foo=`echo "scale=4; $duration * $pcpu_foo /100" | bc`
echo "secs_foo " $secs_foo
blksecs_foo=`echo "scale=4; $secs_foo/$call"|bc`
echo "blocksecs_foo" $blksecs_foo
cpu_foo=`echo "scale=4; $cpu * $rate / $blksize * $blksecs_foo"|bc`
echo "cpu_foo " $cpu_foo " MCycle/sec"