diff --git a/src/trace_processor/importers/ftrace/ftrace_parser.cc b/src/trace_processor/importers/ftrace/ftrace_parser.cc index 2f0be1fad0..7b6679e0b8 100644 --- a/src/trace_processor/importers/ftrace/ftrace_parser.cc +++ b/src/trace_processor/importers/ftrace/ftrace_parser.cc @@ -66,6 +66,7 @@ #include "protos/perfetto/trace/ftrace/oom.pbzero.h" #include "protos/perfetto/trace/ftrace/power.pbzero.h" #include "protos/perfetto/trace/ftrace/raw_syscalls.pbzero.h" +#include "protos/perfetto/trace/ftrace/samsung.pbzero.h" #include "protos/perfetto/trace/ftrace/sched.pbzero.h" #include "protos/perfetto/trace/ftrace/scm.pbzero.h" #include "protos/perfetto/trace/ftrace/sde.pbzero.h" @@ -799,6 +800,10 @@ util::Status FtraceParser::ParseFtraceEvent(uint32_t cpu, ParseG2dTracingMarkWrite(ts, pid, fld_bytes); break; } + case FtraceEvent::kSamsungTracingMarkWriteFieldNumber: { + ParseSamsungTracingMarkWrite(ts, pid, fld_bytes); + break; + } case FtraceEvent::kDpuTracingMarkWriteFieldNumber: { ParseDpuTracingMarkWrite(ts, pid, fld_bytes); break; @@ -1375,6 +1380,22 @@ void FtraceParser::ParseSdeTracingMarkWrite(int64_t timestamp, evt.trace_name(), tgid, evt.value()); } +void FtraceParser::ParseSamsungTracingMarkWrite(int64_t timestamp, + uint32_t pid, + ConstBytes blob) { + protos::pbzero::SamsungTracingMarkWriteFtraceEvent::Decoder evt(blob.data, + blob.size); + if (!evt.has_trace_type()) { + context_->storage->IncrementStats(stats::systrace_parse_failure); + return; + } + + uint32_t tgid = static_cast(evt.pid()); + SystraceParser::GetOrCreate(context_)->ParseKernelTracingMarkWrite( + timestamp, pid, static_cast(evt.trace_type()), + false /*trace_begin*/, evt.trace_name(), tgid, evt.value()); +} + void FtraceParser::ParseDpuTracingMarkWrite(int64_t timestamp, uint32_t pid, ConstBytes blob) { diff --git a/src/trace_processor/importers/ftrace/ftrace_parser.h b/src/trace_processor/importers/ftrace/ftrace_parser.h index 4125c4736c..f65f3b888f 100644 --- a/src/trace_processor/importers/ftrace/ftrace_parser.h +++ b/src/trace_processor/importers/ftrace/ftrace_parser.h @@ -84,6 +84,9 @@ class FtraceParser { void ParseG2dTracingMarkWrite(int64_t timestamp, uint32_t pid, protozero::ConstBytes); + void ParseSamsungTracingMarkWrite(int64_t timestamp, + uint32_t pid, + protozero::ConstBytes); void ParseMaliTracingMarkWrite(int64_t timestamp, uint32_t pid, protozero::ConstBytes); diff --git a/src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc b/src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc index 0b9a7f21bf..25dd5e63ac 100644 --- a/src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc +++ b/src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc @@ -39,6 +39,7 @@ #include "protos/perfetto/trace/ftrace/irq.pbzero.h" #include "protos/perfetto/trace/ftrace/mdss.pbzero.h" #include "protos/perfetto/trace/ftrace/power.pbzero.h" +#include "protos/perfetto/trace/ftrace/samsung.pbzero.h" #include "protos/perfetto/trace/ftrace/sched.pbzero.h" #include "protos/perfetto/trace/ftrace/workqueue.pbzero.h" @@ -471,6 +472,20 @@ void ArgsSerializer::SerializeArgs() { writer_->AppendString("|"); WriteValueForField(TMW::kValueFieldNumber, DVW()); return; + } else if (event_name_ == "samsung_tracing_mark_write") { + using TMW = protos::pbzero::SamsungTracingMarkWriteFtraceEvent; + WriteValueForField( + TMW::kTraceTypeFieldNumber, [this](const Variadic& value) { + PERFETTO_DCHECK(value.type == Variadic::Type::kUint); + writer_->AppendChar(static_cast(value.uint_value)); + }); + writer_->AppendString("|"); + WriteValueForField(TMW::kPidFieldNumber, DVW()); + writer_->AppendString("|"); + WriteValueForField(TMW::kTraceNameFieldNumber, DVW()); + writer_->AppendString("|"); + WriteValueForField(TMW::kValueFieldNumber, DVW()); + return; } else if (event_name_ == "cgroup_attach_task") { using CAT = protos::pbzero::CgroupAttachTaskFtraceEvent; WriteArgForField(CAT::kDstRootFieldNumber, DVW());