Skip to content

Commit

Permalink
to_ftrace: add samsung_tracing_mark_write
Browse files Browse the repository at this point in the history
Bug: 291512082
Signed-off-by: Jaewon Kim <[email protected]>
Change-Id: I1f5448a44c522c252a3d5d54f6900831ab281327
  • Loading branch information
Jaewon31Kim committed Sep 19, 2023
1 parent 4201d29 commit 89f821b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/trace_processor/importers/ftrace/ftrace_descriptors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace perfetto {
namespace trace_processor {
namespace {

std::array<FtraceMessageDescriptor, 484> descriptors{{
std::array<FtraceMessageDescriptor, 485> descriptors{{
{nullptr, 0, {}},
{nullptr, 0, {}},
{nullptr, 0, {}},
Expand Down Expand Up @@ -5323,6 +5323,18 @@ std::array<FtraceMessageDescriptor, 484> descriptors{{
{"info_val", ProtoSchemaType::kUint64},
},
},
{
"samsung_tracing_mark_write",
5,
{
{},
{"pid", ProtoSchemaType::kInt32},
{"trace_name", ProtoSchemaType::kString},
{"trace_begin", ProtoSchemaType::kUint32},
{"trace_type", ProtoSchemaType::kUint32},
{"value", ProtoSchemaType::kInt32},
},
},
}};

} // namespace
Expand Down
21 changes: 21 additions & 0 deletions src/trace_processor/importers/ftrace/ftrace_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<uint32_t>(evt.pid());
SystraceParser::GetOrCreate(context_)->ParseKernelTracingMarkWrite(
timestamp, pid, static_cast<char>(evt.trace_type()),
false /*trace_begin*/, evt.trace_name(), tgid, evt.value());
}

void FtraceParser::ParseDpuTracingMarkWrite(int64_t timestamp,
uint32_t pid,
ConstBytes blob) {
Expand Down
3 changes: 3 additions & 0 deletions src/trace_processor/importers/ftrace/ftrace_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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<char>(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());
Expand Down

0 comments on commit 89f821b

Please sign in to comment.