Every tracked file that can carry a comment (880 of them) now opens with "Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with "Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com", in the file's own comment syntax. No behaviour change: the diff outside the version bump and changelogs is comment lines only. - tools/stamp_author.py: writes the lines; idempotent, `--check` lists what is missing. Headers go under a shebang and under Markdown front matter. - Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the LICENSE files (already carry the copyright line). - tools/linux_check.sh: --help reads its header from line 3, now that the author line sits under the shebang. - tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
34 lines
2.6 KiB
Python
34 lines
2.6 KiB
Python
# Author: Guoliang Chen, a Senior Digital Design Engineer
|
|
|
|
import subprocess, pathlib, os, time, json, re, shutil, hashlib
|
|
root=pathlib.Path('/Users/guoliangchen/repo/verilogrustformatter')
|
|
out=pathlib.Path('/tmp/lucisv-perf-review-20260908'); corpus='/Users/guoliangchen/repo/opentitan'
|
|
tree=corpus+'/hw/ip'
|
|
binaries={'0.51.0':str(root/'target/release/lucisv'),'0.50.0':'/Users/guoliangchen/.cache/lucisv-baselines/lucisv-0.50.0'}
|
|
initial=subprocess.check_output(['git','-C',corpus,'status','--porcelain'],text=True)
|
|
def run(label,kind,trial,args):
|
|
cmd=[str(root/'tools/guard.sh'),'-m','8','-t','1800','--','/usr/bin/time','-l',binaries[label]]+args+[tree]
|
|
load=os.getloadavg()
|
|
r=subprocess.run(cmd,cwd=root,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
|
log=r.stdout+r.stderr
|
|
(out/f'cli-{label}-{kind}-{trial}.log').write_bytes(log)
|
|
err=r.stderr.decode(errors='replace')
|
|
timing=re.search(r'([\d.]+) real\s+([\d.]+) user\s+([\d.]+) sys',err)
|
|
rss=re.search(r'(\d+)\s+maximum resident set size',err)
|
|
summary=[x for x in log.decode(errors='replace').splitlines() if re.search(r'^found \d+ violations|files? (checked|already|would|from)|violations? in|failed to format|files?,',x)]
|
|
record=dict(label=label,row=kind,trial=trial,command=cmd,exit=r.returncode,wall_s=float(timing[1]) if timing else None,user_s=float(timing[2]) if timing else None,sys_s=float(timing[3]) if timing else None,peak_rss_bytes=int(rss[1]) if rss else None,summary=summary[-4:],stdout_sha256=hashlib.sha256(r.stdout).hexdigest(),load_before=load,load_after=os.getloadavg(),corpus_unchanged=initial==subprocess.check_output(['git','-C',corpus,'status','--porcelain'],text=True))
|
|
with (out/'cli-results.jsonl').open('a') as f:f.write(json.dumps(record)+'\n')
|
|
print(label,kind,trial,record['wall_s'],record['summary'],flush=True)
|
|
if r.returncode not in (0,1,2) or not record['corpus_unchanged'] or not timing: raise RuntimeError(record)
|
|
for trial in range(1,4):
|
|
for label in (list(binaries) if trial%2 else list(reversed(binaries))):
|
|
for kind,args in [('default',['check']),('style',['check','--select','error,warning,style']),('style-no-unused-import',['check','--select','error,warning,style','--ignore','unused-import'])]:
|
|
if label=='0.43.0' and kind=='style-no-unused-import':continue
|
|
run(label,kind,trial,args)
|
|
cache=out/'cli-format-cache'
|
|
shutil.rmtree(cache,ignore_errors=True)
|
|
for warmth in ['cold','warm']:
|
|
run('0.51.0','format-'+warmth,trial,['format','--check','--cache-dir',str(cache)])
|
|
|
|
# Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com
|