summaryrefslogtreecommitdiff
path: root/runtime/roots_byt.c
diff options
context:
space:
mode:
authorEnguerrand Decorne <decorne.en@gmail.com>2019-11-15 13:52:35 +0100
committerEnguerrand Decorne <decorne.en@gmail.com>2020-04-30 10:32:01 +0200
commitb7f0494df52f758f88b723b881a606660f4672cc (patch)
treef8d0872ec8c88dc47d37009e9b4008f4907dae1c /runtime/roots_byt.c
parenta9f7d74bcf332ffc18d394b5c6af30a1a74d01ab (diff)
downloadocaml-b7f0494df52f758f88b723b881a606660f4672cc.tar.gz
Rewrite the instrumented runtime to store traces in the CTF format.
The instrumentation code in the instrumented runtime was replaced with new APIs to gather runtime statistics and output them in a new format (Common Trace Format). This commit also exposes new functions in the Gc module to pause or resume instrumentation during a program execution (Gc.eventlog_pause and Gc.eventlog_resume).
Diffstat (limited to 'runtime/roots_byt.c')
-rw-r--r--runtime/roots_byt.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/runtime/roots_byt.c b/runtime/roots_byt.c
index a3a2dcd8f4..bd549f1467 100644
--- a/runtime/roots_byt.c
+++ b/runtime/roots_byt.c
@@ -27,6 +27,7 @@
#include "caml/roots.h"
#include "caml/stacks.h"
#include "caml/memprof.h"
+#include "caml/eventlog.h"
CAMLexport void (*caml_scan_roots_hook) (scanning_action f) = NULL;
@@ -81,26 +82,31 @@ intnat caml_darken_all_roots_slice (intnat work)
ignored and [caml_darken_all_roots_slice] does nothing. */
void caml_do_roots (scanning_action f, int do_globals)
{
- CAML_INSTR_SETUP (tmr, "major_roots");
/* Global variables */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_GLOBAL);
f(caml_global_data, &caml_global_data);
- CAML_INSTR_TIME (tmr, "major_roots/global");
+ CAML_EV_END(EV_MAJOR_ROOTS_GLOBAL);
/* The stack and the local C roots */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_LOCAL);
caml_do_local_roots(f, Caml_state->extern_sp, Caml_state->stack_high,
Caml_state->local_roots);
- CAML_INSTR_TIME (tmr, "major_roots/local");
+ CAML_EV_END(EV_MAJOR_ROOTS_LOCAL);
/* Global C roots */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_C);
caml_scan_global_roots(f);
- CAML_INSTR_TIME (tmr, "major_roots/C");
+ CAML_EV_END(EV_MAJOR_ROOTS_C);
/* Finalised values */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_FINALISED);
caml_final_do_roots (f);
- CAML_INSTR_TIME (tmr, "major_roots/finalised");
+ CAML_EV_END(EV_MAJOR_ROOTS_FINALISED);
/* Memprof */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_MEMPROF);
caml_memprof_do_roots (f);
- CAML_INSTR_TIME (tmr, "major_roots/memprof");
+ CAML_EV_END(EV_MAJOR_ROOTS_MEMPROF);
/* Hook */
+ CAML_EV_BEGIN(EV_MAJOR_ROOTS_HOOK);
if (caml_scan_roots_hook != NULL) (*caml_scan_roots_hook)(f);
- CAML_INSTR_TIME (tmr, "major_roots/hook");
+ CAML_EV_END(EV_MAJOR_ROOTS_HOOK);
}
CAMLexport void caml_do_local_roots (scanning_action f, value *stack_low,