Skip to content

Commit 82a676b

Browse files
committed
Merge branch 'main' into dev/annabauza/android_users_table_probes
Change-Id: I4a9687985a2c7a7cb84da0b74ead53e96aa1cfda
2 parents 6debdb1 + b183e61 commit 82a676b

File tree

120 files changed

+3404
-2516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+3404
-2516
lines changed

Android.bp

Lines changed: 66 additions & 2 deletions
Large diffs are not rendered by default.

BUILD

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,8 @@ perfetto_cc_library(
715715
":src_traced_probes_sys_stats_sys_stats",
716716
":src_traced_probes_system_info_cpu_info_features_allowlist",
717717
":src_traced_probes_system_info_system_info",
718+
":src_traced_probes_user_list_user_list",
719+
":src_traced_probes_user_list_user_list_parser",
718720
":src_tracing_ipc_producer_producer",
719721
],
720722
}),
@@ -2177,8 +2179,8 @@ perfetto_filegroup(
21772179
"src/trace_processor/importers/perf/perf_event.h",
21782180
"src/trace_processor/importers/perf/perf_event_attr.cc",
21792181
"src/trace_processor/importers/perf/perf_event_attr.h",
2180-
"src/trace_processor/importers/perf/perf_session.cc",
2181-
"src/trace_processor/importers/perf/perf_session.h",
2182+
"src/trace_processor/importers/perf/perf_invocation.cc",
2183+
"src/trace_processor/importers/perf/perf_invocation.h",
21822184
"src/trace_processor/importers/perf/reader.h",
21832185
"src/trace_processor/importers/perf/record.h",
21842186
],
@@ -4344,6 +4346,24 @@ perfetto_filegroup(
43444346
],
43454347
)
43464348

4349+
# GN target: //src/traced/probes/user_list:user_list
4350+
perfetto_filegroup(
4351+
name = "src_traced_probes_user_list_user_list",
4352+
srcs = [
4353+
"src/traced/probes/user_list/user_list_data_source.cc",
4354+
"src/traced/probes/user_list/user_list_data_source.h",
4355+
],
4356+
)
4357+
4358+
# GN target: //src/traced/probes/user_list:user_list_parser
4359+
perfetto_filegroup(
4360+
name = "src_traced_probes_user_list_user_list_parser",
4361+
srcs = [
4362+
"src/traced/probes/user_list/user_list_parser.cc",
4363+
"src/traced/probes/user_list/user_list_parser.h",
4364+
],
4365+
)
4366+
43474367
# GN target: //src/traced/probes:data_source
43484368
perfetto_filegroup(
43494369
name = "src_traced_probes_data_source",
@@ -5449,6 +5469,7 @@ perfetto_proto_library(
54495469
"protos/perfetto/config/android/protolog_config.proto",
54505470
"protos/perfetto/config/android/surfaceflinger_layers_config.proto",
54515471
"protos/perfetto/config/android/surfaceflinger_transactions_config.proto",
5472+
"protos/perfetto/config/android/user_list_config.proto",
54525473
"protos/perfetto/config/android/windowmanager_config.proto",
54535474
],
54545475
visibility = [
@@ -6265,6 +6286,7 @@ perfetto_proto_library(
62656286
"protos/perfetto/trace/android/network_trace.proto",
62666287
"protos/perfetto/trace/android/packages_list.proto",
62676288
"protos/perfetto/trace/android/pixel_modem_events.proto",
6289+
"protos/perfetto/trace/android/user_list.proto",
62686290
],
62696291
visibility = [
62706292
PERFETTO_CONFIG.proto_library_visibility,

CHANGELOG

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Unreleased:
44
by default (set it explicitly to false to revert to previous encoding,
55
which is now deprecated). This reduces trace size when recording events
66
that aren't know by perfetto at compile time.
7+
* SharedMemoryArbiter: Reduced CPU usage when tracing high-throughput
8+
workloads by preventing duplicate immediate flush tasks when the shared
9+
memory buffer is more than half full.
710
SQL Standard library:
811
*
912
Trace Processor:
@@ -24,7 +27,8 @@ Unreleased:
2427
from JSON traces. Processes and threads with lower sort index values
2528
will appear first in the UI.
2629
SDK:
27-
*
30+
* Reduced CPU usage when tracing high-throughput workloads by preventing
31+
duplicate immediate flush tasks in the shared memory arbiter.
2832

2933
v52.0 - 2025-09-16:
3034
Tracing service and probes:

TEST_MAPPING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
{
1414
"name": "CtsPerfettoTestCases"
1515
},
16+
{
17+
"name": "CtsPerfettoReporterTestCases"
18+
},
1619
// Additional presubmit tests that explicitly exercise
1720
// Perfetto's backend
1821
{

include/perfetto/ext/base/flags.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ namespace perfetto::base::flags {
4545
: NonAndroidPlatformDefault_FALSE) \
4646
X(use_rt_mutex, NonAndroidPlatformDefault_FALSE) \
4747
X(use_rt_futex, NonAndroidPlatformDefault_FALSE) \
48-
X(buffer_clone_preserve_read_iter, NonAndroidPlatformDefault_TRUE)
48+
X(buffer_clone_preserve_read_iter, NonAndroidPlatformDefault_TRUE) \
49+
X(sma_prevent_duplicate_immediate_flushes, NonAndroidPlatformDefault_TRUE)
4950

5051
////////////////////////////////////////////////////////////////////////////////
5152
// //

include/perfetto/public/protos/config/data_source_config.pzc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ PERFETTO_PB_MSG_DECL(perfetto_protos_SysStatsConfig);
6161
PERFETTO_PB_MSG_DECL(perfetto_protos_SystemInfoConfig);
6262
PERFETTO_PB_MSG_DECL(perfetto_protos_TestConfig);
6363
PERFETTO_PB_MSG_DECL(perfetto_protos_TrackEventConfig);
64+
PERFETTO_PB_MSG_DECL(perfetto_protos_UserListConfig);
6465
PERFETTO_PB_MSG_DECL(perfetto_protos_V8Config);
6566
PERFETTO_PB_MSG_DECL(perfetto_protos_VulkanMemoryConfig);
6667
PERFETTO_PB_MSG_DECL(perfetto_protos_WindowManagerConfig);
@@ -320,6 +321,11 @@ PERFETTO_PB_FIELD(perfetto_protos_DataSourceConfig,
320321
perfetto_protos_CpuPerUidConfig,
321322
cpu_per_uid_config,
322323
137);
324+
PERFETTO_PB_FIELD(perfetto_protos_DataSourceConfig,
325+
MSG,
326+
perfetto_protos_UserListConfig,
327+
user_list_config,
328+
138);
323329
PERFETTO_PB_FIELD(perfetto_protos_DataSourceConfig,
324330
STRING,
325331
const char*,

include/perfetto/public/protos/trace/trace_packet.pzc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ PERFETTO_PB_MSG_DECL(perfetto_protos_TransactionTraceEntry);
104104
PERFETTO_PB_MSG_DECL(perfetto_protos_TranslationTable);
105105
PERFETTO_PB_MSG_DECL(perfetto_protos_Trigger);
106106
PERFETTO_PB_MSG_DECL(perfetto_protos_UiState);
107+
PERFETTO_PB_MSG_DECL(perfetto_protos_UserList);
107108
PERFETTO_PB_MSG_DECL(perfetto_protos_V8CodeMove);
108109
PERFETTO_PB_MSG_DECL(perfetto_protos_V8InternalCode);
109110
PERFETTO_PB_MSG_DECL(perfetto_protos_V8JsCode);
@@ -564,6 +565,11 @@ PERFETTO_PB_FIELD(perfetto_protos_TracePacket,
564565
perfetto_protos_EvdevEvent,
565566
evdev_event,
566567
121);
568+
PERFETTO_PB_FIELD(perfetto_protos_TracePacket,
569+
MSG,
570+
perfetto_protos_UserList,
571+
user_list,
572+
123);
567573
PERFETTO_PB_FIELD(perfetto_protos_TracePacket,
568574
MSG,
569575
perfetto_protos_TestEvent,

perfetto_flags.aconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ flag {
5656
bug: "448604718"
5757
is_fixed_read_only: true
5858
}
59+
flag {
60+
name: "sma_prevent_duplicate_immediate_flushes"
61+
namespace: "perfetto"
62+
description: "Controls whether SharedMemoryArbiter will prevent posting duplicate immediate flush tasks when the shared memory buffer is more than half full. When enabled, only one immediate flush task is posted until it completes, preventing excessive CPU usage from task runner spam."
63+
bug: "330580374"
64+
is_fixed_read_only: true
65+
}

protos/perfetto/config/android/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ perfetto_proto_library("@TYPE@") {
3333
"protolog_config.proto",
3434
"surfaceflinger_layers_config.proto",
3535
"surfaceflinger_transactions_config.proto",
36+
"user_list_config.proto",
3637
"windowmanager_config.proto",
3738
]
3839
}

protos/perfetto/config/data_source_config.proto

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import "protos/perfetto/config/android/pixel_modem_config.proto";
3333
import "protos/perfetto/config/android/protolog_config.proto";
3434
import "protos/perfetto/config/android/surfaceflinger_layers_config.proto";
3535
import "protos/perfetto/config/android/surfaceflinger_transactions_config.proto";
36+
import "protos/perfetto/config/android/user_list_config.proto";
3637
import "protos/perfetto/config/android/windowmanager_config.proto";
3738
import "protos/perfetto/config/chrome/chrome_config.proto";
3839
import "protos/perfetto/config/chrome/v8_config.proto";
@@ -59,7 +60,7 @@ import "protos/perfetto/config/system_info/system_info_config.proto";
5960
import "protos/perfetto/config/chrome/histogram_samples.proto";
6061

6162
// The configuration that is passed to each data source when starting tracing.
62-
// Next id: 138
63+
// Next id: 139
6364
message DataSourceConfig {
6465
enum SessionInitiator {
6566
SESSION_INITIATOR_UNSPECIFIED = 0;
@@ -259,6 +260,9 @@ message DataSourceConfig {
259260
// Data source name: android.cpu_per_uid
260261
optional CpuPerUidConfig cpu_per_uid_config = 137 [lazy = true];
261262

263+
// Data source name: android.user_list
264+
optional UserListConfig user_list_config = 138 [lazy = true];
265+
262266
// This is a fallback mechanism to send a free-form text config to the
263267
// producer. In theory this should never be needed. All the code that
264268
// is part of the platform (i.e. traced service) is supposed to *not* truncate

0 commit comments

Comments
 (0)