bump version
[barvinok.git] / barvinok_count.c
blob968b4b3280828f4ad98e154ad06cb79d465a7e88
1 #include <unistd.h>
2 #include <sys/times.h>
3 #include <polylib/polylibgmp.h>
4 #include <util.h>
5 #include <barvinok.h>
6 #include "config.h"
8 #ifdef HAVE_GROWING_CHERNIKOVA
9 #define MAXRAYS 0
10 #else
11 #define MAXRAYS 600
12 #endif
14 static void time_diff(struct tms *before, struct tms *after)
16 long ticks = sysconf(_SC_CLK_TCK);
17 printf("User: %g; Sys: %g\n",
18 (0.0 + after->tms_utime - before->tms_utime) / ticks,
19 (0.0 + after->tms_stime - before->tms_stime) / ticks);
22 int main()
24 Value cm, cb;
25 struct tms tms_before, tms_between, tms_after;
26 Polyhedron *A;
27 Matrix *M;
29 M = Matrix_Read();
30 A = Constraints2Polyhedron(M, MAXRAYS);
31 Matrix_Free(M);
32 value_init(cm);
33 value_init(cb);
34 Polyhedron_Print(stdout, P_VALUE_FMT, A);
35 times(&tms_before);
36 manual_count(A, &cm);
37 times(&tms_between);
38 barvinok_count(A, &cb, 100);
39 times(&tms_after);
40 printf("manual: ");
41 value_print(stdout, P_VALUE_FMT, cm);
42 puts("");
43 time_diff(&tms_before, &tms_between);
44 printf("Barvinok: ");
45 value_print(stdout, P_VALUE_FMT, cb);
46 puts("");
47 time_diff(&tms_between, &tms_after);
48 value_clear(cm);
49 value_clear(cb);
50 Polyhedron_Free(A);
51 return 0;