Debian Codegraph @

Testsuite/rndspeed_main.c

raw symbols SCIP
1
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "squid.h"
5 #include "stopwatch.h"
6
7 int
8 main(int argc, char **argv)
9 {
10 int n = 1000000;
11 int r1;
12 float r2;
13 int i;
14 Stopwatch_t *w;
15
16 w = StopwatchCreate();
17
18 /* Timing test 1: Linux/UNIX rand().
19 */
20 StopwatchStart(w);
21 for (i = 0; i < n; i++) {
22 r1 = rand();
23 }
24 StopwatchStop(w);
25 StopwatchDisplay(stdout, "rand(): \t", w);
26
27 /* Timing test 2: sre_random()
28 */
29 StopwatchStart(w);
30 for (i = 0; i < n; i++) {
31 r2 = sre_random();
32 }
33 StopwatchStop(w);
34 StopwatchDisplay(stdout, "sre_random(): \t", w);
35
36 StopwatchFree(w);
37 return(EXIT_SUCCESS);
38 }
39
40
41