tools/times: added simple scripts to generate time stats for cppcheck
This commit is contained in:
parent
f3029ce6bb
commit
1ebab4a442
|
@ -0,0 +1,41 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
FILE *f = fopen("times.log", "rt");
|
||||
if (!f)
|
||||
return 1;
|
||||
|
||||
char lines[64][64] = {0};
|
||||
|
||||
int n = 0;
|
||||
float mintime=0.0f, maxtime=0.0f;
|
||||
char rev[10] = {0};
|
||||
char line[128] = {0};
|
||||
while (fgets(line,sizeof(line),f) && n < 64) {
|
||||
if (strchr(line,'\r'))
|
||||
*strchr(line,'\r') = 0;
|
||||
if (strchr(line,'\n'))
|
||||
*strchr(line,'\n') = 0;
|
||||
if (strncmp(line,"HEAD is now at ", 15) == 0) {
|
||||
if (rev[0])
|
||||
sprintf(lines[n++],"%s: %.1f - %.1f", rev, mintime, maxtime);
|
||||
strncpy(rev, line+15, 7);
|
||||
mintime = 0.0f;
|
||||
maxtime = 0.0f;
|
||||
}
|
||||
if (strncmp(line,"Overall time:",13)==0) {
|
||||
float time = atof(line+14);
|
||||
if (mintime < 0.1f || time < mintime)
|
||||
mintime = time;
|
||||
else if (time > maxtime)
|
||||
maxtime = time;
|
||||
}
|
||||
}
|
||||
|
||||
while (n > 0)
|
||||
printf("%s\n", lines[--n]);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Simple script to generate times.log that contains timing information for the last 20 revisions
|
||||
# Typically these commands shall be used to get times.txt:
|
||||
# mkdir src
|
||||
# cp lib/* src/ <- fill src/ with some source code
|
||||
# tools/times.sh
|
||||
# gcc -o tools/times tools/times.c
|
||||
# tools/times
|
||||
|
||||
git checkout -b old
|
||||
|
||||
make clean
|
||||
|
||||
git reset --hard HEAD > times.log
|
||||
|
||||
for i in {0..20}
|
||||
do
|
||||
make CXXFLAGS=-O2 -j4
|
||||
echo "$i"
|
||||
./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null >> times.log
|
||||
./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null >> times.log
|
||||
./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null >> times.log
|
||||
./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null >> times.log
|
||||
git reset --hard HEAD^1 >> times.log
|
||||
done
|
||||
|
Loading…
Reference in New Issue