Skip to content

Commit

Permalink
Merge "Reapply "stdlib: Remove common package."" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aMayzner authored and Gerrit Code Review committed Nov 11, 2024
2 parents ea011a2 + 8d4918c commit ec5dc25
Show file tree
Hide file tree
Showing 31 changed files with 116 additions and 1,072 deletions.
12 changes: 0 additions & 12 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -13599,19 +13599,7 @@ genrule {
"src/trace_processor/perfetto_sql/stdlib/android/winscope/windowmanager.sql",
"src/trace_processor/perfetto_sql/stdlib/callstacks/stack_profile.sql",
"src/trace_processor/perfetto_sql/stdlib/chrome/**/*.sql",
"src/trace_processor/perfetto_sql/stdlib/common/args.sql",
"src/trace_processor/perfetto_sql/stdlib/common/counters.sql",
"src/trace_processor/perfetto_sql/stdlib/common/metadata.sql",
"src/trace_processor/perfetto_sql/stdlib/common/percentiles.sql",
"src/trace_processor/perfetto_sql/stdlib/common/slices.sql",
"src/trace_processor/perfetto_sql/stdlib/common/timestamps.sql",
"src/trace_processor/perfetto_sql/stdlib/counters/intervals.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/args.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/counters.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/metadata.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/percentiles.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/slices.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/timestamps.sql",
"src/trace_processor/perfetto_sql/stdlib/export/to_firefox_profile.sql",
"src/trace_processor/perfetto_sql/stdlib/graphs/critical_path.sql",
"src/trace_processor/perfetto_sql/stdlib/graphs/dominator_tree.sql",
Expand Down
28 changes: 0 additions & 28 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2974,19 +2974,6 @@ perfetto_filegroup(
srcs = glob(["src/trace_processor/perfetto_sql/stdlib/chrome/**/*.sql"]),
)

# GN target: //src/trace_processor/perfetto_sql/stdlib/common:common
perfetto_filegroup(
name = "src_trace_processor_perfetto_sql_stdlib_common_common",
srcs = [
"src/trace_processor/perfetto_sql/stdlib/common/args.sql",
"src/trace_processor/perfetto_sql/stdlib/common/counters.sql",
"src/trace_processor/perfetto_sql/stdlib/common/metadata.sql",
"src/trace_processor/perfetto_sql/stdlib/common/percentiles.sql",
"src/trace_processor/perfetto_sql/stdlib/common/slices.sql",
"src/trace_processor/perfetto_sql/stdlib/common/timestamps.sql",
],
)

# GN target: //src/trace_processor/perfetto_sql/stdlib/counters:counters
perfetto_filegroup(
name = "src_trace_processor_perfetto_sql_stdlib_counters_counters",
Expand All @@ -2995,19 +2982,6 @@ perfetto_filegroup(
],
)

# GN target: //src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common:common
perfetto_filegroup(
name = "src_trace_processor_perfetto_sql_stdlib_deprecated_v42_common_common",
srcs = [
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/args.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/counters.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/metadata.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/percentiles.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/slices.sql",
"src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/timestamps.sql",
],
)

# GN target: //src/trace_processor/perfetto_sql/stdlib/export:export
perfetto_filegroup(
name = "src_trace_processor_perfetto_sql_stdlib_export_export",
Expand Down Expand Up @@ -3242,9 +3216,7 @@ perfetto_cc_amalgamated_sql(
":src_trace_processor_perfetto_sql_stdlib_android_winscope_winscope",
":src_trace_processor_perfetto_sql_stdlib_callstacks_callstacks",
":src_trace_processor_perfetto_sql_stdlib_chrome_chrome_sql",
":src_trace_processor_perfetto_sql_stdlib_common_common",
":src_trace_processor_perfetto_sql_stdlib_counters_counters",
":src_trace_processor_perfetto_sql_stdlib_deprecated_v42_common_common",
":src_trace_processor_perfetto_sql_stdlib_export_export",
":src_trace_processor_perfetto_sql_stdlib_graphs_graphs",
":src_trace_processor_perfetto_sql_stdlib_intervals_intervals",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Unreleased:
inserted directly into it.
* Removed the `uid_track` table. It was redundant as no data was
inserted directly into it.
* Removed `common` package. It has been deprecated since `v42` and most
functionality has been moved into other packages. Notably, the time
conversion functions can be found in `time.conversion` module, and
`thread_slice` is available with `slices.with_context`.
Trace Processor:
*
UI:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,30 @@
-- The numbers mentioned above are estimates in the ideal case scenario.

INCLUDE PERFETTO MODULE chrome.scroll_jank.utils;
INCLUDE PERFETTO MODULE common.slices;

-- Checks if slice has a descendant with provided name.
CREATE OR REPLACE PERFETTO FUNCTION _has_descendant_slice_with_name(
-- Id of the slice to check descendants of.
id INT,
-- Name of potential descendant slice.
descendant_name STRING
)
-- Whether `descendant_name` is a name of an descendant slice.
RETURNS BOOL AS
SELECT EXISTS(
SELECT 1
FROM descendant_slice($id)
WHERE name = $descendant_name
LIMIT 1
);

-- Grab all GestureScrollUpdate slices.
DROP VIEW IF EXISTS chrome_all_scroll_updates;
CREATE PERFETTO VIEW chrome_all_scroll_updates AS
SELECT
S.id,
chrome_get_most_recent_scroll_begin_id(ts) AS scroll_id,
has_descendant_slice_with_name(S.id, "SubmitCompositorFrameToPresentationCompositorFrame")
_has_descendant_slice_with_name(S.id, "SubmitCompositorFrameToPresentationCompositorFrame")
AS is_presented,
ts,
dur,
Expand Down
2 changes: 0 additions & 2 deletions src/trace_processor/metrics/sql/common/parent_slice.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

INCLUDE PERFETTO MODULE deprecated.v42.common.slices;
10 changes: 10 additions & 0 deletions src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,18 @@ base::Status PerfettoSqlEngine::ExecuteInclude(
}

std::string package_name = sql_modules::GetPackageName(key);

auto* package = FindPackage(package_name);
if (!package) {
if (package_name == "common") {
return base::ErrStatus(
"INCLUDE: Package `common` has been removed and most of the "
"functionality has been moved to other packages. Check "
"`slices.with_context` for replacement for `common.slices` and "
"`time.conversion` for replacement for `common.timestamps`. The "
"documentation for Perfetto standard library can be found at "
"https://perfetto.dev/docs/analysis/stdlib-docs.");
}
return base::ErrStatus("INCLUDE: Package '%s' not found", key.c_str());
}
return IncludePackageImpl(*package, key, parser);
Expand Down
2 changes: 0 additions & 2 deletions src/trace_processor/perfetto_sql/stdlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ perfetto_amalgamated_sql_header("stdlib") {
"android",
"callstacks",
"chrome:chrome_sql",
"common",
"counters",
"deprecated/v42/common",
"export",
"graphs",
"intervals",
Expand Down
22 changes: 18 additions & 4 deletions src/trace_processor/perfetto_sql/stdlib/chrome/event_latency.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.

INCLUDE PERFETTO MODULE deprecated.v42.common.slices;

-- Finds the start timestamp for a given slice's descendant with a given name.
-- If there are multiple descendants with a given name, the function will return
-- the first one, so it's most useful when working with a timeline broken down
Expand Down Expand Up @@ -42,6 +40,22 @@ FROM descendant_slice($parent_id) s
WHERE s.name GLOB $child_name
LIMIT 1;

-- Checks if slice has a descendant with provided name.
CREATE PERFETTO FUNCTION _has_descendant_slice_with_name(
-- Id of the slice to check descendants of.
id INT,
-- Name of potential descendant slice.
descendant_name STRING
)
-- Whether `descendant_name` is a name of an descendant slice.
RETURNS BOOL AS
SELECT EXISTS(
SELECT 1
FROM descendant_slice($id)
WHERE name = $descendant_name
LIMIT 1
);

-- Returns the presentation timestamp for a given EventLatency slice.
-- This is either the end of
-- SwapEndToPresentationCompositorFrame (if it exists),
Expand Down Expand Up @@ -101,7 +115,7 @@ SELECT
slice.ts,
slice.dur,
EXTRACT_arg(arg_set_id, 'event_latency.event_latency_id') AS scroll_update_id,
has_descendant_slice_with_name(
_has_descendant_slice_with_name(
slice.id,
'SubmitCompositorFrameToPresentationCompositorFrame')
AS is_presented,
Expand Down Expand Up @@ -142,7 +156,7 @@ WHERE (
event_type GLOB '*GESTURE_SCROLL*'
-- Pinches are only relevant if the frame was presented.
OR (event_type GLOB '*GESTURE_PINCH_UPDATE'
AND has_descendant_slice_with_name(
AND _has_descendant_slice_with_name(
id,
'SubmitCompositorFrameToPresentationCompositorFrame')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.

INCLUDE PERFETTO MODULE deprecated.v42.common.slices;
INCLUDE PERFETTO MODULE slices.with_context;

-- `Graphics.Pipeline` steps corresponding to work done by a Viz client to
-- produce a frame (i.e. before surface aggregation). Covers steps:
Expand Down
26 changes: 0 additions & 26 deletions src/trace_processor/perfetto_sql/stdlib/common/BUILD.gn

This file was deleted.

8 changes: 0 additions & 8 deletions src/trace_processor/perfetto_sql/stdlib/common/OWNERS

This file was deleted.

20 changes: 0 additions & 20 deletions src/trace_processor/perfetto_sql/stdlib/common/args.sql

This file was deleted.

21 changes: 0 additions & 21 deletions src/trace_processor/perfetto_sql/stdlib/common/counters.sql

This file was deleted.

21 changes: 0 additions & 21 deletions src/trace_processor/perfetto_sql/stdlib/common/metadata.sql

This file was deleted.

21 changes: 0 additions & 21 deletions src/trace_processor/perfetto_sql/stdlib/common/percentiles.sql

This file was deleted.

21 changes: 0 additions & 21 deletions src/trace_processor/perfetto_sql/stdlib/common/slices.sql

This file was deleted.

21 changes: 0 additions & 21 deletions src/trace_processor/perfetto_sql/stdlib/common/timestamps.sql

This file was deleted.

Loading

0 comments on commit ec5dc25

Please sign in to comment.