aboutsummaryrefslogtreecommitdiff
path: root/test/trace_processor/diff_tests/stdlib/android/startups_tests.py
blob: 14d002ad7b68cae215ab1a47b02135cad771f49b (plain)
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
#!/usr/bin/env python3
# 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 a
#
#      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.

from python.generators.diff_tests.testing import Path, DataPath
from python.generators.diff_tests.testing import Csv, TextProto
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import TestSuite


class Startups(TestSuite):

  def test_hot_startups(self):
    return DiffTestBlueprint(
        trace=DataPath('api31_startup_hot.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        1,186969441973689,186969489302704,47329015,"androidx.benchmark.integration.macrobenchmark.target","[NULL]"
        """))

  def test_warm_startups(self):
    return DiffTestBlueprint(
        trace=DataPath('api32_startup_warm.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        28,157479786566030,157479943081777,156515747,"androidx.benchmark.integration.macrobenchmark.target","[NULL]"
        """))

  def test_cold_startups(self):
    return DiffTestBlueprint(
        trace=DataPath('api34_startup_cold.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        61,17806781251694,17806891032171,109780477,"com.android.systemui.people","warm"
        """))

  def test_hot_startups_maxsdk28(self):
    return DiffTestBlueprint(
        trace=DataPath('api24_startup_hot.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        1,779860286416,779893485322,33198906,"com.google.android.googlequicksearchbox","[NULL]"
        2,780778904571,780813944498,35039927,"androidx.benchmark.integration.macrobenchmark.target","[NULL]"
        """))

  def test_warm_startups_maxsdk28(self):
    return DiffTestBlueprint(
        trace=DataPath('api24_startup_warm.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        1,799979565075,800014194731,34629656,"com.google.android.googlequicksearchbox","[NULL]"
        2,800868511677,800981929562,113417885,"androidx.benchmark.integration.macrobenchmark.target","[NULL]"
        """))

  def test_cold_startups_maxsdk28(self):
    return DiffTestBlueprint(
        trace=DataPath('api24_startup_cold.perfetto-trace'),
        query="""
        INCLUDE PERFETTO MODULE android.startup.startups;
        SELECT * FROM android_startups;
        """,
        out=Csv("""
        "startup_id","ts","ts_end","dur","package","startup_type"
        1,791231114368,791501060868,269946500,"androidx.benchmark.integration.macrobenchmark.target","[NULL]"
        """))