diff options
author | Patrik Nyblom <[email protected]> | 2012-02-07 18:00:35 +0100 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2012-02-07 18:00:35 +0100 |
commit | 6004ec3e1785913ff0b74054cf614a35c180d54a (patch) | |
tree | 1865eab06f4254649f4d9f3e0fbd693c854df5c0 /erts/emulator/beam/bif.c | |
parent | 8d59a1fc518719c8c445d9d94b23c173c18b4438 (diff) | |
parent | 6992261d258f2fc0b25ddf99ebcbf66ae02f5df8 (diff) | |
download | otp-6004ec3e1785913ff0b74054cf614a35c180d54a.tar.gz otp-6004ec3e1785913ff0b74054cf614a35c180d54a.tar.bz2 otp-6004ec3e1785913ff0b74054cf614a35c180d54a.zip |
Merge branch 'dgud/sched-work-time/OTP-9858' into maint
* dgud/sched-work-time/OTP-9858:
emulator: Document and test scheduler_wall_time
Implement statistics(scheduler_wall_time)
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r-- | erts/emulator/beam/bif.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 55f4798892..f8305944a4 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -43,6 +43,9 @@ static Export* set_cpu_topology_trap = NULL; static Export* await_proc_exit_trap = NULL; Export* erts_format_cpu_topology_trap = NULL; +static Export *await_sched_wall_time_mod_trap; +static erts_smp_atomic32_t sched_wall_time; + #define DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) /* @@ -4160,6 +4163,18 @@ BIF_RETTYPE system_flag_2(BIF_ALIST_2) erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN); BIF_RET(am_true); + } else if (BIF_ARG_1 == am_scheduler_wall_time) { + if (BIF_ARG_2 == am_true || BIF_ARG_2 == am_false) { + erts_aint32_t new = BIF_ARG_2 == am_true ? 1 : 0; + erts_aint32_t old = erts_smp_atomic32_xchg_nob(&sched_wall_time, + new); + Eterm ref = erts_sched_wall_time_request(BIF_P, 1, new); + ASSERT(is_value(ref)); + BIF_TRAP2(await_sched_wall_time_mod_trap, + BIF_P, + ref, + old ? am_true : am_false); + } } else if (ERTS_IS_ATOM_STR("scheduling_statistics", BIF_ARG_1)) { int what; if (ERTS_IS_ATOM_STR("disable", BIF_ARG_2)) @@ -4457,6 +4472,9 @@ void erts_init_bif(void) am_format_cpu_topology, 1); await_proc_exit_trap = erts_export_put(am_erlang,am_await_proc_exit,3); + await_sched_wall_time_mod_trap + = erts_export_put(am_erlang, am_await_sched_wall_time_modifications, 2); + erts_smp_atomic32_init_nob(&sched_wall_time, 0); } #ifdef HARDDEBUG |