Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

75 changes: 36 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ jobs:
with:
submodules: true

- name: Use OCaml 5.1.0
uses: ocaml/setup-ocaml@v2
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ocaml-base-compiler.5.1.0
opam-repositories: |
default: https://github.com/ocaml/opam-repository.git
dune-cache: true
ocaml-compiler: 5

- name: Meio Deps 🐈‍⬛
run: | # notty is pinned to hardcode the tty size (160 * 40)
Expand All @@ -32,36 +29,36 @@ jobs:
- name: Build
run: opam exec -- dune build @all

- name: Update asciicast dependencies
run: |
go install github.com/TheLortex/asciiscript@latest
sudo apt install asciinema fonts-firacode

- name: Run asciicast and convert to GIF
run: |
export PATH=${PATH}:`go env GOPATH`/bin
export TERM=xterm-256color
sudo sed -i 's/return os\.get_terminal_size()/return (160, 40)/' /usr/lib/python3/dist-packages/asciinema/term.py
asciiscript .screencast/example.sh .screencast/example.cast --overwrite
wget https://github.com/asciinema/agg/releases/download/v1.4.1/agg-x86_64-unknown-linux-gnu -O agg
echo "3c933591d396d22355a37ff40b4259c8b1e2de8f896cf8c7dec1fab72e5f527e agg" | sha256sum --check
chmod +x agg
./agg .screencast/example.cast .screencast/example.gif --font-family "Fira Code" --font-size=18

- uses: actions/upload-artifact@v3
with:
name: asciicast
path: |
.screencast/example.cast
.screencast/example.gif

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
if: ${{ github.event_name == 'push' }}
with:
add-paths: .screencast/example.gif
commit-message: Update screencast
title: Update screencast
body: |
_Generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) Github action_
labels: ci
# - name: Update asciicast dependencies
# run: |
# go install github.com/TheLortex/asciiscript@latest
# sudo apt install asciinema fonts-firacode
#
# - name: Run asciicast and convert to GIF
# run: |
# export PATH=${PATH}:`go env GOPATH`/bin
# export TERM=xterm-256color
# sudo sed -i 's/return os\.get_terminal_size()/return (160, 40)/' /usr/lib/python3/dist-packages/asciinema/term.py
# asciiscript .screencast/example.sh .screencast/example.cast --overwrite
# wget https://github.com/asciinema/agg/releases/download/v1.4.1/agg-x86_64-unknown-linux-gnu -O agg
# echo "3c933591d396d22355a37ff40b4259c8b1e2de8f896cf8c7dec1fab72e5f527e agg" | sha256sum --check
# chmod +x agg
# ./agg .screencast/example.cast .screencast/example.gif --font-family "Fira Code" --font-size=18
#
# - uses: actions/upload-artifact@v3
# with:
# name: asciicast
# path: |
# .screencast/example.cast
# .screencast/example.gif
#
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v5
# if: ${{ github.event_name == 'push' }}
# with:
# add-paths: .screencast/example.gif
# commit-message: Update screencast
# title: Update screencast
# body: |
# _Generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) Github action_
# labels: ci
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.25.1
version=0.26.0
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(lang dune 2.9)
(name ec)
(name meio)
15 changes: 7 additions & 8 deletions example/burn.ml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
open Eio

let woops_sleepy ~clock =
Private.Ctf.set_name "sleeper";
Switch.run ~name:"sleeper" @@ fun sw ->
Switch.run ~name:"unix sleeper ctx" @@ fun sw ->
Fiber.fork ~sw (fun () ->
Private.Ctf.set_name "unix sleeper";
Eio_name.name "unix sleeper";
(* Woops! Wrong sleep function, we blocked the fiber *)
traceln "Woops! Blocked by Unix.sleepf";
Unix.sleepf 5.;
Time.sleep clock 10.)

let spawn ~clock min max =
Private.Ctf.set_name (Fmt.str "spawn %d %d" min max);
Eio_name.name (Fmt.str "spawn %d %d" min max);
(* Some GC action *)
for _i = 0 to 100 do
ignore (Sys.opaque_identity @@ Array.init 1000000 float_of_int)
done;
Switch.run @@ fun sw ->
Switch.run ~name:"spawn ctx" @@ fun sw ->
for i = min to max do
Fiber.fork ~sw (fun () ->
Private.Ctf.set_name (Fmt.str "worker>%d" i);
Eio_name.name (Fmt.str "worker>%d" i);
for i = 0 to max do
(* Some more GC action *)
for _i = 0 to 100 do
Expand All @@ -37,9 +36,10 @@ let spawn ~clock min max =
let main clock =
let p, r = Promise.create () in
Switch.run ~name:"main" @@ fun sw ->
Eio_name.name "main fiber";
(* A long running task *)
Fiber.fork ~sw (fun () ->
Private.Ctf.set_name "waiter";
Eio_name.name "waiter";
traceln "stuck waiting :(";
Promise.await p;
traceln "Done");
Expand All @@ -53,6 +53,5 @@ let main clock =

let () =
Eio_main.run @@ fun env ->
Ctf.with_tracing @@ fun () ->
let clock = Stdenv.clock env in
main clock
1 change: 0 additions & 1 deletion example/burn_domains.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ let main dom_mgr clock =

let () =
Eio_main.run @@ fun env ->
Ctf.with_tracing @@ fun () ->
let clock = Stdenv.clock env in
let dom_mgr = Stdenv.domain_mgr env in
main dom_mgr clock
2 changes: 1 addition & 1 deletion example/deadlock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let fork wait =
Switch.run @@ fun sw ->
Fiber.fork ~sw (fun () ->
(* Also add a really big label to test the handling of that in CTF. *)
Eio.Private.Ctf.log (String.make 5000 'e');
Eio_name.name (String.make 5000 'e');
Promise.await wait)

let main () =
Expand Down
8 changes: 7 additions & 1 deletion example/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
(executables
(names main deadlock burn burn_domains)
(libraries astring eio eio_main unix eio.unix))
(modules :standard \ eio_name)
(libraries astring eio eio_main unix eio.unix eio_name))

(library
(name eio_name)
(modules eio_name)
(libraries eio))
3 changes: 3 additions & 0 deletions example/eio_name.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let name s =
let ctx = Effect.perform Eio.Private.Effects.Get_context in
Eio.Private.Trace.name (Eio.Private.Fiber_context.tid ctx) s
1 change: 0 additions & 1 deletion example/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ let main clock =

let () =
Eio_main.run @@ fun env ->
Ctf.with_tracing @@ fun () ->
let clock = Stdenv.clock env in
main clock
7 changes: 3 additions & 4 deletions example/zero.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ let main clock =
(* Eio.Switch.run ~name:"forked context" @@ fun sw ->
traceln "in another context I do this" *)) *)
(* for i = 0 to 10 do
Eio.Switch.run ~name:(Fmt.str "switch %d" i) @@ fun sw ->
traceln "welcome %d" i
done; *)
Eio.Switch.run ~name:(Fmt.str "switch %d" i) @@ fun sw ->
traceln "welcome %d" i
done; *)
Eio.Time.sleep clock 100000.0

let () =
Eio_main.run @@ fun env ->
Ctf.with_tracing @@ fun () ->
let clock = Stdenv.clock env in
main clock
17 changes: 5 additions & 12 deletions meio.opam
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
opam-version: "2.0"
synopsis: "Monitor live Eio programs"
description:
"Eio-console provides an executable that allows you to monitor OCaml programs using Eventring."
"Meio provides an executable that allows you to monitor OCaml programs using Eventring."
maintainer: ["patrick@sirref.org"]
authors: ["Patrick Ferris"]
license: "MIT"
homepage: "https://github.com/ocaml-multicore/meio"
bug-reports: "https://github.com/ocaml-multicore/meio/issues"
depends: [
"dune" {>= "2.9"}
"dune" {>= "3.10"}
"eio_main"
"eio"
"eio" {>= "0.14"}
"astring"
"ptime"
"nottui"
"nottui-unix"
"logs"
"cmdliner"
"hdr_histogram"
Expand All @@ -35,11 +35,4 @@ build: [
]
["dune" "install" "-p" name "--create-install-files" name]
]
dev-repo: "git+https://github.com/ocaml-multicore/meio.git"
pin-depends: [
# Rebased version of https://github.com/TheLortex/eio/tree/runtime-events
["eio.dev" "git+https://github.com/tmcgilchrist/eio#48fa41f1c6d915fc39848a406aed8c8a49cc25ba"]
["eio_main.dev" "git+https://github.com/tmcgilchrist/eio#48fa41f1c6d915fc39848a406aed8c8a49cc25ba"]
["eio_linux.dev" "git+https://github.com/tmcgilchrist/eio#48fa41f1c6d915fc39848a406aed8c8a49cc25ba"]
["eio_posix.dev" "git+https://github.com/tmcgilchrist/eio#48fa41f1c6d915fc39848a406aed8c8a49cc25ba"]
]
dev-repo: "git+https://github.com/ocaml-multicore/meio.git"
4 changes: 3 additions & 1 deletion src/bin/meio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ let run _stdenv exec_args =
|]
(Unix.environment ())
in
let dev_null = Unix.openfile Filename.null [ Unix.O_WRONLY; Unix.O_KEEPEXEC ] 0o666 in
let dev_null =
Unix.openfile Filename.null [ Unix.O_WRONLY; Unix.O_KEEPEXEC ] 0o666
in
let child_pid =
Unix.create_process_env executable_filename argsl env Unix.stdin dev_null
dev_null
Expand Down
10 changes: 5 additions & 5 deletions src/lib/console.ml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ let render_tree_line ~filtered depth is_active attr =
|> Ui.hcat

let render_task sort now ~depth ~filtered
({ Task.id; domain; start; loc; name; busy; selected; status; kind; _ } as
t) =
({ Task.id; domain; start; loc; name; busy; selected; status; kind; _ } as t)
=
let is_active = Task.is_active t in
let attr = attr' !selected is_active in
let attr =
Expand Down Expand Up @@ -147,9 +147,9 @@ let render_task sort now ~depth ~filtered
let kind =
W.string ~attr
(match kind with
| Cancellation_context _ -> "cc"
| Task -> "task"
| _ -> "??")
| `Create (_, `Cc _) -> "cc"
| `Create (_, `Fiber_in _) -> "task"
| _ -> Fmt.str "%a" Eio_runtime_events.pp_event kind)
in
(attr, !selected, [ domain; id; kind; name; busy; idle; entered; loc ], t)

Expand Down
10 changes: 9 additions & 1 deletion src/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
(foreign_stubs
(language c)
(names meio_console_stubs))
(libraries eio eio.utils runtime_events ptime logs nottui hdr_histogram))
(libraries
eio
eio.utils
runtime_events
eio.runtime_events
ptime
logs
nottui-unix
hdr_histogram))
2 changes: 1 addition & 1 deletion src/lib/help.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let footer sort screen =
space;
key_help ~attr:(attr `Task) 'e' "Fiber info";
space;
key_help ~attr:(attr `Logs) 'l' ("Logs");
key_help ~attr:(attr `Logs) 'l' "Logs";
space;
key_help 's' ("Sort " ^ Sort.to_string sort);
space;
Expand Down
Loading