[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Number of Clocks
From: |
User Tomdean |
Subject: |
[avr-gcc-list] Number of Clocks |
Date: |
Sun, 4 Sep 2005 10:49:55 -0700 (PDT) |
I have a piece of code that shows the number of cycles per instruction
in the output of 'avr-objdump -d' for 16-bit instruction CPUs. It
uses a modified version of binutils-2.16/include/opcode/avr.h.
It is interesting to minimize the time in, for example, an ISR. I
often use it with sed and awk,
avr-objdump -d xxx.elf | avr-cycles \
| sed -e 's/\[/\[ /' -e 's/\]/ ]/' \
| awk 'BEGIN {a=b=c=ta=tb=tc=0}; \
/^\[/ {a+=$$2;b+=$$3;c+=$$4;print}; \
/^0/ {print a, b, c; ta+=a; tb+=b; tc+=c; a=0; b=0; c=0}; \
END {print a, b, c; \
ta+=a; tb+=b; tc+=c; \
print "\nTotals:"; \
print "Bytes", "Minumum", "Maximum"; \
printf "%5d %7d %7d\n", ta, tb, tc }'
If that is interesting, I will post it, some 500 lines of
clumped-together code and lots of comments.
tomdean
- [avr-gcc-list] Number of Clocks,
User Tomdean <=