Skip to content
Merged
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
37 changes: 34 additions & 3 deletions proto/psh.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,33 @@ message SendHostInfoReq {

message Task {
string id = 1;
bytes wasm = 2;
repeated string wasm_args = 3;
// Number of non-leap-milliseconds since Jan 1, 1970 UTC.
uint64 end_time = 4;
uint64 end_time = 2;

oneof task_type {
WasmTask wasm = 3;
ProfilingTask profiling = 4;
}

message WasmTask {
bytes wasm = 1;
repeated string wasm_args = 2;
}

message ProfilingTask {
oneof process {
Unit any = 1;
Unit current = 2;
uint32 pid = 3;
}

uint64 mmap_pages = 4;
optional uint32 stack_depth = 5;
oneof overflow_by {
uint64 period = 6;
uint64 freq = 7;
}
}
}

message ExportDataReq {
Expand All @@ -61,6 +84,7 @@ message ExportDataReq {
FileData file = 1;
LineProtocolData line_protocol = 2;
PerfDataProto perf_data = 3;
ElfFile elf_file = 4;
}
}

Expand All @@ -74,3 +98,10 @@ message FileData {
message LineProtocolData {
bytes bytes = 1;
}

message ElfFile {
string filename = 1;
bytes build_id = 2;
string arch = 3; // use for disasm
bytes bytes = 4;
}
19 changes: 19 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ use self::perf_data_proto::{

tonic::include_proto!("psh.proto.instance");

impl From<crate::task::profiling_task::Process> for perf_event_rs::config::Process {
fn from(value: crate::task::profiling_task::Process) -> Self {
match value {
task::profiling_task::Process::Any(_) => Self::Any,
task::profiling_task::Process::Current(_) => Self::Current,
task::profiling_task::Process::Pid(pid) => Self::Pid(pid),
}
}
}

impl From<crate::task::profiling_task::OverflowBy> for perf_event_rs::sampling::OverflowBy {
fn from(value: crate::task::profiling_task::OverflowBy) -> Self {
match value {
task::profiling_task::OverflowBy::Period(p) => Self::Period(p),
task::profiling_task::OverflowBy::Freq(f) => Self::Freq(f),
}
}
}

impl From<std::net::Ipv6Addr> for Ipv6Addr {
fn from(value: std::net::Ipv6Addr) -> Self {
let ip = value.to_bits().to_be();
Expand Down
Loading