Skip to content

Commit 9082966

Browse files
tracing examples moved out of tests
(some CI failures were observed)
1 parent 564ed6d commit 9082966

File tree

14 files changed

+38
-33
lines changed

14 files changed

+38
-33
lines changed

dune

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; marking those as data-only so that CIs and other automated systems don't try
2+
;; to build
3+
(data_only_dirs examples)

examples/stall_detection/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Stall detector
2+
3+
In this directory is a demo for live-monitoring runtime-events and detecting
4+
stalls (extended periods of time when the Lwt main loop is not entered).
5+
6+
Stalls happen when too many of the promises make too many blocking calls. In the
7+
example here (`Stallerlib.stall`) it's one promise which does increasingly long
8+
blocking calls to `Unix.sleepf`. Stalls can also happen with many short blocking
9+
calls (e.g., many promises logging to a file in a blocking way). Stalls
10+
can also happen if promises execute long computations.
11+
12+
## Detection
13+
14+
The detection relies on two mechanism. The first mechanism polls the runtime
15+
event ring to record the latest occurrence of Lwt scheduler's events. The second
16+
mechanism checks that this latest occurrence is recent enough.
17+
18+
## selfdetector
19+
20+
The `selfdetector.ml` file shows how to run the detector in the same process as
21+
the Lwt code. It runs in a separate domain so it executes in parallel.
22+
23+
## staller + detector
24+
25+
The `stall-detect.sh` runs separate processes for the Lwt-based program which
26+
stalls and a program which monitors the events of the first process.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/tracing/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Tail tracing
2+
3+
This is a demo for producing a tail-trace for an Lwt program. The Lwt program
4+
emits tracing events as introduced by the ppx. A separate program monitors the
5+
execution of the Lwt program process and, upon a crash, it gets the content of
6+
the events ring-buffer and dumps it into a perfetto-compatible format.
7+
8+
The produced trace shows the trace of execution for the end of the program, the
9+
part leading to its crash. This is called "tail tracing."
File renamed without changes.

0 commit comments

Comments
 (0)