From 22acf451be2b024fc3dc2654320d770ad892048f Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 20 May 2024 19:04:40 +0200 Subject: [PATCH] Sync generator --- data/accmetrics.json | 442 ----------------------- data/buildphases.json | 1 - data/{buildmetrics.json => metrics.json} | 0 data/{accphases.json => phases.json} | 0 generate/benchmarks.sh | 11 +- generate/main.sh | 5 +- generate/metrics.sh | 35 +- 7 files changed, 38 insertions(+), 456 deletions(-) delete mode 100644 data/accmetrics.json delete mode 100644 data/buildphases.json rename data/{buildmetrics.json => metrics.json} (100%) rename data/{accphases.json => phases.json} (100%) diff --git a/data/accmetrics.json b/data/accmetrics.json deleted file mode 100644 index 407a121..0000000 --- a/data/accmetrics.json +++ /dev/null @@ -1,442 +0,0 @@ -[ - { - "maxMem": "852468", - "userTime": "21.82", - "cpuUsage": "181%", - "meta": { - "commit": "ad22d5ac", - "commitDate": "1713880914", - "currentDate": "1714479509" - } - }, - { - "maxMem": "946576", - "userTime": "23.17", - "cpuUsage": "185%", - "meta": { - "commit": "ad22d5ac", - "commitDate": "1713880914", - "currentDate": "1714480580" - } - }, - { - "maxMem": "1007916", - "userTime": "25.43", - "cpuUsage": "268%", - "meta": { - "commit": "ad22d5ac", - "commitDate": "1713880914", - "currentDate": "1714491105" - } - }, - { - "maxMem": "981228", - "userTime": "24.78", - "cpuUsage": "267%", - "meta": { - "commit": "6ac9aa74", - "commitDate": "1714511016", - "currentDate": "1714526747" - } - }, - { - "maxMem": "1094684", - "userTime": "25.33", - "cpuUsage": "270%", - "meta": { - "commit": "6ac9aa74", - "commitDate": "1714511016", - "currentDate": "1714567026" - } - }, - { - "maxMem": "1165204", - "userTime": "26.71", - "cpuUsage": "263%", - "meta": { - "commit": "6ac9aa74", - "commitDate": "1714511016", - "currentDate": "1714612813" - } - }, - { - "maxMem": "1123744", - "userTime": "26.26", - "cpuUsage": "267%", - "meta": { - "commit": "1434292c", - "commitDate": "1714642767", - "currentDate": "1714653404" - } - }, - { - "maxMem": "1029092", - "userTime": "25.84", - "cpuUsage": "274%", - "meta": { - "commit": "1434292c", - "commitDate": "1714642767", - "currentDate": "1714731661" - } - }, - { - "maxMem": "944832", - "userTime": "25.34", - "cpuUsage": "268%", - "meta": { - "commit": "1434292c", - "commitDate": "1714642767", - "currentDate": "1714739707" - } - }, - { - "maxMem": "962748", - "userTime": "23.96", - "cpuUsage": "263%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714742464" - } - }, - { - "maxMem": "931208", - "userTime": "24.71", - "cpuUsage": "272%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714785597" - } - }, - { - "maxMem": "1037832", - "userTime": "24.71", - "cpuUsage": "266%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714826061" - } - }, - { - "maxMem": "1015676", - "userTime": "26.19", - "cpuUsage": "275%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714872348" - } - }, - { - "maxMem": "971460", - "userTime": "24.69", - "cpuUsage": "267%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714912456" - } - }, - { - "maxMem": "1032112", - "userTime": "24.39", - "cpuUsage": "265%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714958544" - } - }, - { - "maxMem": "951956", - "userTime": "25.09", - "cpuUsage": "271%", - "meta": { - "commit": "3099bd09", - "commitDate": "1714742069", - "currentDate": "1714999026" - } - }, - { - "maxMem": "915660", - "userTime": "24.24", - "cpuUsage": "270%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715044926" - } - }, - { - "maxMem": "918976", - "userTime": "25.83", - "cpuUsage": "273%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715085366" - } - }, - { - "maxMem": "991724", - "userTime": "24.76", - "cpuUsage": "267%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715130488" - } - }, - { - "maxMem": "1030228", - "userTime": "25.73", - "cpuUsage": "264%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715171822" - } - }, - { - "maxMem": "1043864", - "userTime": "24.81", - "cpuUsage": "265%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715217789" - } - }, - { - "maxMem": "945024", - "userTime": "25.06", - "cpuUsage": "267%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715258148" - } - }, - { - "maxMem": "985624", - "userTime": "24.12", - "cpuUsage": "267%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715304146" - } - }, - { - "maxMem": "982052", - "userTime": "24.98", - "cpuUsage": "270%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715344546" - } - }, - { - "maxMem": "1095688", - "userTime": "25.33", - "cpuUsage": "269%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715390479" - } - }, - { - "maxMem": "967708", - "userTime": "25.64", - "cpuUsage": "266%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715430871" - } - }, - { - "maxMem": "953828", - "userTime": "25.34", - "cpuUsage": "269%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715477294" - } - }, - { - "maxMem": "910724", - "userTime": "25.14", - "cpuUsage": "266%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715517361" - } - }, - { - "maxMem": "997424", - "userTime": "25.00", - "cpuUsage": "267%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715563451" - } - }, - { - "maxMem": "965640", - "userTime": "24.74", - "cpuUsage": "268%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715603877" - } - }, - { - "maxMem": "1005316", - "userTime": "25.22", - "cpuUsage": "269%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715649745" - } - }, - { - "maxMem": "1153772", - "userTime": "25.94", - "cpuUsage": "268%", - "meta": { - "commit": "3127a70d", - "commitDate": "1715004801", - "currentDate": "1715690309" - } - }, - { - "maxMem": "1020404", - "userTime": "25.02", - "cpuUsage": "269%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715736200" - } - }, - { - "maxMem": "947884", - "userTime": "25.36", - "cpuUsage": "272%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715776721" - } - }, - { - "maxMem": "937516", - "userTime": "25.82", - "cpuUsage": "272%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715822617" - } - }, - { - "maxMem": "1097480", - "userTime": "25.34", - "cpuUsage": "273%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715863082" - } - }, - { - "maxMem": "1096764", - "userTime": "26.02", - "cpuUsage": "265%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715909129" - } - }, - { - "maxMem": "1009612", - "userTime": "25.71", - "cpuUsage": "272%", - "meta": { - "commit": "f48bf363", - "commitDate": "1715698038", - "currentDate": "1715949403" - } - }, - { - "maxMem": "1013656", - "userTime": "24.00", - "cpuUsage": "265%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1715995338" - } - }, - { - "maxMem": "1116536", - "userTime": "24.60", - "cpuUsage": "264%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1716035705" - } - }, - { - "maxMem": "1008056", - "userTime": "24.31", - "cpuUsage": "263%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1716082086" - } - }, - { - "maxMem": "1069692", - "userTime": "25.57", - "cpuUsage": "262%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1716122187" - } - }, - { - "maxMem": "1104852", - "userTime": "24.79", - "cpuUsage": "266%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1716168215" - } - }, - { - "maxMem": "1098292", - "userTime": "24.73", - "cpuUsage": "270%", - "meta": { - "commit": "d5ec7404", - "commitDate": "1715964709", - "currentDate": "1716208785" - } - } -] diff --git a/data/buildphases.json b/data/buildphases.json deleted file mode 100644 index fe51488..0000000 --- a/data/buildphases.json +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/data/buildmetrics.json b/data/metrics.json similarity index 100% rename from data/buildmetrics.json rename to data/metrics.json diff --git a/data/accphases.json b/data/phases.json similarity index 100% rename from data/accphases.json rename to data/phases.json diff --git a/generate/benchmarks.sh b/generate/benchmarks.sh index 43625ed..b764912 100755 --- a/generate/benchmarks.sh +++ b/generate/benchmarks.sh @@ -4,7 +4,12 @@ set -e # we need to cd here since some examples import local files cd ../effekt/ -files="examples/benchmarks/*.effekt examples/casestudies/*.effekt.*" +files="examples/benchmarks/*.effekt examples/casestudies/*.effekt.md" -# run benchmarks and gather as much information as possible -$(which time) --verbose effekt.sh --time json $files >/dev/null 2>../generate/time.out +# build all first +for file in $files; do + "$(which time)" --verbose effekt.sh -o buildout/ -b "$file" >/dev/null 2>"$file".time.out +done + +# then run completely with JSON phase timings +"$(which time)" --verbose effekt.sh -o out/ --time json $files >/dev/null 2>../generate/time.out diff --git a/generate/main.sh b/generate/main.sh index b907d66..d9ee991 100755 --- a/generate/main.sh +++ b/generate/main.sh @@ -6,4 +6,7 @@ set -e ./benchmarks.sh ./cloc.sh | ./append.sh cloc.json ./phases.sh | ./append.sh phases.json -./metrics.sh | ./append.sh metrics.json +./metrics.sh time.out | ./append.sh metrics.json + +# reset effekt repository +git -C ../effekt/ checkout . diff --git a/generate/metrics.sh b/generate/metrics.sh index c09a812..ae2875b 100755 --- a/generate/metrics.sh +++ b/generate/metrics.sh @@ -1,14 +1,31 @@ #!/bin/env bash set -e -maxMem=$(grep "Maximum resident set size" time.out | awk '{print $6}') -userTime=$(grep "User time" time.out | awk '{print $4}') -cpuUsage=$(grep "Percent of CPU this job got" time.out | awk '{print $7}') +combineMetrics() { + TIMEFILE="$1" -jq -n \ - --arg maxMem "$maxMem" \ - --arg userTime "$userTime" \ - --arg cpuUsage "$cpuUsage" \ - '{maxMem: $maxMem, userTime: $userTime, cpuUsage: $cpuUsage}' + maxMem=$(grep "Maximum resident set size" "$TIMEFILE" | awk '{print $6}') + userTime=$(grep "User time" "$TIMEFILE" | awk '{print $4}') + cpuUsage=$(grep "Percent of CPU this job got" "$TIMEFILE" | awk '{print $7}') -rm time.out + jq -n \ + --arg maxMem "$maxMem" \ + --arg userTime "$userTime" \ + --arg cpuUsage "$cpuUsage" \ + '{maxMem: $maxMem, userTime: $userTime, cpuUsage: $cpuUsage}' + + rm "$TIMEFILE" +} + +{ + for file in $(find ../effekt/ -name "*.time.out"); do + _file="${file//"../effekt/"/}" + _file="${_file//".time.out"/}" + echo "{\"$_file\":" + combineMetrics "$file" + echo "}" + done + echo "{\"total\":" + combineMetrics "time.out" + echo "}" +} | jq -s 'add'