2012-11-27 06:08:26 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2018-09-28 19:04:39 +02:00
|
|
|
static void revncpy(char *dst, const char *src, size_t len)
|
2012-12-11 10:43:38 +01:00
|
|
|
{
|
2018-09-28 19:04:39 +02:00
|
|
|
int n = 0;
|
|
|
|
while (n++<len && *src && *src!=' ' && *src!='\r' && *src!='\n')
|
|
|
|
*dst++ = *src++;
|
2012-11-27 12:20:23 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 10:43:38 +01:00
|
|
|
int main()
|
|
|
|
{
|
2012-11-27 06:08:26 +01:00
|
|
|
FILE *f = fopen("times.log", "rt");
|
|
|
|
if (!f)
|
|
|
|
return 1;
|
|
|
|
|
2013-07-21 13:16:34 +02:00
|
|
|
char lines[0xffff][64] = {0};
|
2012-11-27 06:08:26 +01:00
|
|
|
|
|
|
|
int n = 0;
|
|
|
|
float mintime=0.0f, maxtime=0.0f;
|
|
|
|
char rev[10] = {0};
|
|
|
|
char line[128] = {0};
|
2018-09-28 19:04:39 +02:00
|
|
|
|
2013-07-21 13:16:34 +02:00
|
|
|
while (fgets(line,sizeof(line),f) && n < (sizeof(lines)/sizeof(*lines))) {
|
2012-11-27 06:08:26 +01:00
|
|
|
if (strncmp(line,"HEAD is now at ", 15) == 0) {
|
|
|
|
if (rev[0])
|
2012-11-27 12:20:23 +01:00
|
|
|
sprintf(lines[n++],"%s\t%.1f\t%.1f", rev, mintime, maxtime);
|
2018-09-28 19:04:39 +02:00
|
|
|
revncpy(rev, line+15, sizeof(rev)-1);
|
2012-11-27 06:08:26 +01:00
|
|
|
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;
|
2012-11-27 12:20:23 +01:00
|
|
|
if (time > maxtime)
|
2012-11-27 06:08:26 +01:00
|
|
|
maxtime = time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (n > 0)
|
|
|
|
printf("%s\n", lines[--n]);
|
|
|
|
|
2012-12-25 15:28:35 +01:00
|
|
|
fclose(f);
|
2012-11-27 06:08:26 +01:00
|
|
|
return 0;
|
|
|
|
}
|