Show More
Commit Description:
fix logg() in compile, add more logging to engine.rb when the problem cannot be found
Commit Description:
fix logg() in compile, add more logging to engine.rb when the problem cannot be found
References:
File last commit:
Show/Diff file:
Action:
test/data/test2_05sec.c
| 40 lines
| 629 B
| text/x-c
| CLexer
|
|
r51 | #include <stdio.h> | ||
#include <stdlib.h> | ||||
#include <unistd.h> | ||||
#include <sys/time.h> | ||||
#include <time.h> | ||||
#include <sys/resource.h> | ||||
// run it for 1.5 s | ||||
int main() | ||||
{ | ||||
int a,b; | ||||
int c=0; | ||||
|
r75 | int r; | ||
|
r51 | |||
|
r75 | r = scanf("%d %d",&a,&b); | ||
|
r51 | printf("%d\n",a+b); | ||
struct rusage ru; | ||||
while(1) { | ||||
c++; | ||||
b+=c; | ||||
while(c<100000) { | ||||
c++; | ||||
b+=c; | ||||
} | ||||
getrusage(RUSAGE_SELF,&ru); | ||||
double rtime = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec; | ||||
rtime += (double)ru.ru_utime.tv_usec / 1000000.0; | ||||
rtime += (double)ru.ru_stime.tv_usec / 1000000.0; | ||||
if(rtime > 0.5) | ||||
break; | ||||
} | ||||
printf("%d\n",b); | ||||
|
r137 | a += r; | ||
|
r51 | exit(0); | ||
} | ||||