aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-07-20 15:48:27 +0200
committerRickard Green <[email protected]>2016-07-20 15:48:27 +0200
commit2c8a13e5d3aabeedeb290624d6acc02d25db1bd5 (patch)
tree691f18cbf9b52874c55ba3be0485674cfd7f25a1 /erts/emulator/beam/beam_emu.c
parentb490fb8664ec6e5ceaadc1c74350dc666f5406d2 (diff)
downloadotp-2c8a13e5d3aabeedeb290624d6acc02d25db1bd5.tar.gz
otp-2c8a13e5d3aabeedeb290624d6acc02d25db1bd5.tar.bz2
otp-2c8a13e5d3aabeedeb290624d6acc02d25db1bd5.zip
Fix dirty schedulers build on windows
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index c6258287c4..626d99f233 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -5261,19 +5261,14 @@ void erts_dirty_process_main(ErtsSchedulerData *esdp)
else {
/*
* Dirty CPU scheduler:
- * Currently two reductions consumed per
- * micro second spent in the dirty NIF.
+ * Reductions based on time consumed by
+ * the dirty NIF.
*/
- ErtsMonotonicTime time;
- time = erts_get_monotonic_time(esdp);
- time -= start_time;
- time = ERTS_MONOTONIC_TO_USEC(time);
- time *= (CONTEXT_REDS-1)/1000 + 1;
- ASSERT(time >= 0);
- if (time == 0)
- time = 1; /* At least one reduction */
- time += esdp->virtual_reds;
- reds_used = time > INT_MAX ? INT_MAX : (int) time;
+ Sint64 treds;
+ treds = erts_time2reds(start_time,
+ erts_get_monotonic_time(esdp));
+ treds += esdp->virtual_reds;
+ reds_used = treds > INT_MAX ? INT_MAX : (int) treds;
}
PROCESS_MAIN_CHK_LOCKS(c_p);