aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLalit Maganti <lalitm@google.com>2022-04-19 19:25:57 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-04-19 19:25:57 +0000
commit64a2404ff0c655397649f4e08468ea7cd1fd4fff (patch)
tree8aed3873a0aab9b9343633b9becad977cb441d72
parent70a0ac645246559478bcca5138a754a826abe3b3 (diff)
parent5aff7f62f8bd6c4d2936c2dddd5c0e9bc5c33eda (diff)
downloadperfetto-64a2404ff0c655397649f4e08468ea7cd1fd4fff.tar.gz
Merge "fuchsia_trace_parser: Fixed counter scope"
-rw-r--r--src/trace_processor/importers/fuchsia/fuchsia_trace_parser.cc10
-rw-r--r--test/trace_processor/fuchsia/fuchsia_smoke_type.out11
-rw-r--r--test/trace_processor/fuchsia/index1
-rw-r--r--test/trace_processor/fuchsia/smoke_type.sql21
4 files changed, 38 insertions, 5 deletions
diff --git a/src/trace_processor/importers/fuchsia/fuchsia_trace_parser.cc b/src/trace_processor/importers/fuchsia/fuchsia_trace_parser.cc
index 74de3181e..def414c7f 100644
--- a/src/trace_processor/importers/fuchsia/fuchsia_trace_parser.cc
+++ b/src/trace_processor/importers/fuchsia/fuchsia_trace_parser.cc
@@ -267,9 +267,8 @@ void FuchsiaTraceParser::ParseTracePacket(int64_t, TimestampedTracePiece ttp) {
break;
}
case kCounter: {
- UniqueTid utid =
- procs->UpdateThread(static_cast<uint32_t>(tinfo.tid),
- static_cast<uint32_t>(tinfo.pid));
+ UniquePid upid =
+ procs->GetOrCreateProcess(static_cast<uint32_t>(tinfo.pid));
std::string name_str =
context_->storage->GetString(name).ToStdString();
// Note: In the Fuchsia trace format, counter values are stored in the
@@ -315,8 +314,9 @@ void FuchsiaTraceParser::ParseTracePacket(int64_t, TimestampedTracePiece ttp) {
if (is_valid_value) {
StringId counter_name_id = context_->storage->InternString(
base::StringView(counter_name_str));
- TrackId track = context_->track_tracker->InternThreadCounterTrack(
- counter_name_id, utid);
+ TrackId track =
+ context_->track_tracker->InternProcessCounterTrack(
+ counter_name_id, upid);
context_->event_tracker->PushCounter(ts, counter_value, track);
}
}
diff --git a/test/trace_processor/fuchsia/fuchsia_smoke_type.out b/test/trace_processor/fuchsia/fuchsia_smoke_type.out
new file mode 100644
index 000000000..ba17fcfd3
--- /dev/null
+++ b/test/trace_processor/fuchsia/fuchsia_smoke_type.out
@@ -0,0 +1,11 @@
+"id","name","type"
+0,"[NULL]","thread_track"
+1,"[NULL]","thread_track"
+2,"[NULL]","thread_track"
+3,"[NULL]","thread_track"
+4,"[NULL]","thread_track"
+5,"cpu_usage:average_cpu_percentage","process_counter_track"
+6,"[NULL]","thread_track"
+7,"[NULL]","thread_track"
+8,"[NULL]","thread_track"
+9,"[NULL]","thread_track"
diff --git a/test/trace_processor/fuchsia/index b/test/trace_processor/fuchsia/index
index bb89b3020..05e4051bf 100644
--- a/test/trace_processor/fuchsia/index
+++ b/test/trace_processor/fuchsia/index
@@ -6,6 +6,7 @@
../../data/fuchsia_trace.fxt smoke_instants.sql fuchsia_smoke_instants.out
../../data/fuchsia_trace.fxt smoke_counters.sql fuchsia_smoke_counters.out
../../data/fuchsia_trace.fxt smoke_flow.sql fuchsia_smoke_flow.out
+../../data/fuchsia_trace.fxt smoke_type.sql fuchsia_smoke_type.out
# Smoke test a high-CPU trace.
../../data/fuchsia_workstation.fxt ../common/smoke_slices.sql fuchsia_workstation_smoke_slices.out
diff --git a/test/trace_processor/fuchsia/smoke_type.sql b/test/trace_processor/fuchsia/smoke_type.sql
new file mode 100644
index 000000000..4a29c1220
--- /dev/null
+++ b/test/trace_processor/fuchsia/smoke_type.sql
@@ -0,0 +1,21 @@
+--
+-- Copyright 2022 The Android Open Source Project
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- https://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+select
+ id,
+ name,
+ type
+from track
+limit 10;