SQL standard library

To import any function, view_function, view or table simply run SELECT IMPORT({import key}); in your SQL query.

Summary

Views/tables

Name Import Description
all_thread_slices common.slices All thread slices with data about thread, thread track and process
all_process_slices common.slices All process slices with data about process track and process
android_startups android.startup.startups All activity startups in the trace by startup id
android_startup_processes android.startup.startups Maps a startup to the set of processes that handled the activity start
android_startup_threads android.startup.startups Maps a startup to the set of threads on processes that handled the activity start
android_thread_slices_for_all_startups android.startup.startups All the slices for all startups in trace
android_battery_charge android.battery Battery charge at timestamp
android_binder_metrics_by_process android.binder Count Binder transactions per process
android_process_metadata android.process_metadata Data about packages running on the process
chrome_cpu_power_slice chrome.cpu_powerups The CPU power transitions in the trace
chrome_cpu_power_first_sched_slice_after_powerup chrome.cpu_powerups The Linux scheduler slices that executed immediately after a CPU power up
chrome_cpu_power_post_powerup_slice chrome.cpu_powerups A table holding the slices that executed within the scheduler slice that ran on a CPU immediately after power-up
chrome_cpu_power_first_toplevel_slice_after_powerup chrome.cpu_powerups The first top-level slice that ran after a CPU power-up

Functions

Name Import Return type Description
EARLIEST_TIMESTAMP_FOR_COUNTER_TRACK common.counters LONG Timestamp of first counter value in a counter
EXTRACT_INT_METADATA common.metadata LONG Extracts an int value with the given name from the metadata table
COUNTER_TRACK_PERCENTILE_FOR_TIME common.percentiles DOUBLE Value for specific percentile (range 1-100) for counter track ID in time range
COUNTER_TRACK_PERCENTILE common.percentiles DOUBLE Value for specific percentile (range 1-100) for counter track ID
HAS_PARENT_SLICE_WITH_NAME common.slices BOOL Checks if slice has an ancestor with provided name
SLICE_COUNT common.slices INT Count slices with specified name
TRACE_START common.timestamps LONG Fetch start of the trace
TRACE_END common.timestamps LONG Fetch end of the trace
TRACE_DUR common.timestamps LONG Fetch duration of the trace
IS_SPANS_OVERLAPPING common.timestamps BOOL Checks whether two spans are overlapping
ANDROID_SUM_DUR_FOR_STARTUP_AND_SLICE android.startup.startups INT Returns duration of startup for slice name
ANDROID_SUM_DUR_ON_MAIN_THREAD_FOR_STARTUP_AND_SLICE android.startup.startups INT Returns duration of startup for slice name on main thread

View Functions

Name Import Description
COUNTER_WITH_DUR_FOR_TRACK common.counters Counter values with details of counter track with calculated duration of each counter value
COUNTER_FOR_TIME_RANGE common.counters COUNTER_WITH_DUR_FOR_TRACK but in a specified time
COUNTER_PERCENTILES_FOR_TIME_RANGE common.percentiles All percentiles (range 1-100) for counter track ID in a given time range
COUNTER_PERCENTILES_FOR_TRACK common.percentiles All percentiles (range 1-100) for counter track ID
THREAD_SLICES_FOR_UTID common.slices Detailed thread slices data with process, thread and track for thread with provided utid
THREAD_SLICES_FOR_UPID common.slices Detailed thread slices data with process, thread and track for process with provided upid
THREAD_SLICES_FOR_THREAD_TRACK_ID common.slices Detailed thread slices data with process, thread and track for track id
THREAD_SLICES_FOR_SLICE_NAME common.slices Detailed thread slices data with process, thread and track for specified slice name
THREAD_SLICES_FOR_THREAD_NAME common.slices Detailed thread slices data with process, thread and track for specified thread name
THREAD_SLICES_FOR_PROCESS_NAME common.slices Detailed thread slices data with process, thread and track for specified process name
PROCESS_SLICES_FOR_UPID common.slices Detailed process slices data for process and track with provided upid
PROCESS_SLICES_FOR_PROCESS_TRACK_ID common.slices Detailed process slices data for process and track with provided process_track_id
PROCESS_SLICES_FOR_SLICE_NAME common.slices Detailed process slices data for specified slice name
PROCESS_SLICES_FOR_PROCESS_NAME common.slices Detailed process slices data for specified process name
ANDROID_SLICES_FOR_STARTUP_AND_SLICE_NAME android.startup.startups Given a startup id and GLOB for a slice name, returns matching slices with data
ANDROID_BINDER_TRANSACTION_SLICES_FOR_STARTUP android.startup.startups Returns binder transaction slices for a given startup id with duration over threshold

Module: common

common.counters

Functions

EARLIEST_TIMESTAMP_FOR_COUNTER_TRACK Timestamp of first counter value in a counter.

Returns: LONG, Timestamp of first counter value. Null if doesn't exist.

Argument Type Description
counter_track_id INT Id of a counter track with a counter.

View Functions

COUNTER_WITH_DUR_FOR_TRACK Counter values with details of counter track with calculated duration of each counter value. Duration is calculated as time from counter to the next counter.

Argument Type Description
counter_track_id INT Id of track counter track.
Column Description
ts Timestamp of the counter value
dur Duration of the counter value
value Counter value
track_id If of the counter track
track_name Name of the counter track
track_arg_set_id Counter track set id
arg_set_id Counter arg set id

COUNTER_FOR_TIME_RANGE COUNTER_WITH_DUR_FOR_TRACK but in a specified time. Does calculation over the table ends - creates an artificial counter value at the start if needed and chops the duration of the last timestamps in range.

Argument Type Description
counter_track_id INT Id of track counter track.
start_ts LONG Timestamp of the timerange start. Can be earlier than the first counter value.
end_ts LONG Timestamp of the timerange end.
Column Description
ts Timestamp of the counter value
dur Duration of the counter value
value Counter value
track_id If of the counter track
track_name Name of the counter track
track_arg_set_id Counter track set id
arg_set_id Counter arg set id

common.metadata

Functions

EXTRACT_INT_METADATA Extracts an int value with the given name from the metadata table.

Returns: LONG, int_value for the given name. NULL if there's no such entry.

Argument Type Description
name STRING The name of the metadata entry.

common.percentiles

Functions

COUNTER_TRACK_PERCENTILE_FOR_TIME Value for specific percentile (range 1-100) for counter track ID in time range.

Returns: DOUBLE, Value for the percentile.

Argument Type Description
counter_track_id INT Id of the counter track.
percentile INT Any of the numbers from 1 to 100.
start_ts LONG Timestamp of start of time range.
end_ts LONG Timestamp of end of time range.

COUNTER_TRACK_PERCENTILE Value for specific percentile (range 1-100) for counter track ID.

Returns: DOUBLE, Value for the percentile.

Argument Type Description
counter_track_id INT Id of the counter track.
percentile INT Any of the numbers from 1 to 100.

View Functions

COUNTER_PERCENTILES_FOR_TIME_RANGE All percentiles (range 1-100) for counter track ID in a given time range. Percentiles are calculated by: 1. Dividing the sum of duration in time range for each value in the counter by duration of the counter in range. This gives us percentile_for)value (DOUBLE). 2. Fetching each percentile by taking floor of each percentile_for_value, grouping by resulting percentile and MIN from value for each grouping. As we are rounding down, taking MIN assures most reliable data. 3. Filling the possible gaps in percentiles by getting the minimal value from higher percentiles for each gap.

Argument Type Description
counter_track_id INT Id of the counter track.
start_ts LONG Timestamp of start of time range.
end_ts LONG Timestamp of end of time range.
Column Description
percentile All of the numbers from 1 to 100
value Value for the percentile

COUNTER_PERCENTILES_FOR_TRACK All percentiles (range 1-100) for counter track ID.

Argument Type Description
counter_track_id INT Id of the counter track.
Column Description
percentile All of the numbers from 1 to 100
value Value for the percentile

common.slices

Views/Tables

all_thread_slices, VIEW

All thread slices with data about thread, thread track and process. Where possible, use available view functions which filter this view.

Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

all_process_slices, VIEW

All process slices with data about process track and process. Where possible, use available view functions which filter this view.

Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
process_track_id Id of process track
process_track_name Name of process track
upid Upid of process with slice
process_name Name of process with slice

Functions

HAS_PARENT_SLICE_WITH_NAME Checks if slice has an ancestor with provided name.

Returns: BOOL, Whether parent_name is a name of an ancestor slice.

Argument Type Description
id INT Id of the slice to check parents of.
parent_name STRING Name of potential ancestor slice.

SLICE_COUNT Count slices with specified name.

Returns: INT, Number of slices with the name.

Argument Type Description
slice_glob STRING Name of the slices to counted.

View Functions

THREAD_SLICES_FOR_UTID Detailed thread slices data with process, thread and track for thread with provided utid.

Argument Type Description
utid INT Utid of thread.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

THREAD_SLICES_FOR_UPID Detailed thread slices data with process, thread and track for process with provided upid.

Argument Type Description
upid INT Upid of process.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

THREAD_SLICES_FOR_THREAD_TRACK_ID Detailed thread slices data with process, thread and track for track id.

Argument Type Description
thread_track_id INT Id of thread_track.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

THREAD_SLICES_FOR_SLICE_NAME Detailed thread slices data with process, thread and track for specified slice name. Searches for slice name with GLOB.

Argument Type Description
glob_name STRING String name to glob.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

THREAD_SLICES_FOR_THREAD_NAME Detailed thread slices data with process, thread and track for specified thread name. Searches for thread name with GLOB.

Argument Type Description
glob_name STRING Thread name to glob.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

THREAD_SLICES_FOR_PROCESS_NAME Detailed thread slices data with process, thread and track for specified process name. Searches for process name with GLOB.

Argument Type Description
glob_name STRING Process name to glob.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
thread_track_id Id of thread track
thread_track_name Name of thread track
utid Utid of thread with slice
thread_name Name of thread with slice
upid Upid of process with slice
process_name Name of process with slice

PROCESS_SLICES_FOR_UPID Detailed process slices data for process and track with provided upid.

Argument Type Description
upid INT Upid of process.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
process_track_id Id of process track
process_track_name Name of process track
upid Upid of process with slice
process_name Name of process with slice

PROCESS_SLICES_FOR_PROCESS_TRACK_ID Detailed process slices data for process and track with provided process_track_id.

Argument Type Description
process_track_id INT Id of process track.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
process_track_id Id of process track
process_track_name Name of process track
upid Upid of process with slice
process_name Name of process with slice

PROCESS_SLICES_FOR_SLICE_NAME Detailed process slices data for specified slice name. Searches for slice name with GLOB.

Argument Type Description
glob_name STRING String name to glob.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
process_track_id Id of process track
process_track_name Name of process track
upid Upid of process with slice
process_name Name of process with slice

PROCESS_SLICES_FOR_PROCESS_NAME Detailed process slices data for specified process name. Searches for process name with GLOB.

Argument Type Description
glob_name STRING Process name to glob.
Column Description
slice_id Id of slice
slice_name Name of slice
ts Timestamp of slice start
dur Duration of slice
slice_depth Depth of slice
arg_set_id Slice arg set id
process_track_id Id of process track
process_track_name Name of process track
upid Upid of process with slice
process_name Name of process with slice

common.timestamps

Functions

TRACE_START Fetch start of the trace.

Returns: LONG, Start of the trace in nanoseconds.

TRACE_END Fetch end of the trace.

Returns: LONG, End of the trace in nanoseconds.

TRACE_DUR Fetch duration of the trace.

Returns: LONG, Duration of the trace in nanoseconds.

IS_SPANS_OVERLAPPING Checks whether two spans are overlapping.

Returns: BOOL, Whether two spans are overlapping.

Argument Type Description
ts1 LONG Start of first span.
ts_end1 LONG End of first span.
ts2 LONG Start of second span.
ts_end2 LONG End of second span.

Module: android

android.startup.startups

Views/Tables

android_startups, TABLE

All activity startups in the trace by startup id. Populated by different scripts depending on the platform version/contents.

Column Description
id Startup id
ts Timestamp of startup start
ts_end Timestamp of startup end
dur Startup duration
package Package name
startup_type Startup type

android_startup_processes, TABLE

Maps a startup to the set of processes that handled the activity start. The vast majority of cases should be a single process. However it is possible that the process dies during the activity startup and is respawned.

Column Description
startup_id Startup id
upid Upid of process on which activity started
startup_type Type of the startup

android_startup_threads, VIEW

Maps a startup to the set of threads on processes that handled the activity start.

Column Description
startup_id Startup id
ts Timestamp of start
dur Duration of startup
upid Upid of process involved in startup
utid Utid of the thread
thread_name Name of the thread
is_main_thread Thread is a main thread

android_thread_slices_for_all_startups, VIEW

All the slices for all startups in trace. Generally, this view should not be used. Instead, use one of the view functions related to the startup slices which are created from this table.

Column Description
startup_ts Timestamp of startup
startup_ts_end Timestamp of startup end
startup_id Startup id
utid UTID of thread with slice
thread_name Name of thread
is_main_thread Whether it is main thread
arg_set_id Arg set id
slice_id Slice id
slice_name Name of slice
slice_ts Timestamp of slice start
slice_dur Slice duration

Functions

ANDROID_SUM_DUR_FOR_STARTUP_AND_SLICE Returns duration of startup for slice name. Sums duration of all slices of startup with provided name.

Returns: INT, Sum of duration.

Argument Type Description
startup_id LONG Startup id.
slice_name STRING Slice name.

ANDROID_SUM_DUR_ON_MAIN_THREAD_FOR_STARTUP_AND_SLICE Returns duration of startup for slice name on main thread. Sums duration of all slices of startup with provided name only on main thread.

Returns: INT, Sum of duration.

Argument Type Description
startup_id LONG Startup id.
slice_name STRING Slice name.

View Functions

ANDROID_SLICES_FOR_STARTUP_AND_SLICE_NAME Given a startup id and GLOB for a slice name, returns matching slices with data.

Argument Type Description
startup_id INT Startup id.
slice_name STRING Glob of the slice.
Column Description
slice_name Name of the slice
slice_ts Timestamp of start of the slice
slice_dur Duration of the slice
thread_name Name of the thread with the slice
arg_set_id Arg set id

ANDROID_BINDER_TRANSACTION_SLICES_FOR_STARTUP Returns binder transaction slices for a given startup id with duration over threshold.

Argument Type Description
startup_id INT Startup id.
threshold DOUBLE Only return slices with duration over threshold.
Column Description
id Slice id
slice_dur Slice duration
thread_name Name of the thread with slice
process Name of the process with slice
arg_set_id Arg set id
is_main_thread Whether is main thread

android.battery

Views/Tables

android_battery_charge, VIEW

Battery charge at timestamp.

Column Description
ts Timestamp
current_avg_ua Current average micro ampers
capacity_percent Current capacity percentage
charge_uah Current charge in micro ampers
current_ua Current micro ampers

android.binder

Views/Tables

android_binder_metrics_by_process, VIEW

Count Binder transactions per process.

Column Description
process_name Name of the process that started the binder transaction
pid PID of the process that started the binder transaction
slice_name Name of the slice with binder transaction
event_count Number of binder transactions in process in slice

android.process_metadata

Views/Tables

android_process_metadata, TABLE

Data about packages running on the process.

Column Description
upid Process upid
process_name Process name
package_name Name of the packages running in this process
version_code Package version code
debuggable Whether package is debuggable

Module: chrome

chrome.cpu_powerups

Views/Tables

chrome_cpu_power_slice, VIEW

The CPU power transitions in the trace.

Column Description
ts The timestamp at the start of the slice
dur The duration of the slice
cpu The CPU on which the transition occurred
power_state The power state that the CPU was in at time duration 'dur'.
previous_power_state The power state that the CPU was previously in
powerup_id A unique ID for the CPU power Power states are encoded as non-negative integers, with zero representing full-power operation and positive values representing increasingly deep sleep states. On ARM systems, power state 1 represents the WFI (Wait For Interrupt) sleep state that the CPU enters while idle.

chrome_cpu_power_first_sched_slice_after_powerup, TABLE

The Linux scheduler slices that executed immediately after a CPU power up.

Column Description
ts The timestamp at the start of the slice
dur The duration of the slice
cpu The cpu on which the slice executed
sched_id Id for the sched_slice table
utid Unique id for the thread that ran within the slice
previous_power_state The CPU

chrome_cpu_power_post_powerup_slice, TABLE

A table holding the slices that executed within the scheduler slice that ran on a CPU immediately after power-up.

Column Description
ts Timestamp of the resulting slice
dur Duration of the slice
cpu The CPU the sched slice ran on
utid Unique thread id for the slice
sched_id
type From the sched_slice table, always
end_state The ending state for the sched_slice
priority The kernel thread priority
slice_id Id of the top

chrome_cpu_power_first_toplevel_slice_after_powerup, VIEW

The first top-level slice that ran after a CPU power-up.

Column Description
slice_id ID of the slice in the slice table
previous_power_state The power state of the CPU prior to power

Module: experimental

experimental.android_broadcast

Views/Tables

experimental_android_broadcasts_minsdk_u, VIEW

Provides a list of broadcast names and processes they were sent to by the system_server process on U+ devices.

Column Description
type The name of the broadcast type which was sent
process_name The process name the broadcast was sent to
queue_name The name of the broacast queue the broadcast was dispatched from.