Merge "Add cpu_frequency event parsing"
diff --git a/src/trace_processor/importers/systrace/systrace_line_parser.cc b/src/trace_processor/importers/systrace/systrace_line_parser.cc
index 9120e65..16b6eb8 100644
--- a/src/trace_processor/importers/systrace/systrace_line_parser.cc
+++ b/src/trace_processor/importers/systrace/systrace_line_parser.cc
@@ -41,6 +41,7 @@
rss_stat_tracker_(context_),
sched_wakeup_name_id_(ctx->storage->InternString("sched_wakeup")),
sched_waking_name_id_(ctx->storage->InternString("sched_waking")),
+ cpufreq_name_id_(ctx->storage->InternString("cpufreq")),
cpuidle_name_id_(ctx->storage->InternString("cpuidle")),
workqueue_name_id_(ctx->storage->InternString("workqueue")),
sched_blocked_reason_id_(
@@ -123,6 +124,19 @@
context_->args_tracker->AddArgsTo(instant_id)
.AddArg(waker_utid_id_, Variadic::UnsignedInteger(utid));
+ } else if (line.event_name == "cpu_frequency") {
+ base::Optional<uint32_t> event_cpu = base::StringToUInt32(args["cpu_id"]);
+ base::Optional<double> new_state = base::StringToDouble(args["state"]);
+ if (!event_cpu.has_value()) {
+ return util::Status("Could not convert event cpu");
+ }
+ if (!event_cpu.has_value()) {
+ return util::Status("Could not convert state");
+ }
+
+ TrackId track = context_->track_tracker->InternCpuCounterTrack(
+ cpufreq_name_id_, event_cpu.value());
+ context_->event_tracker->PushCounter(line.ts, new_state.value(), track);
} else if (line.event_name == "cpu_idle") {
base::Optional<uint32_t> event_cpu = base::StringToUInt32(args["cpu_id"]);
base::Optional<double> new_state = base::StringToDouble(args["state"]);
diff --git a/src/trace_processor/importers/systrace/systrace_line_parser.h b/src/trace_processor/importers/systrace/systrace_line_parser.h
index 24331fe..126fca7 100644
--- a/src/trace_processor/importers/systrace/systrace_line_parser.h
+++ b/src/trace_processor/importers/systrace/systrace_line_parser.h
@@ -39,6 +39,7 @@
const StringId sched_wakeup_name_id_ = kNullStringId;
const StringId sched_waking_name_id_ = kNullStringId;
+ const StringId cpufreq_name_id_ = kNullStringId;
const StringId cpuidle_name_id_ = kNullStringId;
const StringId workqueue_name_id_ = kNullStringId;
const StringId sched_blocked_reason_id_ = kNullStringId;