서버에서 바로 빌드하고 고칠 수 있게 저장소 줄바꿈을 LF로 맞췄습니다. CRLF로 들어가 있던 sh 빌드 스크립트도 이제 리눅스에서 그대로 돌아갑니다. 내용은 바뀌지 않았습니다.
16 lines
765 B
Python
16 lines
765 B
Python
# where the time goes in the translated code: dispatcher stub vs blocks (python3 profj.py elf img ms)
|
|
import os, sys, subprocess, collections, builtins
|
|
elf = sys.argv[1]
|
|
syms0 = {}
|
|
for l in subprocess.run(['llvm-nm', elf], capture_output=True, text=True).stdout.splitlines():
|
|
p = l.split()
|
|
if len(p) == 3: syms0[p[2]] = int(p[0], 16)
|
|
cb = syms0['g_code']; cnt = collections.Counter(); tot = [0]
|
|
def blk(uc, addr, size, ud):
|
|
n = size // 2; tot[0] += n
|
|
if cb <= addr < cb + 0x10000: cnt['stub' if addr - cb < 0x50 else 'block'] += n
|
|
else: cnt['C'] += n
|
|
builtins.__gbprof = (blk, cnt)
|
|
exec(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'devab.py')).read())
|
|
for k, v in cnt.most_common(): print('%6.2f%% %s' % (100 * v / tot[0], k))
|