Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #include <benchmarks.h>
10 :
11 0 : void benchmarkDel (void)
12 : {
13 0 : ksDel (large);
14 0 : }
15 :
16 0 : int benchmarkIterate (void)
17 : {
18 0 : ksRewind (large);
19 : Key * cur;
20 0 : int c = 0;
21 0 : while ((cur = ksNext (large)))
22 : {
23 : // count to make sure the loop is executed
24 0 : ++c;
25 : }
26 0 : return c;
27 : }
28 :
29 0 : int main (int argc, char ** argv)
30 : {
31 0 : if (argc != 3)
32 : {
33 0 : printf ("no arguments given, will exit\n");
34 0 : printf ("usage %s dir key (both dir+key are numbers)\n", argv[0]);
35 0 : exit (0);
36 : }
37 : else
38 : {
39 0 : num_dir = atoi (argv[1]);
40 0 : num_key = atoi (argv[2]);
41 0 : printf ("Using %d dirs %d keys\n", num_dir, num_key);
42 : }
43 :
44 0 : timeInit ();
45 0 : benchmarkCreate ();
46 0 : timePrint ("Created empty keyset");
47 :
48 0 : benchmarkFillup ();
49 0 : timePrint ("New large keyset");
50 :
51 0 : benchmarkIterate ();
52 0 : timePrint ("Iterated over keyset");
53 :
54 : benchmarkDel ();
55 0 : timePrint ("Del large keyset");
56 : }
|