Skip to content

Commit 4789737

Browse files
nickysnRo6afF
andauthored
feat: binary trace format (#19)
* chore: moved runtime_tracing library to a subdirectory This is preparation for creating a workspace, which will contain the library and a command line tool. * chore: add Cargo.toml that defines the workspace * chore: cargo new runtime_tracing_cli * chore: added dependency to runtime_tracing in runtime_tracing_cli * chore: added dependency to capnp * chore: add build dependency to capnpc * feat: add trace.capnp * feat: added build.rs that compiles the .capnp file to a .rs file * feat: include the generated trace_capnp.rs file * feat: added address to ValueRecord::reference * feat: added RecordEvent.metadata to capnproto * feat: added functions for reading and writing capnproto trace files This is just a copy of the bulk conversion code from my command line json<->bin conversion tool. These are not fully integrated into the runtime_tracing library, yet. * feat: return vector of TraceLowLevelEvent in read_trace() * feat: read_trace takes an input parameter, instead of reading from stdin * feat: write_trace now takes an output parameter * feat: introduced TraceEventsFileFormat * feat: implemented TraceEventsFileFormat::Binary in Tracer::store_trace_events * feat: export TraceEventsFileFormat outside from the crate * feat: add header to the beginning of the binary file * feat: validate the header in read_trace() * feat: added dependency to clap in runtime_tracing_cli * feat: implemented the convert command in runtime_tracing_cli - capable of conversion between binary and json trace formats * chore: removed unused 'use' * fix: use write_all() instead of write() to write the header, since write() is not guaranteed to write the entire buffer * refactor: prettify the else .. if chain in determine_file_format_from_name * refactor: rm redundant 'static * refactor: use a slice instead of Vec<> for the write_trace parameter * ci: install capnproto * ci: run on all PRs * feat: add BigInt to the capnproto binary format * refactor: fn conv_typekind() replaced with a From<> trait implementation * refactor: fn conv_typekind2() also replaced with a From<> trait implementation --------- Co-authored-by: Ro6afF <[email protected]>
1 parent 2281e02 commit 4789737

File tree

12 files changed

+1138
-29
lines changed

12 files changed

+1138
-29
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [ "master" ]
66
pull_request:
7-
branches: [ "master" ]
87

98
env:
109
CARGO_TERM_COLOR: always
@@ -15,6 +14,8 @@ jobs:
1514

1615
steps:
1716
- uses: actions/checkout@v4
17+
- name: Install capnproto
18+
run: sudo apt-get install -y capnproto
1819
- name: Lint
1920
run: cargo clippy
2021

@@ -24,6 +25,8 @@ jobs:
2425

2526
steps:
2627
- uses: actions/checkout@v4
28+
- name: Install capnproto
29+
run: sudo apt-get install -y capnproto
2730
- name: Build
2831
run: cargo build --verbose
2932
- name: Run tests

Cargo.toml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
1-
[package]
2-
name = "runtime_tracing"
3-
version = "0.11.0"
4-
edition = "2021"
5-
authors = ["Metacraft Labs Ltd"]
6-
description = "A library for the schema and tracing helpers for the CodeTracer db trace format"
7-
readme = "README.md"
8-
repository = "https://github.com/metacraft-labs/runtime_tracing"
9-
license = "MIT"
10-
keywords = ["debugging", "development-tools"]
1+
[workspace]
2+
resolver = "2"
3+
members = ["runtime_tracing", "runtime_tracing_cli"]
114

12-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13-
14-
[dependencies]
15-
base64 = "0.22.1"
16-
num-traits = "0.2"
17-
num-derive = "0.4"
18-
serde = { version = "1.0", features = ["derive"] }
19-
serde_json = "1.0"
20-
serde_repr = "0.1"
21-
22-
[lib]
23-
name = "runtime_tracing"
24-
path = "src/lib.rs"
5+
[workspace.dependencies]
6+
runtime_tracing = { path = "runtime_tracing/" }

runtime_tracing/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "runtime_tracing"
3+
version = "0.11.0"
4+
edition = "2021"
5+
authors = ["Metacraft Labs Ltd"]
6+
description = "A library for the schema and tracing helpers for the CodeTracer db trace format"
7+
readme = "README.md"
8+
repository = "https://github.com/metacraft-labs/runtime_tracing"
9+
license = "MIT"
10+
keywords = ["debugging", "development-tools"]
11+
build = "build.rs"
12+
13+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
14+
15+
[dependencies]
16+
base64 = "0.22.1"
17+
num-traits = "0.2"
18+
num-derive = "0.4"
19+
serde = { version = "1.0", features = ["derive"] }
20+
serde_json = "1.0"
21+
serde_repr = "0.1"
22+
capnp = "0.21.1"
23+
24+
[build-dependencies]
25+
capnpc = "0.21.0"
26+
27+
[lib]
28+
name = "runtime_tracing"
29+
path = "src/lib.rs"

runtime_tracing/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() {
2+
::capnpc::CompilerCommand::new()
3+
.file("src/trace.capnp")
4+
.run()
5+
.expect("compiling schema")
6+
}
File renamed without changes.

0 commit comments

Comments
 (0)