Use meson in the perf suite, add GHA scripts and 'make some' ##tests

* Nicer graph results by perfing only tags
This commit is contained in:
pancake 2023-08-18 06:42:04 +02:00
parent eb855ca299
commit 53c23ed075
5 changed files with 111 additions and 18 deletions

View File

@ -18,3 +18,13 @@ EXPECT=<<EOF
0 0
EOF EOF
RUN RUN
NAME=macho manysyms
FILE=bins/mach0/gzdoom.arm_64.1
CMDS=<<EOF
isq~?
EOF
EXPECT=<<EOF
113460
EOF
RUN

View File

@ -1,10 +1,22 @@
r2?=master
# r2?=$(shell cat tmp/prefix/commit.txt 2> /dev/null || (cd tmp/radare2 2> /dev/null ; git log|head -n1|awk '{print $$2}'))
r2?=$(shell cat tmp/prefix/commit.txt 2> /dev/null || (cd tmp/radare2 && git log|head -n1|awk '{print $$2}')) CNT=$(shell cat tmp/radare2-$(r2)/count.txt 2> /dev/null || (cd tmp/radare2 2> /dev/null ; git log|grep ^commit|wc -l | awk '{print $$1}'))
CNT=$(shell cat tmp/prefix/count.txt 2> /dev/null || (cd tmp/radare2 && git log|grep ^commit|wc -l | awk '{print $$1}'))
TMP=$(shell pwd)/tmp TMP=$(shell pwd)/tmp
PREFIX=$(TMP)/prefix PREFIX=$(TMP)/prefix
SO_EXT=$(shell r2 -H R2_LIBEXT) SO_EXT=$(shell r2 -H R2_LIBEXT)
DB=$(shell pwd)/../db
SOME=master
SOME+=5.8.8
SOME+=5.8.6
SOME+=5.8.4
SOME+=5.8.2
SOME+=5.8.0
SOME+=5.7.8
SOME+=5.7.6
SOME+=5.7.4
SOME+=5.7.2
SOME+=5.7.0
all: lint mem.$(SO_EXT) all: lint mem.$(SO_EXT)
@echo "Usage: make [action] [option=value]" @echo "Usage: make [action] [option=value]"
@ -40,9 +52,12 @@ use: $(TMP)/radare2 lint
echo $(r2) > $(TMP)/radare2-$(r2)/commit.txt ; \ echo $(r2) > $(TMP)/radare2-$(r2)/commit.txt ; \
git log|grep ^commit|wc -l | awk '{print $$1}' > ../radare2-$(r2)/count.txt ; fi git log|grep ^commit|wc -l | awk '{print $$1}' > ../radare2-$(r2)/count.txt ; fi
export CFLAGS=-Ofast && cd tmp/radare2-$(r2) && \ export CFLAGS=-Ofast && cd tmp/radare2-$(r2) && \
r2pm -r -- ./configure --with-syscapstone --prefix=$(PREFIX) --without-dylink --with-checks-level=0 > $(TMP)/radare2-$(r2)/configure.log 2>&1 && \ r2pm -r -- meson b --prefix=$(PREFIX) -Dchecks_level=0 > $(TMP)/radare2-$(r2)/configure.log 2>&1 && \
time r2pm -r $(MAKE) -j > $(TMP)/radare2-$(r2)/build.log 2>&1 r2pm -r -- ninja -C b
$(MAKE) -C tmp/radare2-$(r2) symstall > $(TMP)/radare2-$(r2)/install.log 2>&1 #sudo $(MAKE) -C tmp/radare2-$(r2) uninstall > /dev/null
rm -rf tmp/prefix/bin tmp/prefix/lib
cd tmp/radare2-$(r2) && \
r2pm -r -- ninja -C b install > $(TMP)/radare2-$(r2)/install.log 2>&1
cp -f tmp/radare2-$(r2)/count.txt tmp/prefix/count.txt cp -f tmp/radare2-$(r2)/count.txt tmp/prefix/count.txt
cp -f tmp/radare2-$(r2)/commit.txt tmp/prefix/commit.txt cp -f tmp/radare2-$(r2)/commit.txt tmp/prefix/commit.txt
@ -53,6 +68,9 @@ count=20
world: world:
for a in `make lsa|head -n $(count)` ; do if [ -d tmp/radare2-$$a ]; then continue ; fi ; echo $$a ; sleep 1 ; make use r2=$$a ; make run r2=$$a ; done for a in `make lsa|head -n $(count)` ; do if [ -d tmp/radare2-$$a ]; then continue ; fi ; echo $$a ; sleep 1 ; make use r2=$$a ; make run r2=$$a ; done
some:
for a in ${SOME} ; do if [ -d tmp/radare2-$$a ]; then continue ; fi ; echo $$a ; sleep 1 ; make use r2=$$a ; make run r2=$$a ; done
force-world: force-world:
for a in `make lsa|head -n $(count)` ; do echo $$a ; sleep 1 ; make use r2=$$a ; make run r2=$$a ; done for a in `make lsa|head -n $(count)` ; do echo $$a ; sleep 1 ; make use r2=$$a ; make run r2=$$a ; done
@ -69,9 +87,14 @@ html:
run: run:
mkdir -p logs mkdir -p logs
PATH=$(TMP)/prefix/bin/:${PATH} r2r -o logs/$(CNT)-$(r2)-1.json -i ../db/perf -DYLD_LIBRARY_PATH=$(PREFIX)/lib PATH=$(PREFIX)/bin/:$${PATH} \
PATH=$(TMP)/prefix/bin/:${PATH} r2r -o logs/$(CNT)-$(r2)-2.json -i ../db/perf r2r -o logs/$(CNT)-$(r2)-1.json $(DB)/perf
PATH=$(TMP)/prefix/bin/:${PATH} r2r -o logs/$(CNT)-$(r2)-3.json -i ../db/perf -DYLD_LIBRARY_PATH=$(PREFIX)/lib PATH=$(PREFIX)/bin/:$${PATH} \
r2r -o logs/$(CNT)-$(r2)-2.json $(DB)/perf
-DYLD_LIBRARY_PATH=$(PREFIX)/lib PATH=$(PREFIX)/bin/:$${PATH} \
r2r -o logs/$(CNT)-$(r2)-3.json $(DB)/perf
-DYLD_LIBRARY_PATH=$(PREFIX)/lib PATH=$(PREFIX)/bin/:$${PATH} \
r2 -v > logs/$(CNT)-$(r2).version
$(MAKE) main $(MAKE) main
main: main:

44
test/perf/gha.js Normal file
View File

@ -0,0 +1,44 @@
function parseGhaLogs(gha) {
const data = [];
var item = {};
let r_name = "";
let r_title = "";
for (let r of gha.workflow_runs) {
console.log(r.name, r.display_title);
const a = Date.parse(r.run_started_at);
const b = Date.parse(r.updated_at);
const r_time = 0|((b - a) / 1000) / 60;
//console.log(" ", 0|((b - a) / 1000) / 60);
if (r_title === '') {
item = {
title: r.display_title,
name: r.name,
time: r_time,
};
} else {
if (r.title != r_title) {
if (item.name == 'tcc')
data.push(item);
item = {
title: r.display_title,
name: r.name,
time: r_time,
};
}
}
r_name = r.name;
r_title = r.display_title;
}
if (item.name == 'tcc') {
data.push(item);
}
return data;
}
function main() {
const gha = require("./gha.json");
const data = parseGhaLogs(gha);
for (const k of data) {
console.log(k);
}
}
main();

11
test/perf/gha.sh Normal file
View File

@ -0,0 +1,11 @@
if [ -z "${GITHUB_ACCESS_TOKEN}" ]; then
echo "Please define GITHUB_ACCESS_TOKEN"
exit 1
fi
curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/radareorg/radare2/actions/runs" > gha.json
# ?created=2023-06-01..2023-04-02"

View File

@ -5,7 +5,7 @@
function parseLogs() { function parseLogs() {
const logFiles = r2.cmd('ls -q') const logFiles = r2.cmd('ls -q')
.trim().split(/\n/g) .trim().split(/\n/g)
.filter((x) => !x.startsWith('.')) .filter((x) => !x.startsWith('.') && x.endsWith('.json'))
.sort(); .sort();
const o = {}; const o = {};
@ -27,8 +27,7 @@ function parseLogs() {
o[count].tests[name].push(test); o[count].tests[name].push(test);
} }
} else { } else {
o[count] = { commit:commit, count: count }; o[count] = { commit: commit, count: count, tests: {} };
o[count].tests = {};
o[count].tests[name] = [test]; o[count].tests[name] = [test];
} }
// console.log(test.time_elapsed, '\t', test.name); // console.log(test.time_elapsed, '\t', test.name);
@ -98,7 +97,6 @@ function getdata(log, two, log2) {
if (!log) { if (!log) {
return []; return [];
} }
// const keys = (log && log.tests)? Object.keys(log.tests) : []; // segfault
const keys = Object.keys(log.tests).sort(); const keys = Object.keys(log.tests).sort();
const ret = []; const ret = [];
const o = {}; const o = {};
@ -128,6 +126,10 @@ function getdata(log, two, log2) {
} }
return ret; return ret;
} }
function getName(d) {
return logs[d].commit;
}
const res = {}; const res = {};
for (const kount of Object.keys(logs)) { for (const kount of Object.keys(logs)) {
const log = logs[kount]; const log = logs[kount];
@ -136,7 +138,7 @@ for (const kount of Object.keys(logs)) {
if (res[d]) { if (res[d]) {
res[d].data.push(data[d]); res[d].data.push(data[d]);
} else { } else {
res[d] = {name: d, data : [data[d]]}; res[d] = {name: getName(kount), data : [data[d]]};
} }
} }
} }
@ -164,10 +166,10 @@ for (const are of ares) {
} }
const msg = ` const msg = `
<script> <script>
const xValues = ${xvalues}; // [50,60,70,80,90,100,110,120,130,140,150]; const xValues = ${xvalues};
// const yValues = [7,8,8,9,9,9,10,11,14,14,15]; // const yValues = [7,8,8,9,9,9,10,11,14,14,15];
const yValues = ${yvalues}; // [7,8,8,9,9,9,10,11,14,14,15]; const yValues = ${yvalues};
const aValues = ${avalues}; // [7,8,8,9,9,9,10,11,14,14,15]; const aValues = ${avalues};
new Chart("myChart", { new Chart("myChart", {
type: "line", type: "line",
data: { data: {
@ -202,6 +204,7 @@ console.log(msg);
console.log("<table style='background-color:#a0a0a0;color:black' border=1>"); console.log("<table style='background-color:#a0a0a0;color:black' border=1>");
let line = "<tr style='background-color:#404040;color:white'>\n "; let line = "<tr style='background-color:#404040;color:white'>\n ";
line += "<td>label</td>";
line += "<td>count</td>"; line += "<td>count</td>";
// line += "<td>commit</td>"; // line += "<td>commit</td>";
line += "<td>diff</td>"; line += "<td>diff</td>";
@ -222,6 +225,8 @@ for (let n = 0; n < logKeys.length; n++) {
// console.log(JSON.stringify(log, null, 2)); // console.log(JSON.stringify(log, null, 2));
let line = "<tr>"; let line = "<tr>";
// line += "<td>"+log.count+"</td>"; // line += "<td>"+log.count+"</td>";
const label = log.commit.length < 10? log.commit: log.count;
line += "<td>"+label + "</td>";
line += "<td><a href='https://github.com/radareorg/radare2/commit/"+log.commit+"'>"+log.count+"</a></td>"; line += "<td><a href='https://github.com/radareorg/radare2/commit/"+log.commit+"'>"+log.count+"</a></td>";
var bg = log.diff > 10? "#ff8080": "#80ff80"; var bg = log.diff > 10? "#ff8080": "#80ff80";
line += "<td style='background-color:"+bg+"'>"+log.diff+"</td>"; line += "<td style='background-color:"+bg+"'>"+log.diff+"</td>";