diff options
author | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-06-15 12:29:32 +0200 |
---|---|---|
committer | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-16 17:12:34 +0200 |
commit | db7cd61f6297aab6343f7c6cd424d8987ca03a58 (patch) | |
tree | 85e06fa1cd4cf005facf4e63ecd0c98519effa2f /src/nvim/regexp.c | |
parent | f172b19f438b0bccdc1be0d82a6fe660c4bbd6e0 (diff) | |
download | rneovim-db7cd61f6297aab6343f7c6cd424d8987ca03a58.tar.gz rneovim-db7cd61f6297aab6343f7c6cd424d8987ca03a58.tar.bz2 rneovim-db7cd61f6297aab6343f7c6cd424d8987ca03a58.zip |
profiling: implement on top of os_hrtime()
Should be better than gettimeofday() since libuv uses higher resolution
clocks on most UNIX platforms. Libuv also tries to use monotonic clocks,
kernel bugs notwithstanding, which is another win over gettimeofday().
Necessary for Windows, which doesn't have gettimeofday(). In vanilla vim,
Windows uses QueryPerformanceCounter, which is the correct primitive for
this sort of things, but that was removed when slimming up the codebase.
Libuv uses QueryPerformanceCounter to implement uv_hrtime() on Windows so
the behaviour of vim profiling on Windows should now be the same.
The behaviour on Linux should be different (better) though, libuv uses more
accurate primitives than gettimeofday().
Other misc. changes:
- Added function attributes where relevant (const, pure, ...)
- Convert functions to receive scalars: Now that proftime_T is always a
(uint64_t) scalar (and not a struct), it's clearer to convert the
functions to receive it as such instead of a pointer to a scalar.
- Extract profiling funcs to profile.c: make everything clearer and reduces
the size of the "catch-all" ex_cmds2.c
- Add profile.{c,h} to clint and -Wconv:
- Don't use sprintf, use snprintf
- Don't use long, use int16_t/int32_t/...
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index f9f02eac9d..fd1b6116f2 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -3468,7 +3468,7 @@ static long bt_regexec_both(char_u *line, /* Check for timeout once in a twenty times to avoid overhead. */ if (tm != NULL && ++tm_count == 20) { tm_count = 0; - if (profile_passed_limit(tm)) + if (profile_passed_limit(*tm)) break; } } |