aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_thr_queue.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-04-06 17:27:17 +0200
committerBjörn-Egil Dahlberg <[email protected]>2016-04-06 17:27:17 +0200
commit2ea950f70bb3c2bee32be7f98442df8d8d2f008a (patch)
tree0438b76786bb8c1aac788600a85e1856aa7acbf1 /erts/emulator/beam/erl_thr_queue.c
parentdc599847686a683441617eb507539d68dab88d6b (diff)
parent58762e934f603b3fe036aa3b9d8a5930b77ae5f1 (diff)
downloadotp-2ea950f70bb3c2bee32be7f98442df8d8d2f008a.tar.gz
otp-2ea950f70bb3c2bee32be7f98442df8d8d2f008a.tar.bz2
otp-2ea950f70bb3c2bee32be7f98442df8d8d2f008a.zip
Merge branch 'egil/erts/tracing-beam-lttng/OTP-10282'
* egil/erts/tracing-beam-lttng/OTP-10282: erts: Don't use ratio in carrier lttng tracepoints Add lttng testcases erts: Extend erlang:system_info/1 with lttng Refactor and fix dtrace define in erl_message erts: Add lttng tracepoints for async pool queue erts: Add lttng tracepoints for drivers erts: Add lttng tracepoints for scheduler events erts: Add lttng tracepoints for memory carriers erts: Update lttng-wrapper with mfa conversion erts: Teach lttng to configure and build system
Diffstat (limited to 'erts/emulator/beam/erl_thr_queue.c')
-rw-r--r--erts/emulator/beam/erl_thr_queue.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_thr_queue.c b/erts/emulator/beam/erl_thr_queue.c
index 7ff456b915..30c9d70c59 100644
--- a/erts/emulator/beam/erl_thr_queue.c
+++ b/erts/emulator/beam/erl_thr_queue.c
@@ -780,3 +780,35 @@ erts_thr_q_dequeue(ErtsThrQ_t *q)
return res;
#endif
}
+
+#ifdef USE_LTTNG_VM_TRACEPOINTS
+int
+erts_thr_q_length_dirty(ErtsThrQ_t *q)
+{
+ int n = 0;
+#ifndef USE_THREADS
+ void *res;
+ ErtsThrQElement_t *tmp;
+
+ for (tmp = q->first; tmp != NULL; tmp = tmp->next) {
+ n++;
+ }
+#else
+ ErtsThrQElement_t *e;
+ erts_aint_t inext;
+
+ e = ErtsThrQDirtyReadEl(&q->head.head);
+ inext = erts_atomic_read_acqb(&e->next);
+
+ while (inext != ERTS_AINT_NULL) {
+ e = (ErtsThrQElement_t *) inext;
+ if (e != &q->tail.data.marker) {
+ /* don't count marker */
+ n++;
+ }
+ inext = erts_atomic_read_acqb(&e->next);
+ }
+#endif
+ return n;
+}
+#endif