Skip to content

Commit 5c17d4b

Browse files
committed
Merge branch 'main' into dev/annabauza/android_users_table_processor
Change-Id: I9a53d68a4ad475984f715f420d7cc498b987a053
2 parents 74eab85 + e9a9837 commit 5c17d4b

File tree

14 files changed

+374
-63
lines changed

14 files changed

+374
-63
lines changed

Android.bp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15327,6 +15327,7 @@ genrule {
1532715327
"src/trace_processor/perfetto_sql/stdlib/android/surfaceflinger.sql",
1532815328
"src/trace_processor/perfetto_sql/stdlib/android/suspend.sql",
1532915329
"src/trace_processor/perfetto_sql/stdlib/android/thread.sql",
15330+
"src/trace_processor/perfetto_sql/stdlib/android/user_list.sql",
1533015331
"src/trace_processor/perfetto_sql/stdlib/android/version.sql",
1533115332
"src/trace_processor/perfetto_sql/stdlib/android/wakeups.sql",
1533215333
"src/trace_processor/perfetto_sql/stdlib/android/winscope/inputmethod.sql",

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,6 +3233,7 @@ perfetto_filegroup(
32333233
"src/trace_processor/perfetto_sql/stdlib/android/surfaceflinger.sql",
32343234
"src/trace_processor/perfetto_sql/stdlib/android/suspend.sql",
32353235
"src/trace_processor/perfetto_sql/stdlib/android/thread.sql",
3236+
"src/trace_processor/perfetto_sql/stdlib/android/user_list.sql",
32363237
"src/trace_processor/perfetto_sql/stdlib/android/version.sql",
32373238
"src/trace_processor/perfetto_sql/stdlib/android/wakeups.sql",
32383239
],

src/trace_processor/perfetto_sql/stdlib/android/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ perfetto_sql_source_set("android") {
6262
"surfaceflinger.sql",
6363
"suspend.sql",
6464
"thread.sql",
65+
"user_list.sql",
6566
"version.sql",
6667
"wakeups.sql",
6768
]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--
2+
-- Copyright 22025 The Android Open Source Project
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- https://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
--
16+
17+
-- Android user list.
18+
--
19+
CREATE PERFETTO VIEW android_user_list (
20+
-- Android user id
21+
user_id LONG,
22+
-- User type
23+
type STRING
24+
) AS
25+
SELECT
26+
user_id,
27+
type
28+
FROM __intrinsic_user_list;

src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,6 @@ SELECT
194194
*
195195
FROM __intrinsic_thread;
196196

197-
-- Android users.
198-
--
199-
-- NOTE: sorted by Android user id
200-
CREATE PERFETTO VIEW android_users (
201-
-- Android user id
202-
uid LONG,
203-
-- User type
204-
type STRING
205-
) AS
206-
SELECT
207-
uid,
208-
type
209-
FROM __intrinsic_user_list;
210-
211197
-- Contains information of processes seen during the trace.
212198
CREATE PERFETTO VIEW process (
213199
-- The id of the process. Prefer using `upid` instead.

src/trace_processor/storage/trace_storage.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,12 @@ class TraceStorage {
548548
return &package_list_table_;
549549
}
550550

551-
const tables::UserListTable& user_list_table() const {
551+
const tables::AndroidUserListTable& user_list_table() const {
552552
return user_list_table_;
553553
}
554-
tables::UserListTable* mutable_user_list_table() { return &user_list_table_; }
554+
tables::AndroidUserListTable* mutable_user_list_table() {
555+
return &user_list_table_;
556+
}
555557

556558
const tables::AndroidGameInterventionListTable&
557559
android_game_intervention_list_table() const {
@@ -1194,7 +1196,7 @@ class TraceStorage {
11941196
tables::PerfSampleTable perf_sample_table_{&string_pool_};
11951197
tables::InstrumentsSampleTable instruments_sample_table_{&string_pool_};
11961198
tables::PackageListTable package_list_table_{&string_pool_};
1197-
tables::UserListTable user_list_table_{&string_pool_};
1199+
tables::AndroidUserListTable user_list_table_{&string_pool_};
11981200
tables::AndroidGameInterventionListTable
11991201
android_game_intervention_list_table_{&string_pool_};
12001202
tables::ProfilerSmapsTable profiler_smaps_table_{&string_pool_};

src/trace_processor/tables/profiler_tables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@
244244

245245
USER_LIST_TABLE = Table(
246246
python_module=__file__,
247-
class_name='UserListTable',
247+
class_name='AndroidUserListTable',
248248
sql_name='__intrinsic_user_list',
249249
columns=[
250250
C('type', CppString()),
251-
C('uid', CppInt64()),
251+
C('user_id', CppInt64()),
252252
],
253253
tabledoc=TableDoc(
254254
doc='''
@@ -258,7 +258,7 @@
258258
group='Misc',
259259
columns={
260260
'type': '''user type eg. SECONDARY''',
261-
'uid': '''User id on device''',
261+
'user_id': '''User id on device''',
262262
}))
263263

264264
STACK_PROFILE_MAPPING_TABLE = Table(
@@ -1172,13 +1172,13 @@
11721172
INSTRUMENTS_SAMPLE_TABLE,
11731173
HEAP_PROFILE_ALLOCATION_TABLE,
11741174
PACKAGE_LIST_TABLE,
1175-
USER_LIST_TABLE,
11761175
PERF_SAMPLE_TABLE,
11771176
PERF_SESSION_TABLE,
11781177
PROFILER_SMAPS_TABLE,
11791178
STACK_PROFILE_CALLSITE_TABLE,
11801179
STACK_PROFILE_FRAME_TABLE,
11811180
STACK_PROFILE_MAPPING_TABLE,
11821181
SYMBOL_TABLE,
1182+
USER_LIST_TABLE,
11831183
VULKAN_MEMORY_ALLOCATIONS_TABLE,
11841184
]

test/trace_processor/diff_tests/tables/tests.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,17 @@ def test_ftrace_user_list(self):
593593
return DiffTestBlueprint(
594594
trace=DataPath('trace_user_list.pftrace'),
595595
query="""
596+
INCLUDE PERFETTO MODULE android.user_list;
597+
598+
596599
SELECT
597-
uid,
600+
user_id,
598601
type
599-
FROM android_users
600-
ORDER BY uid;
602+
FROM android_user_list
603+
ORDER BY user_id;
601604
""",
602605
out=Csv("""
603-
"uid","type"
606+
"user_id","type"
604607
0,"android.os.usertype.system.HEADLESS"
605608
10,"android.os.usertype.full.SECONDARY"
606609
11,"android.os.usertype.full.GUEST"

0 commit comments

Comments
 (0)