-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Implement a Chrome histogram summary metric in Perfetto." into…
… main
- Loading branch information
Showing
7 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
/* | ||
* Copyright (C) 2024 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
syntax = "proto2"; | ||
|
||
package perfetto.protos; | ||
|
||
message HistogramSummary { | ||
// The name of the histogram event | ||
optional string name = 1; | ||
// The avarage value of the histogram event | ||
optional int64 mean = 2; | ||
// The number of the histogram event in the trace track | ||
optional uint32 count = 3; | ||
// The sum of value of the histogram event | ||
optional int64 sum = 4; | ||
// The maximum value of the histogram event | ||
optional int64 max = 5; | ||
// The 90 percentile value of the histogram event | ||
optional int64 p90 = 6; | ||
// The 50 percentile (median) value of the histogram event | ||
optional int64 p50 = 7; | ||
} | ||
|
||
// The list of the summary of Chrome Histograms in trace track events. | ||
// This includes the statistic information of each histograms from Chrome. | ||
message ChromeHistogramSummaries { | ||
repeated HistogramSummary histogram_summary = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
-- | ||
-- Copyright 2024 The Android Open Source Project | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- https://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
|
||
INCLUDE PERFETTO MODULE chrome.histograms; | ||
|
||
DROP VIEW IF EXISTS HistogramSummaryTable; | ||
CREATE PERFETTO VIEW HistogramSummaryTable AS | ||
SELECT | ||
hist.name AS histname, | ||
CAST(AVG(hist.value) AS INTEGER) AS mean_histval, | ||
COUNT(*) AS hist_count, | ||
CAST(SUM(hist.value) AS INTEGER) AS sum_histval, | ||
CAST(MAX(hist.value) AS INTEGER) AS max_histval, | ||
CAST(PERCENTILE(hist.value, 90) AS INTEGER) AS p90_histval, | ||
CAST(PERCENTILE(hist.value, 50) AS INTEGER) AS p50_histval | ||
FROM chrome_histograms hist | ||
GROUP BY hist.name; | ||
|
||
DROP VIEW IF EXISTS chrome_histogram_summaries_output; | ||
CREATE PERFETTO VIEW chrome_histogram_summaries_output AS | ||
SELECT ChromeHistogramSummaries( | ||
'histogram_summary', ( | ||
SELECT RepeatedField( | ||
HistogramSummary( | ||
'name', histname, | ||
'mean', mean_histval, | ||
'count', hist_count, | ||
'sum', sum_histval, | ||
'max', max_histval, | ||
'p90', p90_histval, | ||
'p50', p50_histval | ||
) | ||
) | ||
FROM HistogramSummaryTable | ||
) | ||
); |