diff --git a/proto/psh.proto b/proto/psh.proto index 4e3a591..a86f997 100644 --- a/proto/psh.proto +++ b/proto/psh.proto @@ -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 { @@ -61,6 +84,7 @@ message ExportDataReq { FileData file = 1; LineProtocolData line_protocol = 2; PerfDataProto perf_data = 3; + ElfFile elf_file = 4; } } @@ -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; +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index a7fdc9d..37002d0 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -9,6 +9,25 @@ use self::perf_data_proto::{ tonic::include_proto!("psh.proto.instance"); +impl From 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 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 for Ipv6Addr { fn from(value: std::net::Ipv6Addr) -> Self { let ip = value.to_bits().to_be();