Skip to content

Commit

Permalink
Merge "Make the perf importer more robust against unknown CPU modes" …
Browse files Browse the repository at this point in the history
…into main
Treehugger Robot authored and Gerrit Code Review committed Jul 18, 2024
2 parents c65134e + 6826a29 commit c039d2a
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/trace_processor/importers/perf/record_parser.cc
Original file line number Diff line number Diff line change
@@ -73,14 +73,13 @@ CreateMappingParams BuildCreateMappingParams(

bool IsInKernel(protos::pbzero::Profiling::CpuMode cpu_mode) {
switch (cpu_mode) {
case protos::pbzero::Profiling::MODE_UNKNOWN:
PERFETTO_FATAL("Unknown CPU mode");
case protos::pbzero::Profiling::MODE_GUEST_KERNEL:
case protos::pbzero::Profiling::MODE_KERNEL:
return true;
case protos::pbzero::Profiling::MODE_USER:
case protos::pbzero::Profiling::MODE_HYPERVISOR:
case protos::pbzero::Profiling::MODE_GUEST_USER:
case protos::pbzero::Profiling::MODE_UNKNOWN:
return false;
}
PERFETTO_FATAL("For GCC.");
@@ -161,6 +160,11 @@ base::Status RecordParser::InternSample(Sample sample) {
"Can not parse samples with no PERF_SAMPLE_TID field");
}

if (sample.cpu_mode ==
protos::pbzero::perfetto_pbzero_enum_Profiling::MODE_UNKNOWN) {
context_->storage->IncrementStats(stats::perf_samples_cpu_mode_unknown);
}

UniqueTid utid = context_->process_tracker->UpdateThread(sample.pid_tid->tid,
sample.pid_tid->pid);
const auto upid = *context_->storage->thread_table()
1 change: 1 addition & 0 deletions src/trace_processor/storage/stats.h
Original file line number Diff line number Diff line change
@@ -273,6 +273,7 @@ namespace stats {
F(perf_samples_skipped, kSingle, kError, kAnalysis, ""), \
F(perf_counter_skipped_because_no_cpu, kSingle, kError, kAnalysis, ""), \
F(perf_features_skipped, kIndexed, kInfo, kAnalysis, ""), \
F(perf_samples_cpu_mode_unknown, kSingle, kError, kAnalysis, ""), \
F(perf_samples_skipped_dataloss, kSingle, kDataLoss, kTrace, ""), \
F(perf_dummy_mapping_used, kSingle, kInfo, kAnalysis, ""), \
F(perf_invalid_event_id, kSingle, kError, kTrace, ""), \

0 comments on commit c039d2a

Please sign in to comment.