Skip to content

Commit

Permalink
stdlib: Add binder interface to the android_binder_txns table
Browse files Browse the repository at this point in the history
Test: tools/diff_test_trace_processor.py out/android/trace_processor_shell --name-filter '.*binder.*'
Change-Id: I97479f7129f673ec281156f4a79b3f60f82af182
  • Loading branch information
zezeozue committed Dec 6, 2024
1 parent 7cc5422 commit d252cf6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
43 changes: 23 additions & 20 deletions src/trace_processor/perfetto_sql/stdlib/android/binder.sql
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,19 @@ LEFT JOIN _oom_score server_oom
-- Breakdown binder transactions per txn.
-- It returns data about the client and server ends of every binder transaction async.
CREATE PERFETTO TABLE android_binder_txns(
-- name of the binder interface if existing.
-- Fully qualified name of the binder endpoint if existing.
aidl_name STRING,
-- Interface of the binder endpoint if existing.
interface STRING,
-- Timestamp the binder interface name was emitted. Proxy to 'ts' and 'dur' for async txns.
aidl_ts TIMESTAMP,
-- Duration of the binder interface name. Proxy to 'ts' and 'dur' for async txns.
aidl_dur DURATION,
-- slice id of the binder txn.
binder_txn_id LONG,
-- name of the client process.
-- Slice id of the binder txn.
binder_txn_id JOINID(slice.id),
-- Name of the client process.
client_process STRING,
-- name of the client thread.
-- Name of the client thread.
client_thread STRING,
-- Upid of the client process.
client_upid JOINID(process.id),
Expand All @@ -422,15 +424,15 @@ CREATE PERFETTO TABLE android_binder_txns(
client_pid LONG,
-- Whether the txn was initiated from the main thread of the client process.
is_main_thread BOOL,
-- timestamp of the client txn.
-- Timestamp of the client txn.
client_ts TIMESTAMP,
-- wall clock dur of the client txn.
-- Wall clock dur of the client txn.
client_dur DURATION,
-- slice id of the binder reply.
binder_reply_id LONG,
-- name of the server process.
-- Slice id of the binder reply.
binder_reply_id JOINID(slice.id),
-- Name of the server process.
server_process STRING,
-- name of the server thread.
-- Name of the server thread.
server_thread STRING,
-- Upid of the server process.
server_upid JOINID(process.id),
Expand All @@ -440,33 +442,34 @@ CREATE PERFETTO TABLE android_binder_txns(
server_tid LONG,
-- Pid of the server thread.
server_pid LONG,
-- timestamp of the server txn.
-- Timestamp of the server txn.
server_ts TIMESTAMP,
-- wall clock dur of the server txn.
-- Wall clock dur of the server txn.
server_dur DURATION,
-- oom score of the client process at the start of the txn.
-- Oom score of the client process at the start of the txn.
client_oom_score LONG,
-- oom score of the server process at the start of the reply.
-- Oom score of the server process at the start of the reply.
server_oom_score LONG,
-- whether the txn is synchronous or async (oneway).
-- Whether the txn is synchronous or async (oneway).
is_sync BOOL,
-- monotonic clock dur of the client txn.
-- Monotonic clock dur of the client txn.
client_monotonic_dur DURATION,
-- monotonic clock dur of the server txn.
-- Monotonic clock dur of the server txn.
server_monotonic_dur DURATION,
-- Client package version_code.
client_package_version_code LONG,
-- Server package version_code.
server_package_version_code LONG,
-- Whether client package is debuggable.
is_client_package_debuggable LONG,
is_client_package_debuggable BOOL,
-- Whether server package is debuggable.
is_server_package_debuggable LONG
is_server_package_debuggable BOOL
) AS WITH all_binder AS (
SELECT *, 1 AS is_sync FROM _sync_binder_metrics_by_txn
UNION ALL
SELECT *, 0 AS is_sync FROM _async_binder_metrics_by_txn
) SELECT
STR_SPLIT(aidl_name, '::', 2) AS interface,
all_binder.*,
_extract_duration_without_suspend(client_ts, client_dur) AS client_monotonic_dur,
_extract_duration_without_suspend(server_ts, server_dur) AS server_monotonic_dur,
Expand Down
23 changes: 12 additions & 11 deletions test/trace_processor/diff_tests/stdlib/android/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def test_binder_txns(self):
INCLUDE PERFETTO MODULE android.binder;
SELECT
aidl_name,
interface,
client_process,
server_process,
client_thread,
Expand Down Expand Up @@ -605,17 +606,17 @@ def test_binder_txns(self):
LIMIT 10;
""",
out=Csv("""
"aidl_name","client_process","server_process","client_thread","client_tid","server_tid","is_main_thread","client_oom_score","server_oom_score","client_ts","server_ts","client_dur","server_dur","client_monotonic_dur","server_monotonic_dur","aidl_ts","aidl_dur","is_sync","client_package_version_code","server_package_version_code","is_client_package_debuggable","is_server_package_debuggable"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736110278076,1736110435876,765487,462664,765487,462664,1736110692464,135281,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736111274404,1736111340019,481038,361607,481038,361607,1736111417370,249758,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736111874030,1736111923740,254494,159330,254494,159330,1736111994038,64535,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736112257185,1736112301639,309870,220751,309870,220751,1736112361927,133727,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::IPackageManager::isProtectedBroadcast::server","com.android.systemui","system_server","ndroid.systemui",1253,657,1,-800,-900,1737108493015,1737125387579,17949987,163732,17949987,163732,1737125511194,24959,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::IActivityManager::checkPermission::server","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737110161286,1737110746980,12677155,147315,12677155,147315,1737110799860,75563,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737123460104,1737123475761,447621,137704,447621,137704,1737123532124,48775,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737123982140,1737123994640,191006,164185,191006,164185,1737124033555,109797,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737124228451,1737124238356,88522,66721,88522,66721,1737124269922,24911,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737124369273,1737124378273,957260,95254,957260,95254,1737124406331,54810,1,33,"[NULL]",0,"[NULL]"
"aidl_name","interface","client_process","server_process","client_thread","client_tid","server_tid","is_main_thread","client_oom_score","server_oom_score","client_ts","server_ts","client_dur","server_dur","client_monotonic_dur","server_monotonic_dur","aidl_ts","aidl_dur","is_sync","client_package_version_code","server_package_version_code","is_client_package_debuggable","is_server_package_debuggable"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736110278076,1736110435876,765487,462664,765487,462664,1736110692464,135281,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736111274404,1736111340019,481038,361607,481038,361607,1736111417370,249758,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736111874030,1736111923740,254494,159330,254494,159330,1736111994038,64535,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,657,1,-800,-900,1736112257185,1736112301639,309870,220751,309870,220751,1736112361927,133727,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::IPackageManager::isProtectedBroadcast::server","IPackageManager","com.android.systemui","system_server","ndroid.systemui",1253,657,1,-800,-900,1737108493015,1737125387579,17949987,163732,17949987,163732,1737125511194,24959,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::IActivityManager::checkPermission::server","IActivityManager","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737110161286,1737110746980,12677155,147315,12677155,147315,1737110799860,75563,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737123460104,1737123475761,447621,137704,447621,137704,1737123532124,48775,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737123982140,1737123994640,191006,164185,191006,164185,1737124033555,109797,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getMobileIfaces::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737124228451,1737124238356,88522,66721,88522,66721,1737124269922,24911,1,33,"[NULL]",0,"[NULL]"
"AIDL::java::INetworkStatsService::getIfaceStats::server","INetworkStatsService","com.android.phone","system_server","m.android.phone",1469,2721,1,-800,-900,1737124369273,1737124378273,957260,95254,957260,95254,1737124406331,54810,1,33,"[NULL]",0,"[NULL]"
"""))

def test_binder_outgoing_graph(self):
Expand Down

0 comments on commit d252cf6

Please sign in to comment.