• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2024 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
17INCLUDE PERFETTO MODULE chrome.histograms;
18
19DROP VIEW IF EXISTS HistogramSummaryTable;
20CREATE PERFETTO VIEW HistogramSummaryTable AS
21SELECT
22    hist.name AS histname,
23    CAST(AVG(hist.value) AS INTEGER) AS mean_histval,
24    COUNT(*) AS hist_count,
25    CAST(SUM(hist.value) AS INTEGER) AS sum_histval,
26    CAST(MAX(hist.value) AS INTEGER) AS max_histval,
27    CAST(PERCENTILE(hist.value, 90) AS INTEGER) AS p90_histval,
28    CAST(PERCENTILE(hist.value, 50) AS INTEGER) AS p50_histval
29FROM chrome_histograms hist
30GROUP BY hist.name;
31
32DROP VIEW IF EXISTS chrome_histogram_summaries_output;
33CREATE PERFETTO VIEW chrome_histogram_summaries_output AS
34SELECT ChromeHistogramSummaries(
35    'histogram_summary', (
36        SELECT RepeatedField(
37            HistogramSummary(
38                'name', histname,
39                'mean', mean_histval,
40                'count', hist_count,
41                'sum', sum_histval,
42                'max', max_histval,
43                'p90', p90_histval,
44                'p50', p50_histval
45            )
46        )
47        FROM HistogramSummaryTable
48    )
49);
50