1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
-- Copyright 2023 The Chromium Authors
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
INCLUDE PERFETTO MODULE chrome.speedometer_2_1;
INCLUDE PERFETTO MODULE chrome.speedometer_3;
CREATE PERFETTO FUNCTION _chrome_speedometer_version()
RETURNS STRING AS
WITH
num_measures AS (
SELECT
'2.1' AS version,
count(*) AS num_measures
FROM chrome_speedometer_2_1_measure
UNION ALL
SELECT
'3' AS version,
count(*) AS num_measures
FROM chrome_speedometer_3_measure
)
SELECT
version
FROM num_measures
ORDER BY
num_measures DESC
LIMIT 1;
-- Augmented slices for Speedometer measurements.
-- These are the intervals of time Speedometer uses to compute the final score.
-- There are two intervals that are measured for every test: sync and async
CREATE PERFETTO TABLE chrome_speedometer_measure (
-- Start timestamp of the measure slice
ts TIMESTAMP,
-- Duration of the measure slice
dur DURATION,
-- Full measure name
name STRING,
-- Speedometer iteration the slice belongs to.
iteration LONG,
-- Suite name
suite_name STRING,
-- Test name
test_name STRING,
-- Type of the measure (sync or async)
measure_type STRING
) AS
WITH
all_versions AS (
SELECT
'2.1' AS version,
*
FROM chrome_speedometer_2_1_measure
UNION ALL
SELECT
'3' AS version,
*
FROM chrome_speedometer_3_measure
)
SELECT
ts,
dur,
name,
iteration,
suite_name,
test_name,
measure_type
FROM all_versions
WHERE
version = _chrome_speedometer_version();
-- Slice that covers one Speedometer iteration.
-- Depending on the Speedometer version these slices might need to be estimated
-- as older versions of Speedometer to not emit marks for this interval. The
-- metrics associated are the same ones Speedometer would output, but note we
-- use ns precision (Speedometer uses ~100us) so the actual values might differ
-- a bit.
CREATE PERFETTO TABLE chrome_speedometer_iteration (
-- Start timestamp of the iteration
ts TIMESTAMP,
-- Duration of the iteration
dur DURATION,
-- Iteration name
name STRING,
-- Iteration number
iteration LONG,
-- Geometric mean of the suite durations for this iteration.
geomean DOUBLE,
-- Speedometer score for this iteration (The total score for a run in the
-- average of all iteration scores).
score DOUBLE
) AS
WITH
all_versions AS (
SELECT
'2.1' AS version,
*
FROM chrome_speedometer_2_1_iteration
UNION ALL
SELECT
'3' AS version,
*
FROM chrome_speedometer_3_iteration
)
SELECT
ts,
dur,
name,
iteration,
geomean,
score
FROM all_versions
WHERE
version = _chrome_speedometer_version();
-- Returns the Speedometer score for all iterations in the trace
CREATE PERFETTO FUNCTION chrome_speedometer_score()
-- Speedometer score
RETURNS DOUBLE AS
SELECT
iif(
_chrome_speedometer_version() = '3',
chrome_speedometer_3_score(),
chrome_speedometer_2_1_score()
);
-- Returns the utid for the main thread that ran Speedometer 3
CREATE PERFETTO FUNCTION chrome_speedometer_renderer_main_utid()
-- Renderer main utid
RETURNS LONG AS
SELECT
iif(
_chrome_speedometer_version() = '3',
chrome_speedometer_3_renderer_main_utid(),
chrome_speedometer_2_1_renderer_main_utid()
);
|