aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-08-30 15:55:06 +0200
committerRickard Green <[email protected]>2016-08-30 15:55:06 +0200
commit388bde3cce52302bd8773dd80fecf4f9f25f9568 (patch)
treebcbd19794e229b9e5d83b22bde9ad038aaa1c3c3 /erts/emulator/beam/beam_emu.c
parenta786167f801993995f2a1c6a5368a519cb341800 (diff)
parent037bde5b479c18711a32713751f9ae79b29a8741 (diff)
downloadotp-388bde3cce52302bd8773dd80fecf4f9f25f9568.tar.gz
otp-388bde3cce52302bd8773dd80fecf4f9f25f9568.tar.bz2
otp-388bde3cce52302bd8773dd80fecf4f9f25f9568.zip
Merge branch 'maint'
* maint: 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 3b12f78ced..0ac22b637e 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);