forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatekeys.c
More file actions
59 lines (49 loc) · 960 Bytes
/
Copy pathcreatekeys.c
File metadata and controls
59 lines (49 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @file
*
* @brief
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/
#include <benchmarks.h>
void benchmarkDel (void)
{
ksDel (large);
}
int benchmarkIterate (void)
{
int c = 0;
elektraCursor it;
ssize_t ksSize = ksGetSize (large);
for (it = 0; it < ksSize; ++it)
{
ksAtCursor (large, it);
// count to make sure the loop is executed
++c;
}
return c;
}
int main (int argc, char ** argv)
{
if (argc != 3)
{
printf ("no arguments given, will exit\n");
printf ("usage %s dir key (both dir+key are numbers)\n", argv[0]);
exit (0);
}
else
{
num_dir = atoi (argv[1]);
num_key = atoi (argv[2]);
printf ("Using %d dirs %d keys\n", num_dir, num_key);
}
timeInit ();
benchmarkCreate ();
timePrint ("Created empty keyset");
benchmarkFillup ();
timePrint ("New large keyset");
benchmarkIterate ();
timePrint ("Iterated over keyset");
benchmarkDel ();
timePrint ("Del large keyset");
}