projects
/
platform
/
upstream
/
libxkbcommon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resetting manifest requested domain to floor
[platform/upstream/libxkbcommon.git]
/
bench
/
rules.c
diff --git
a/bench/rules.c
b/bench/rules.c
index
d92ed07
..
1306dc4
100644
(file)
--- a/
bench/rules.c
+++ b/
bench/rules.c
@@
-21,11
+21,14
@@
* DEALINGS IN THE SOFTWARE.
*/
* DEALINGS IN THE SOFTWARE.
*/
+#include "config.h"
+
#include <time.h>
#include "../test/test.h"
#include <time.h>
#include "../test/test.h"
-#include "xkbcomp-priv.h"
-#include "rules.h"
+#include "xkbcomp/xkbcomp-priv.h"
+#include "xkbcomp/rules.h"
+#include "bench.h"
#define BENCHMARK_ITERATIONS 20000
#define BENCHMARK_ITERATIONS 20000
@@
-33,12
+36,12
@@
int
main(int argc, char *argv[])
{
struct xkb_context *ctx;
main(int argc, char *argv[])
{
struct xkb_context *ctx;
- struct timespec start, stop, elapsed;
int i;
struct xkb_rule_names rmlvo = {
"evdev", "pc105", "us,il", ",", "ctrl:nocaps,grp:menu_toggle",
};
int i;
struct xkb_rule_names rmlvo = {
"evdev", "pc105", "us,il", ",", "ctrl:nocaps,grp:menu_toggle",
};
- struct xkb_component_names kccgst;
+ struct bench bench;
+ char *elapsed;
ctx = test_get_context(0);
assert(ctx);
ctx = test_get_context(0);
assert(ctx);
@@
-46,25
+49,22
@@
main(int argc, char *argv[])
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0);
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0);
-
clock_gettime(CLOCK_MONOTONIC, &start
);
+
bench_start(&bench
);
for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
+ struct xkb_component_names kccgst;
+
assert(xkb_components_from_rules(ctx, &rmlvo, &kccgst));
free(kccgst.keycodes);
free(kccgst.types);
free(kccgst.compat);
free(kccgst.symbols);
}
assert(xkb_components_from_rules(ctx, &rmlvo, &kccgst));
free(kccgst.keycodes);
free(kccgst.types);
free(kccgst.compat);
free(kccgst.symbols);
}
- clock_gettime(CLOCK_MONOTONIC, &stop);
-
- elapsed.tv_sec = stop.tv_sec - start.tv_sec;
- elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
- if (elapsed.tv_nsec < 0) {
- elapsed.tv_nsec += 1000000000;
- elapsed.tv_sec--;
- }
+ bench_stop(&bench);
- fprintf(stderr, "processed %d rule files in %ld.%09lds\n",
- BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
+ elapsed = bench_elapsed_str(&bench);
+ fprintf(stderr, "processed %d rule files in %ss\n",
+ BENCHMARK_ITERATIONS, elapsed);
+ free(elapsed);
xkb_context_unref(ctx);
return 0;
xkb_context_unref(ctx);
return 0;