Skip to content

Commit

Permalink
Fix perf test (#2718)
Browse files Browse the repository at this point in the history
* Attempt to debug / fix perf test

* Make them subinclude what they need

* some more things

* more fix

* moar fix
  • Loading branch information
peterebden committed Mar 8, 2023
1 parent 9b97f4b commit e306d9c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
23 changes: 21 additions & 2 deletions tools/performance/gen_parse_tree.py
Expand Up @@ -47,6 +47,8 @@
}

LANGUAGE_TEMPLATE = """
subinclude("///{lang}//build_defs:{lang}")
{lang}_library(
name = "{name}",
srcs = glob(["*.{ext}"], exclude=["*_test.{ext}"]),
Expand Down Expand Up @@ -123,8 +125,25 @@ def main(argv):
f.write("""
[Plugin "java"]
Target = //plugins:java
""")
pass
[Plugin "python"]
Target = //plugins:python
[Plugin "cc"]
Target = //plugins:cc
TestMain = ///pleasings//cc:unittest_main
[Plugin "go"]
Target = //plugins:go
[parse]
preloadsubincludes = ///python//build_defs:python
preloadsubincludes = ///cc//build_defs:cc
""")
with open(os.path.join(FLAGS.root, 'BUILD.plz'), 'w') as f:
f.write("""
github_repo(
name = "pleasings",
repo = "thought-machine/pleasings",
revision = "v1.1.0",
)
""")
if FLAGS.format:
# Format them all up (in chunks to avoid 'argument too long')
n = 1000
Expand Down
6 changes: 5 additions & 1 deletion tools/performance/parse_perf_test.py
Expand Up @@ -41,7 +41,11 @@ def plz() -> list:
def run(i: int):
"""Run once and return the length of time taken."""
log.info('Run %d of %d', i + 1, FLAGS.number)
duration, mem = parse_time_output(subprocess.run(plz(), check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE).stderr.decode("utf-8"))
try :
duration, mem = parse_time_output(subprocess.run(plz(), check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.decode("utf-8"))
except subprocess.CalledProcessError as err:
log.exception('Subprocess failed: ' + err.stderr.decode())
raise
log.info('Complete in %0.2fs, using %d KB', duration, mem)
return duration, mem

Expand Down

0 comments on commit e306d9c

Please sign in to comment.