aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-08-30 15:53:45 +0200
committerRickard Green <[email protected]>2016-08-30 15:53:45 +0200
commit037bde5b479c18711a32713751f9ae79b29a8741 (patch)
tree23fc7a0e3fadf74333a1db1128367194f6e15488 /erts/emulator/beam/beam_emu.c
parent16f4bd5f6cb5fe6d6412ae219634902813bd9cce (diff)
parent2c8a13e5d3aabeedeb290624d6acc02d25db1bd5 (diff)
downloadotp-037bde5b479c18711a32713751f9ae79b29a8741.tar.gz
otp-037bde5b479c18711a32713751f9ae79b29a8741.tar.bz2
otp-037bde5b479c18711a32713751f9ae79b29a8741.zip
Merge branch 'rickard/ds-win-32bit/OTP-13759' into maint
* rickard/ds-win-32bit/OTP-13759: 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 073b7e39b6..b3e6ebf651 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -5252,19 +5252,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);