This commit is contained in:
julianb0 2019-08-05 16:31:23 +02:00
parent b409f35c7c
commit 683dd8c473
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
4 changed files with 42 additions and 2 deletions

View File

@ -19,6 +19,9 @@ dos: kas dosclean
.PHONY: clean dosclean
stats:
@cd ka && ./mkstats.py
dosclean:
@rm -f $(KODIR)/*.com $(KSDIR)/*.sym

37
ka/mkstats.py Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/python3
import os
from pprint import pprint
instrs = dict()
def mkstat(fp):
for _, line in enumerate(fp):
if len(line) == 0 or line[0] not in ' \t':
continue
tok = line.strip().split()
if len(tok) == 0:
continue
i = tok[0].split('.')[0]
if len(i) == 0 or i in ';#@/':
continue
if i in instrs:
instrs[i] += 1
else:
instrs[i] = 1
for root, _, files in os.walk('.'):
for f in files:
if len(f) > 2 and f[-2:] == '.k':
mkstat(open(os.path.join(root, f), "r"))
n = len(instrs.items())
for key, value in sorted(instrs.items(), key=lambda x: x[1]):
print("#{}. {}: {}".format(n, key, value))
n -= 1

View File

@ -200,7 +200,7 @@ main:
push b[rax+3]
mov rcx, b[rax+4]
add rcx, rcx, 1
inc rcx, 1
push rcx
push w[rax+6]

View File

@ -30,7 +30,7 @@ void dumpregs()
TRACE("\ncr0=0x%-16lX cr1=0x%-16lX cr2=0x%-16lX", R(CR0), R(CR1), R(CR2));
TRACE("\n\nEnviron #2:");
TRACE("\nrsp=0x%-16lX rbp=0x%-16lX nin=0d%-16lu", R(RSP), R(RBP), ctx->ninstrs);
TRACE("\nrsp=0x%-16lX rbp=0x%-16lX ins=0d%-16lu", R(RSP), R(RBP), ctx->ninstrs);
TRACE("\ngrp=0x%-16lX trp=0x%-16lX srp=0x%-16lX", R(GRP), R(TRP), R(SRP));
TRACE("\n\nArgument:");