Perfetto: Add table for game mode intervention
Bug: 219543620
Doc: go/game-dashboard-information-to-perfetto
Test: TBD
Change-Id: I73dd961c0e790bf9d275bf2f1736e0212b53ac32
diff --git a/src/trace_processor/storage/trace_storage.h b/src/trace_processor/storage/trace_storage.h
index f1d11ee..5bb70c3 100644
--- a/src/trace_processor/storage/trace_storage.h
+++ b/src/trace_processor/storage/trace_storage.h
@@ -505,6 +505,15 @@
return &package_list_table_;
}
+ const tables::AndroidGameInterventionListTable&
+ android_game_intervention_list_table() const {
+ return android_game_intervention_list_table_;
+ }
+ tables::AndroidGameInterventionListTable*
+ mutable_android_game_intervenion_list_table() {
+ return &android_game_intervention_list_table_;
+ }
+
const tables::ProfilerSmapsTable& profiler_smaps_table() const {
return profiler_smaps_table_;
}
@@ -821,6 +830,8 @@
&string_pool_, &stack_sample_table_};
tables::PerfSampleTable perf_sample_table_{&string_pool_, nullptr};
tables::PackageListTable package_list_table_{&string_pool_, nullptr};
+ tables::AndroidGameInterventionListTable
+ android_game_intervention_list_table_{&string_pool_, nullptr};
tables::ProfilerSmapsTable profiler_smaps_table_{&string_pool_, nullptr};
// Symbol tables (mappings from frames to symbol names)
diff --git a/src/trace_processor/tables/android_tables.h b/src/trace_processor/tables/android_tables.h
index 9aa2551..49a57f7 100644
--- a/src/trace_processor/tables/android_tables.h
+++ b/src/trace_processor/tables/android_tables.h
@@ -45,6 +45,39 @@
PERFETTO_TP_TABLE(PERFETTO_TP_ANDROID_LOG_TABLE_DEF);
+// A table presenting all game modes and interventions
+// of games installed on the system.
+// This is generated by the game_mode_intervention data-source.
+// @param package_name name of the pakcage, e.g. com.google.android.gm.
+// @param uid UID processes of this package runs as.
+// @param current_mode current game mode the game is running at.
+// @param perf_mode_supported bool whether performance mode is supported.
+// @param perf_mode_downscale resolution downscaling factor of performance mode.
+// @param perf_mode_use_angle bool whether ANGLE is used in performance mode.
+// @param perf_mode_fps frame rate that the game is throttled at in performance
+// mode.
+// @param battery_mode_supported bool whether battery mode is supported.
+// @param battery_mode_downscale resolution downscaling factor of battery mode.
+// @param battery_mode_use_angle bool whether ANGLE is used in battery mode.
+// @param battery_mode_fps frame rate that the game is throttled at in battery
+// mode.
+#define PERFETTO_TP_ANDROID_GAME_INTERVENTION_LIST_DEF(NAME, PARENT, C) \
+ NAME(AndroidGameInterventionListTable, "android_game_intervention_list") \
+ PERFETTO_TP_ROOT_TABLE(PARENT, C) \
+ C(StringPool::Id, package_name) \
+ C(int64_t, uid) \
+ C(int32_t, current_mode) \
+ C(int32_t, perf_mode_supported) \
+ C(base::Optional<StringPool::Id>, perf_mode_downscale) \
+ C(base::Optional<int32_t>, perf_mode_use_angle) \
+ C(base::Optional<int32_t>, perf_mode_fps) \
+ C(int32_t, battery_mode_supported) \
+ C(base::Optional<StringPool::Id>, battery_mode_downscale) \
+ C(base::Optional<int32_t>, battery_mode_use_angle) \
+ C(base::Optional<int32_t>, battery_mode_fps)
+
+PERFETTO_TP_TABLE(PERFETTO_TP_ANDROID_GAME_INTERVENTION_LIST_DEF);
+
} // namespace tables
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/tables/table_destructors.cc b/src/trace_processor/tables/table_destructors.cc
index 24f4886..c84fb9b 100644
--- a/src/trace_processor/tables/table_destructors.cc
+++ b/src/trace_processor/tables/table_destructors.cc
@@ -62,6 +62,7 @@
HeapGraphReferenceTable::~HeapGraphReferenceTable() = default;
VulkanMemoryAllocationsTable::~VulkanMemoryAllocationsTable() = default;
PackageListTable::~PackageListTable() = default;
+AndroidGameInterventionListTable::~AndroidGameInterventionListTable() = default;
ProfilerSmapsTable::~ProfilerSmapsTable() = default;
GpuCounterGroupTable::~GpuCounterGroupTable() = default;
diff --git a/src/trace_processor/trace_processor_impl.cc b/src/trace_processor/trace_processor_impl.cc
index 97ea025..554af42 100644
--- a/src/trace_processor/trace_processor_impl.cc
+++ b/src/trace_processor/trace_processor_impl.cc
@@ -1020,6 +1020,7 @@
RegisterDbTable(storage->stack_profile_mapping_table());
RegisterDbTable(storage->stack_profile_frame_table());
RegisterDbTable(storage->package_list_table());
+ RegisterDbTable(storage->android_game_intervention_list_table());
RegisterDbTable(storage->profiler_smaps_table());
RegisterDbTable(storage->android_log_table());