add perfetto with single .proto file, parts of it commented

we only want to encode data, and only part of it, so we can skip
some java-specific messages, as well as the whole Ftrace subsystem.
This commit is contained in:
Simon Cruanes 2025-11-04 13:21:49 -05:00
parent 15edb582d0
commit 5e69650534
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
8 changed files with 94602 additions and 0 deletions

View file

@ -14,6 +14,9 @@ test-autopromote:
doc:
@dune build $(DUNE_OPTS) @doc
genproto:
FORCE_GENPROTO=true dune build @lint --auto-promote
WATCH?= @install @runtest
watch:
dune build $(DUNE_OPTS) -w $(WATCH)

View file

@ -94,4 +94,23 @@
(tags
(trace tracing fuchsia)))
(package
(name trace-perfetto)
(synopsis
"A backend for trace based on perfetto's protobuf format")
(depends
(ocaml
(>= 4.08))
(trace
(= :version))
(mtime
(>= 2.0))
(thread-local-storage
(>= 0.2))
pbrt
dune)
(tags
(trace tracing perfetto)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

6
src/perfetto/README.md Normal file
View file

@ -0,0 +1,6 @@
## NOTES
- to generate, `make genproto` in root directory. Pay attention to the version of `ocaml-protoc`.
- we commented some parts that are not really relevant to reduce the size of the code.

25
src/perfetto/dune Normal file
View file

@ -0,0 +1,25 @@
(library
(name trace_perfetto)
(public_name trace-perfetto)
(synopsis
"A high-performance backend for trace, emitting a Fuchsia trace into a file")
(libraries
trace.core
trace.private.util
trace.subscriber
thread-local-storage
mtime
mtime.clock.os
pbrt
))
(rule
(alias lint)
(mode promote)
(enabled_if %{env:FORCE_GENPROTO=false})
(targets perfetto_trace.ml perfetto_trace.mli)
(deps
(:file perfetto_trace.proto))
(action
(run ocaml-protoc %{file} --ml_out . --encode-only --pp --make --binary)))

49960
src/perfetto/perfetto_trace.ml Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

36
trace-perfetto.opam Normal file
View file

@ -0,0 +1,36 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.10"
synopsis: "A backend for trace based on perfetto's protobuf format"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]
license: "MIT"
tags: ["trace" "tracing" "perfetto"]
homepage: "https://github.com/c-cube/ocaml-trace"
bug-reports: "https://github.com/c-cube/ocaml-trace/issues"
depends: [
"ocaml" {>= "4.08"}
"trace" {= version}
"mtime" {>= "2.0"}
"thread-local-storage" {>= "0.2"}
"pbrt"
"dune" {>= "2.9"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"--promote-install-files=false"
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
["dune" "install" "-p" name "--create-install-files" name]
]
dev-repo: "git+https://github.com/c-cube/ocaml-trace.git"