diff options
author | koekeishiya <aasvi93@hotmail.com> | 2017-08-08 14:37:50 +0200 |
---|---|---|
committer | koekeishiya <aasvi93@hotmail.com> | 2017-08-08 14:37:50 +0200 |
commit | c7e9a62faa49d3220483d7892684502c76437fce (patch) | |
tree | 3788221702a0e8c57d3923630ad6ceab724fb55e /src | |
parent | f8b95dc8d4df04a11b98daae36f222509498be58 (diff) | |
download | skhd-c7e9a62faa49d3220483d7892684502c76437fce.tar.gz skhd-c7e9a62faa49d3220483d7892684502c76437fce.zip |
add timing macros
Diffstat (limited to 'src')
-rw-r--r-- | src/skhd.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -91,6 +91,17 @@ internal HOTLOADER_CALLBACK(hotloader_handler) } } +#ifdef 0 +#define BEGIN_TIMED_BLOCK() \ + clock_t timed_block_begin = clock() +#define END_TIMED_BLOCK() \ + clock_t timed_block_end = clock(); \ + double timed_block_elapsed = (timed_block_end -timed_block_begin) / (double)CLOCKS_PER_SEC; \ + printf("elapsed time: %f\n", timed_block_elapsed) +#endif + + + internal EVENT_TAP_CALLBACK(key_handler) { switch(type) @@ -108,7 +119,8 @@ internal EVENT_TAP_CALLBACK(key_handler) uint32_t key = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); struct hotkey eventkey = { .flags = 0, .key = key }; cgeventflags_to_hotkeyflags(flags, &eventkey); - if(find_and_exec_hotkey(&eventkey, &hotkey_map)) { + bool result = find_and_exec_hotkey(&eventkey, &hotkey_map); + if(result) { return NULL; } } break; |