Skip to content

Commit

Permalink
Merge "to_ftrace: add samsung_tracing_mark_write" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LalitMaganti authored and Gerrit Code Review committed Sep 25, 2023
2 parents e474193 + 89f821b commit 775b8e3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
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 775b8e3

Please sign in to comment.