Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add monotonic clock config option, use it for debugger transport peeks #1659

Merged
merged 5 commits into from
Aug 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use monotonic time for debugger rate limiting
  • Loading branch information
svaarala committed Aug 3, 2017
commit 6efac9431c0e5c1d0639e85105e62574447879f3
8 changes: 5 additions & 3 deletions src-input/duk_js_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,12 +1800,14 @@ DUK_LOCAL void duk__interrupt_handle_debugger(duk_hthread *thr, duk_bool_t *out_
duk_double_t now, diff_last;

thr->heap->dbg_last_counter = thr->heap->dbg_exec_counter;
now = duk_time_get_ecmascript_time(thr);
now = duk_time_get_monotonic_time(thr);

diff_last = now - thr->heap->dbg_last_time;
if (diff_last < 0.0 || diff_last >= (duk_double_t) DUK_HEAP_DBG_RATELIMIT_MILLISECS) {
/* Negative value checked so that a "time jump" works
* reasonably.
/* Monotonic time should not experience time jumps,
* but the provider may be missing and we're actually
* using Ecmascript time. So, tolerate negative values
* so that a time jump works reasonably.
*
* Same interval is now used for status sending and
* peeking.
Expand Down