aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_gc.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-05-08 17:45:01 +0200
committerRickard Green <[email protected]>2015-05-08 17:45:01 +0200
commit207346e0543143bf1aea11a93bcb24de170fc0ac (patch)
tree6792897b3d88f175605f216edc4780c54fe98edb /erts/emulator/beam/erl_gc.c
parentfad4130bd8844097b6406ddc587b2185de1937fe (diff)
parent6b5905e49c74c4034b55824ce4d1a62455f670bc (diff)
downloadotp-207346e0543143bf1aea11a93bcb24de170fc0ac.tar.gz
otp-207346e0543143bf1aea11a93bcb24de170fc0ac.tar.bz2
otp-207346e0543143bf1aea11a93bcb24de170fc0ac.zip
Merge branch 'rickard/time-improvement/OTP-11997'
* rickard/time-improvement/OTP-11997: Allow execution of estone suite on pre OTP-18 systems Add parallel time monotonicity test-case Replace usage of erlang:now() in line-tracing Replace erlang:now() usage in emulator suite Replace erlang:now() usage in system suite Misc time improvements
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r--erts/emulator/beam/erl_gc.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 0b18d2b9e8..eadd558dda 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -404,7 +404,7 @@ erts_garbage_collect(Process* p, int need, Eterm* objv, int nobj)
Uint reclaimed_now = 0;
int done = 0;
int off_heap_msgs;
- Uint ms1, s1, us1;
+ ErtsMonotonicTime start_time = 0; /* Shut up faulty warning... */
erts_aint32_t state;
ErtsSchedulerData *esdp;
#ifdef USE_VM_PROBES
@@ -424,9 +424,8 @@ erts_garbage_collect(Process* p, int need, Eterm* objv, int nobj)
state = erts_smp_atomic32_read_bor_nob(&p->state, ERTS_PSFLG_GC);
off_heap_msgs = state & ERTS_PSFLG_OFF_HEAP_MSGS;
- if (erts_system_monitor_long_gc != 0) {
- get_now(&ms1, &s1, &us1);
- }
+ if (erts_system_monitor_long_gc != 0)
+ start_time = erts_get_monotonic_time();
ERTS_CHK_OFFHEAP(p);
@@ -474,16 +473,14 @@ erts_garbage_collect(Process* p, int need, Eterm* objv, int nobj)
}
if (erts_system_monitor_long_gc != 0) {
- Uint ms2, s2, us2;
- Sint t;
+ ErtsMonotonicTime end_time;
+ Uint gc_time;
if (erts_test_long_gc_sleep)
while (0 != erts_milli_sleep(erts_test_long_gc_sleep));
- get_now(&ms2, &s2, &us2);
- t = ms2 - ms1;
- t = t*1000000 + s2 - s1;
- t = t*1000 + ((Sint) (us2 - us1))/1000;
- if (t > 0 && (Uint)t > erts_system_monitor_long_gc) {
- monitor_long_gc(p, t);
+ end_time = erts_get_monotonic_time();
+ gc_time = (Uint) ERTS_MONOTONIC_TO_MSEC(end_time - start_time);
+ if (gc_time && gc_time > erts_system_monitor_long_gc) {
+ monitor_long_gc(p, gc_time);
}
}
if (erts_system_monitor_large_heap != 0) {