Files
syskiller 2d48091205 줄바꿈을 LF로 통일
서버에서 바로 빌드하고 고칠 수 있게 저장소 줄바꿈을 LF로 맞췄습니다.
CRLF로 들어가 있던 sh 빌드 스크립트도 이제 리눅스에서 그대로 돌아갑니다.
내용은 바뀌지 않았습니다.
2026-11-24 07:13:54 +09:00

15 lines
935 B
Python

# per-function instruction profile of v3.bin in Unicorn (devv3 setup), counted from FROM ms on
import sys, os, collections, bisect
os.environ.setdefault('SHOTS', '')
FROM = int(os.environ.get('FROM', '0'))
src = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'devv3.py')).read()
src = src.replace("while state['ms'] < total_ms", "cnt=collections.Counter()\ndef hc(uc,a,s,d):\n if state['ms']>=FROM: cnt[a]+=1\nu.hook_add(UC_HOOK_CODE,hc,begin=0,end=0xffff)\nwhile state['ms'] < total_ms")
exec(compile(src, 'devv3', 'exec'))
fn = sorted((v, k) for k, v in syms.items() if v < 0x10000)
keys = [a for a, _ in fn]; per = collections.Counter()
for a, c in cnt.items():
i = bisect.bisect_right(keys, a) - 1; per[fn[i][1] if i >= 0 else '?'] += c
tot = sum(per.values())
for n, c in per.most_common(25): print('%-28s %6.2f%%' % (n, 100 * c / tot))
print('ARM instr total', tot, 'per ms', tot / max(1, total_ms - FROM))