mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
647db26552
* . * yaml update * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "cd690f725d" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cd690f725d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * separate main bss syms * renames and one match * SR symbol rename * fix symbol_addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "5fa8aa24ca" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "5fa8aa24ca" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * remove old artifacts
57 lines
1.2 KiB
Python
Executable File
57 lines
1.2 KiB
Python
Executable File
#! /usr/bin/python3
|
|
|
|
import glob
|
|
import os
|
|
|
|
print_funcs = False
|
|
|
|
sizes = {}
|
|
|
|
funcs = {}
|
|
|
|
def calc_insns(f_path):
|
|
ret = 0
|
|
with open(f_path) as f:
|
|
f_lines = f.readlines()
|
|
for line in f_lines:
|
|
if line.startswith("/* "):
|
|
ret += 1
|
|
funcs[f_path.split("/")[-1][:-2]] = ret
|
|
return ret
|
|
|
|
def do_dir(root, dir):
|
|
max = 0
|
|
min = None
|
|
total = 0
|
|
|
|
files = glob.glob(os.path.join(root, dir) + "/*.s")
|
|
|
|
for f in files:
|
|
amt = calc_insns(f)
|
|
if amt > max:
|
|
max = amt
|
|
if min is None or amt < min:
|
|
min = amt
|
|
total += amt
|
|
|
|
avg = 0 if len(files) == 0 else total / len(files)
|
|
|
|
sizes[dir] = ((min, max, total, avg, len(files)))
|
|
|
|
|
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
|
asm_dir = script_dir + "/../ver/current/asm/nonmatchings"
|
|
|
|
for root, dirs, files in os.walk(asm_dir):
|
|
for asm_dir in dirs:
|
|
if "/os" not in root and "/world/" not in root and "/battle/" not in root:
|
|
do_dir(root, asm_dir)
|
|
|
|
for thing in sorted(sizes.keys(), key=lambda x: sizes[x][4]):
|
|
val = sizes[thing][4]
|
|
if val > 0:
|
|
print(thing.ljust(25) + str(val))
|
|
|
|
if print_funcs:
|
|
print(dict(sorted(funcs.items(), key=lambda f: f[1])))
|