tp: migrate all tables to be Python based tables
Change-Id: Ia57353074e842ac87a41a59bc99ea1d0c61c2ed5
diff --git a/Android.bp b/Android.bp
index 8a41156..09783ce 100644
--- a/Android.bp
+++ b/Android.bp
@@ -10161,7 +10161,13 @@
name: "perfetto_src_trace_processor_tables_tables_python",
srcs: [
"src/trace_processor/tables/android_tables.py",
+ "src/trace_processor/tables/counter_tables.py",
+ "src/trace_processor/tables/flow_tables.py",
+ "src/trace_processor/tables/memory_tables.py",
"src/trace_processor/tables/metadata_tables.py",
+ "src/trace_processor/tables/profiler_tables.py",
+ "src/trace_processor/tables/slice_tables.py",
+ "src/trace_processor/tables/trace_proto_tables.py",
"src/trace_processor/tables/track_tables.py",
],
tools: [
@@ -10170,7 +10176,13 @@
cmd: "$(location perfetto_src_trace_processor_tables_tables_python_binary) --gen-dir=$(genDir) --inputs $(in) --outputs $(out)",
out: [
"src/trace_processor/tables/android_tables_py.h",
+ "src/trace_processor/tables/counter_tables_py.h",
+ "src/trace_processor/tables/flow_tables_py.h",
+ "src/trace_processor/tables/memory_tables_py.h",
"src/trace_processor/tables/metadata_tables_py.h",
+ "src/trace_processor/tables/profiler_tables_py.h",
+ "src/trace_processor/tables/slice_tables_py.h",
+ "src/trace_processor/tables/trace_proto_tables_py.h",
"src/trace_processor/tables/track_tables_py.h",
],
}
@@ -10183,7 +10195,13 @@
"python/generators/trace_processor_table/serialize.py",
"python/generators/trace_processor_table/util.py",
"src/trace_processor/tables/android_tables.py",
+ "src/trace_processor/tables/counter_tables.py",
+ "src/trace_processor/tables/flow_tables.py",
+ "src/trace_processor/tables/memory_tables.py",
"src/trace_processor/tables/metadata_tables.py",
+ "src/trace_processor/tables/profiler_tables.py",
+ "src/trace_processor/tables/slice_tables.py",
+ "src/trace_processor/tables/trace_proto_tables.py",
"src/trace_processor/tables/track_tables.py",
"tools/gen_tp_table_headers.py",
],
diff --git a/BUILD b/BUILD
index a79e0f2..e5d3c9b 100644
--- a/BUILD
+++ b/BUILD
@@ -1979,17 +1979,13 @@
perfetto_filegroup(
name = "src_trace_processor_tables_tables",
srcs = [
- "src/trace_processor/tables/android_tables.h",
"src/trace_processor/tables/counter_tables.h",
"src/trace_processor/tables/flow_tables.h",
"src/trace_processor/tables/macros.h",
"src/trace_processor/tables/macros_internal.h",
- "src/trace_processor/tables/memory_tables.h",
- "src/trace_processor/tables/metadata_tables.h",
"src/trace_processor/tables/profiler_tables.h",
"src/trace_processor/tables/slice_tables.h",
"src/trace_processor/tables/table_destructors.cc",
- "src/trace_processor/tables/trace_proto_tables.h",
],
)
@@ -1998,12 +1994,24 @@
name = "src_trace_processor_tables_tables_python",
srcs = [
"src/trace_processor/tables/android_tables.py",
+ "src/trace_processor/tables/counter_tables.py",
+ "src/trace_processor/tables/flow_tables.py",
+ "src/trace_processor/tables/memory_tables.py",
"src/trace_processor/tables/metadata_tables.py",
+ "src/trace_processor/tables/profiler_tables.py",
+ "src/trace_processor/tables/slice_tables.py",
+ "src/trace_processor/tables/trace_proto_tables.py",
"src/trace_processor/tables/track_tables.py",
],
outs = [
"src/trace_processor/tables/android_tables_py.h",
+ "src/trace_processor/tables/counter_tables_py.h",
+ "src/trace_processor/tables/flow_tables_py.h",
+ "src/trace_processor/tables/memory_tables_py.h",
"src/trace_processor/tables/metadata_tables_py.h",
+ "src/trace_processor/tables/profiler_tables_py.h",
+ "src/trace_processor/tables/slice_tables_py.h",
+ "src/trace_processor/tables/trace_proto_tables_py.h",
"src/trace_processor/tables/track_tables_py.h",
],
)
diff --git a/src/trace_processor/importers/proto/heap_graph_tracker.cc b/src/trace_processor/importers/proto/heap_graph_tracker.cc
index 39e1418..fecdbbf 100644
--- a/src/trace_processor/importers/proto/heap_graph_tracker.cc
+++ b/src/trace_processor/importers/proto/heap_graph_tracker.cc
@@ -21,7 +21,7 @@
#include "perfetto/ext/base/string_splitter.h"
#include "perfetto/ext/base/string_utils.h"
#include "src/trace_processor/importers/proto/profiler_util.h"
-#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
namespace perfetto {
namespace trace_processor {
@@ -938,7 +938,7 @@
std::unique_ptr<tables::ExperimentalFlamegraphNodesTable> tbl(
new tables::ExperimentalFlamegraphNodesTable(
- storage_->mutable_string_pool(), nullptr));
+ storage_->mutable_string_pool()));
auto it = roots_.find(std::make_pair(current_upid, current_ts));
if (it == roots_.end()) {
diff --git a/src/trace_processor/importers/proto/memory_tracker_snapshot_parser.cc b/src/trace_processor/importers/proto/memory_tracker_snapshot_parser.cc
index 3c1683f..a308351 100644
--- a/src/trace_processor/importers/proto/memory_tracker_snapshot_parser.cc
+++ b/src/trace_processor/importers/proto/memory_tracker_snapshot_parser.cc
@@ -20,7 +20,7 @@
#include "protos/perfetto/trace/memory_graph.pbzero.h"
#include "src/trace_processor/containers/string_pool.h"
#include "src/trace_processor/importers/common/args_tracker.h"
-#include "src/trace_processor/tables/memory_tables.h"
+#include "src/trace_processor/tables/memory_tables_py.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/proto/profile_module.cc b/src/trace_processor/importers/proto/profile_module.cc
index 6294782..ec860da 100644
--- a/src/trace_processor/importers/proto/profile_module.cc
+++ b/src/trace_processor/importers/proto/profile_module.cc
@@ -34,7 +34,7 @@
#include "src/trace_processor/sorter/trace_sorter.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
-#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "src/trace_processor/util/stack_traces_util.h"
diff --git a/src/trace_processor/importers/proto/stack_profile_tracker.h b/src/trace_processor/importers/proto/stack_profile_tracker.h
index fb5e728..c88f2f3 100644
--- a/src/trace_processor/importers/proto/stack_profile_tracker.h
+++ b/src/trace_processor/importers/proto/stack_profile_tracker.h
@@ -22,7 +22,7 @@
#include "perfetto/ext/base/optional.h"
#include "src/trace_processor/storage/trace_storage.h"
-#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
#include "protos/perfetto/trace/profiling/profile_common.pbzero.h"
#include "protos/perfetto/trace/profiling/profile_packet.pbzero.h"
diff --git a/src/trace_processor/prelude/table_functions/ancestor.h b/src/trace_processor/prelude/table_functions/ancestor.h
index 4b3ffec..eff2c7d 100644
--- a/src/trace_processor/prelude/table_functions/ancestor.h
+++ b/src/trace_processor/prelude/table_functions/ancestor.h
@@ -20,6 +20,8 @@
#include "perfetto/ext/base/optional.h"
#include "src/trace_processor/prelude/table_functions/table_function.h"
#include "src/trace_processor/storage/trace_storage.h"
+#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/slice_tables.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/prelude/table_functions/connected_flow.h b/src/trace_processor/prelude/table_functions/connected_flow.h
index faf3f71..c05e25e 100644
--- a/src/trace_processor/prelude/table_functions/connected_flow.h
+++ b/src/trace_processor/prelude/table_functions/connected_flow.h
@@ -19,6 +19,7 @@
#include "src/trace_processor/prelude/table_functions/table_function.h"
#include "src/trace_processor/storage/trace_storage.h"
+#include "src/trace_processor/tables/flow_tables.h"
#include <queue>
#include <set>
diff --git a/src/trace_processor/prelude/table_functions/experimental_counter_dur.cc b/src/trace_processor/prelude/table_functions/experimental_counter_dur.cc
index 2f2fbcd..3513c89 100644
--- a/src/trace_processor/prelude/table_functions/experimental_counter_dur.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_counter_dur.cc
@@ -16,6 +16,8 @@
#include "src/trace_processor/prelude/table_functions/experimental_counter_dur.h"
+#include "src/trace_processor/tables/counter_tables.h"
+
namespace perfetto {
namespace trace_processor {
namespace tables {
diff --git a/src/trace_processor/prelude/table_functions/experimental_counter_dur_unittest.cc b/src/trace_processor/prelude/table_functions/experimental_counter_dur_unittest.cc
index d194b23..d812394 100644
--- a/src/trace_processor/prelude/table_functions/experimental_counter_dur_unittest.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_counter_dur_unittest.cc
@@ -31,7 +31,7 @@
TEST(ExperimentalCounterDur, SmokeDur) {
StringPool pool;
- tables::CounterTable table(&pool, nullptr);
+ tables::CounterTable table(&pool);
table.Insert(CounterRow(100 /* ts */, 1 /* track_id */));
table.Insert(CounterRow(102 /* ts */, 2 /* track_id */));
diff --git a/src/trace_processor/prelude/table_functions/experimental_flamegraph.cc b/src/trace_processor/prelude/table_functions/experimental_flamegraph.cc
index 790ce96..f3fe53b 100644
--- a/src/trace_processor/prelude/table_functions/experimental_flamegraph.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_flamegraph.cc
@@ -213,7 +213,7 @@
ComputeFocusedState(*in, Matcher(focus_str));
std::unique_ptr<ExperimentalFlamegraphNodesTable> tbl(
new tables::ExperimentalFlamegraphNodesTable(
- storage->mutable_string_pool(), nullptr));
+ storage->mutable_string_pool()));
// Recompute cumulative counts
std::vector<CumulativeCounts> node_to_cumulatives(in->row_count());
diff --git a/src/trace_processor/prelude/table_functions/experimental_flat_slice.cc b/src/trace_processor/prelude/table_functions/experimental_flat_slice.cc
index 41e7e01..9b38f80 100644
--- a/src/trace_processor/prelude/table_functions/experimental_flat_slice.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_flat_slice.cc
@@ -74,7 +74,7 @@
int64_t start_bound,
int64_t end_bound) {
std::unique_ptr<tables::ExperimentalFlatSliceTable> out(
- new tables::ExperimentalFlatSliceTable(pool, nullptr));
+ new tables::ExperimentalFlatSliceTable(pool));
auto insert_slice = [&](uint32_t i, int64_t ts,
tables::TrackTable::Id track_id) {
diff --git a/src/trace_processor/prelude/table_functions/experimental_flat_slice_unittest.cc b/src/trace_processor/prelude/table_functions/experimental_flat_slice_unittest.cc
index 8218acc..3d6a0f6 100644
--- a/src/trace_processor/prelude/table_functions/experimental_flat_slice_unittest.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_flat_slice_unittest.cc
@@ -69,7 +69,7 @@
TEST(ExperimentalFlatSlice, Smoke) {
StringPool pool;
TableInseter inserter;
- tables::SliceTable table(&pool, nullptr);
+ tables::SliceTable table(&pool);
// A simple stack on track 1.
inserter.Insert(100, 10, 0, TrackId{1});
@@ -136,7 +136,7 @@
TEST(ExperimentalFlatSlice, Bounds) {
StringPool pool;
TableInseter inserter;
- tables::SliceTable table(&pool, nullptr);
+ tables::SliceTable table(&pool);
/// Our timebounds is between 200 and 300.
int64_t start = 200;
diff --git a/src/trace_processor/prelude/table_functions/experimental_slice_layout_unittest.cc b/src/trace_processor/prelude/table_functions/experimental_slice_layout_unittest.cc
index 37079a7..fe2a210 100644
--- a/src/trace_processor/prelude/table_functions/experimental_slice_layout_unittest.cc
+++ b/src/trace_processor/prelude/table_functions/experimental_slice_layout_unittest.cc
@@ -96,7 +96,7 @@
TEST(ExperimentalSliceLayoutTest, SingleRow) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name = pool.InternString("SingleRow");
Insert(&slice_table, 1 /*ts*/, 5 /*dur*/, 1 /*track_id*/, name,
@@ -116,7 +116,7 @@
TEST(ExperimentalSliceLayoutTest, DoubleRow) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name = pool.InternString("SingleRow");
auto id = Insert(&slice_table, 1 /*ts*/, 5 /*dur*/, 1 /*track_id*/, name,
@@ -138,7 +138,7 @@
TEST(ExperimentalSliceLayoutTest, MultipleRows) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name = pool.InternString("MultipleRows");
auto a = Insert(&slice_table, 1 /*ts*/, 5 /*dur*/, 1 /*track_id*/, name,
@@ -167,7 +167,7 @@
TEST(ExperimentalSliceLayoutTest, MultipleTracks) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name1 = pool.InternString("Slice1");
StringId name2 = pool.InternString("Slice2");
StringId name3 = pool.InternString("Slice3");
@@ -199,7 +199,7 @@
TEST(ExperimentalSliceLayoutTest, MultipleTracksWithGap) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name1 = pool.InternString("Slice1");
StringId name2 = pool.InternString("Slice2");
StringId name3 = pool.InternString("Slice3");
@@ -237,7 +237,7 @@
TEST(ExperimentalSliceLayoutTest, PreviousGroupFullyNested) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name = pool.InternString("Slice");
// This test ensures that our bounding box logic works when the bounding box
@@ -285,7 +285,7 @@
TEST(ExperimentalSliceLayoutTest, FilterOutTracks) {
StringPool pool;
- tables::SliceTable slice_table(&pool, nullptr);
+ tables::SliceTable slice_table(&pool);
StringId name1 = pool.InternString("Slice1");
StringId name2 = pool.InternString("Slice2");
StringId name3 = pool.InternString("Slice3");
diff --git a/src/trace_processor/prelude/table_functions/flamegraph_construction_algorithms.cc b/src/trace_processor/prelude/table_functions/flamegraph_construction_algorithms.cc
index e47c63c..70509d5 100644
--- a/src/trace_processor/prelude/table_functions/flamegraph_construction_algorithms.cc
+++ b/src/trace_processor/prelude/table_functions/flamegraph_construction_algorithms.cc
@@ -104,7 +104,7 @@
std::unique_ptr<tables::ExperimentalFlamegraphNodesTable> tbl(
new tables::ExperimentalFlamegraphNodesTable(
- storage->mutable_string_pool(), nullptr));
+ storage->mutable_string_pool()));
// FORWARD PASS:
// Aggregate callstacks by frame name / mapping name. Use symbolization
@@ -405,7 +405,7 @@
if (filtered.row_count() == 0) {
std::unique_ptr<tables::ExperimentalFlamegraphNodesTable> empty_tbl(
new tables::ExperimentalFlamegraphNodesTable(
- storage->mutable_string_pool(), nullptr));
+ storage->mutable_string_pool()));
return empty_tbl;
}
diff --git a/src/trace_processor/storage/trace_storage.h b/src/trace_processor/storage/trace_storage.h
index 2fd2b24..5443165 100644
--- a/src/trace_processor/storage/trace_storage.h
+++ b/src/trace_processor/storage/trace_storage.h
@@ -36,14 +36,14 @@
#include "src/trace_processor/containers/string_pool.h"
#include "src/trace_processor/storage/metadata.h"
#include "src/trace_processor/storage/stats.h"
-#include "src/trace_processor/tables/android_tables.h"
-#include "src/trace_processor/tables/counter_tables.h"
-#include "src/trace_processor/tables/flow_tables.h"
-#include "src/trace_processor/tables/memory_tables.h"
-#include "src/trace_processor/tables/metadata_tables.h"
-#include "src/trace_processor/tables/profiler_tables.h"
-#include "src/trace_processor/tables/slice_tables.h"
-#include "src/trace_processor/tables/trace_proto_tables.h"
+#include "src/trace_processor/tables/android_tables_py.h"
+#include "src/trace_processor/tables/counter_tables_py.h"
+#include "src/trace_processor/tables/flow_tables_py.h"
+#include "src/trace_processor/tables/memory_tables_py.h"
+#include "src/trace_processor/tables/metadata_tables_py.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
+#include "src/trace_processor/tables/slice_tables_py.h"
+#include "src/trace_processor/tables/trace_proto_tables_py.h"
#include "src/trace_processor/tables/track_tables_py.h"
#include "src/trace_processor/types/variadic.h"
#include "src/trace_processor/views/slice_views.h"
@@ -827,14 +827,14 @@
// Extra data extracted from the trace. Includes:
// * metadata from chrome and benchmarking infrastructure
// * descriptions of android packages
- tables::MetadataTable metadata_table_{&string_pool_, nullptr};
+ tables::MetadataTable metadata_table_{&string_pool_};
// Contains data from all the clock snapshots in the trace.
- tables::ClockSnapshotTable clock_snapshot_table_{&string_pool_, nullptr};
+ tables::ClockSnapshotTable clock_snapshot_table_{&string_pool_};
// Metadata for tracks.
tables::TrackTable track_table_{&string_pool_};
- tables::ThreadStateTable thread_state_table_{&string_pool_, nullptr};
+ tables::ThreadStateTable thread_state_table_{&string_pool_};
tables::CpuTrackTable cpu_track_table_{&string_pool_, &track_table_};
tables::GpuTrackTable gpu_track_table_{&string_pool_, &track_table_};
tables::ProcessTrackTable process_track_table_{&string_pool_, &track_table_};
@@ -860,26 +860,26 @@
&counter_track_table_};
tables::EnergyPerUidCounterTrackTable energy_per_uid_counter_track_table_{
&string_pool_, &uid_counter_track_table_};
- tables::GpuCounterGroupTable gpu_counter_group_table_{&string_pool_, nullptr};
+ tables::GpuCounterGroupTable gpu_counter_group_table_{&string_pool_};
tables::PerfCounterTrackTable perf_counter_track_table_{
&string_pool_, &counter_track_table_};
// Args for all other tables.
- tables::ArgTable arg_table_{&string_pool_, nullptr};
+ tables::ArgTable arg_table_{&string_pool_};
// Information about all the threads and processes in the trace.
tables::ThreadTable thread_table_{&string_pool_};
tables::ProcessTable process_table_{&string_pool_};
- tables::FiledescriptorTable filedescriptor_table_{&string_pool_, nullptr};
+ tables::FiledescriptorTable filedescriptor_table_{&string_pool_};
// Slices coming from userspace events (e.g. Chromium TRACE_EVENT macros).
- tables::SliceTable slice_table_{&string_pool_, nullptr};
+ tables::SliceTable slice_table_{&string_pool_};
// Flow events from userspace events (e.g. Chromium TRACE_EVENT macros).
- tables::FlowTable flow_table_{&string_pool_, nullptr};
+ tables::FlowTable flow_table_{&string_pool_};
// Slices from CPU scheduling data.
- tables::SchedSliceTable sched_slice_table_{&string_pool_, nullptr};
+ tables::SchedSliceTable sched_slice_table_{&string_pool_};
// Additional attributes for virtual track slices (sub-type of
// NestableSlices).
@@ -891,7 +891,7 @@
// The values from the Counter events from the trace. This includes CPU
// frequency events as well systrace trace_marker counter events.
- tables::CounterTable counter_table_{&string_pool_, nullptr};
+ tables::CounterTable counter_table_{&string_pool_};
SqlStats sql_stats_;
@@ -899,55 +899,49 @@
// the timestamp and the pid. The args for the raw event will be in the
// args table. This table can be used to generate a text version of the
// trace.
- tables::RawTable raw_table_{&string_pool_, nullptr};
+ tables::RawTable raw_table_{&string_pool_};
- tables::CpuTable cpu_table_{&string_pool_, nullptr};
+ tables::CpuTable cpu_table_{&string_pool_};
- tables::CpuFreqTable cpu_freq_table_{&string_pool_, nullptr};
+ tables::CpuFreqTable cpu_freq_table_{&string_pool_};
tables::AndroidLogTable android_log_table_{&string_pool_};
- tables::AndroidDumpstateTable android_dumpstate_table_{&string_pool_,
- nullptr};
+ tables::AndroidDumpstateTable android_dumpstate_table_{&string_pool_};
- tables::StackProfileMappingTable stack_profile_mapping_table_{&string_pool_,
- nullptr};
- tables::StackProfileFrameTable stack_profile_frame_table_{&string_pool_,
- nullptr};
- tables::StackProfileCallsiteTable stack_profile_callsite_table_{&string_pool_,
- nullptr};
- tables::StackSampleTable stack_sample_table_{&string_pool_, nullptr};
+ tables::StackProfileMappingTable stack_profile_mapping_table_{&string_pool_};
+ tables::StackProfileFrameTable stack_profile_frame_table_{&string_pool_};
+ tables::StackProfileCallsiteTable stack_profile_callsite_table_{
+ &string_pool_};
+ tables::StackSampleTable stack_sample_table_{&string_pool_};
tables::HeapProfileAllocationTable heap_profile_allocation_table_{
- &string_pool_, nullptr};
+ &string_pool_};
tables::CpuProfileStackSampleTable cpu_profile_stack_sample_table_{
&string_pool_, &stack_sample_table_};
- tables::PerfSampleTable perf_sample_table_{&string_pool_, nullptr};
- tables::PackageListTable package_list_table_{&string_pool_, nullptr};
+ tables::PerfSampleTable perf_sample_table_{&string_pool_};
+ tables::PackageListTable package_list_table_{&string_pool_};
tables::AndroidGameInterventionListTable
- android_game_intervention_list_table_{&string_pool_, nullptr};
- tables::ProfilerSmapsTable profiler_smaps_table_{&string_pool_, nullptr};
+ android_game_intervention_list_table_{&string_pool_};
+ tables::ProfilerSmapsTable profiler_smaps_table_{&string_pool_};
// Symbol tables (mappings from frames to symbol names)
- tables::SymbolTable symbol_table_{&string_pool_, nullptr};
- tables::HeapGraphObjectTable heap_graph_object_table_{&string_pool_, nullptr};
- tables::HeapGraphClassTable heap_graph_class_table_{&string_pool_, nullptr};
- tables::HeapGraphReferenceTable heap_graph_reference_table_{&string_pool_,
- nullptr};
+ tables::SymbolTable symbol_table_{&string_pool_};
+ tables::HeapGraphObjectTable heap_graph_object_table_{&string_pool_};
+ tables::HeapGraphClassTable heap_graph_class_table_{&string_pool_};
+ tables::HeapGraphReferenceTable heap_graph_reference_table_{&string_pool_};
tables::VulkanMemoryAllocationsTable vulkan_memory_allocations_table_{
- &string_pool_, nullptr};
+ &string_pool_};
tables::GraphicsFrameSliceTable graphics_frame_slice_table_{&string_pool_,
&slice_table_};
// Metadata for memory snapshot.
- tables::MemorySnapshotTable memory_snapshot_table_{&string_pool_, nullptr};
+ tables::MemorySnapshotTable memory_snapshot_table_{&string_pool_};
tables::ProcessMemorySnapshotTable process_memory_snapshot_table_{
- &string_pool_, nullptr};
- tables::MemorySnapshotNodeTable memory_snapshot_node_table_{&string_pool_,
- nullptr};
- tables::MemorySnapshotEdgeTable memory_snapshot_edge_table_{&string_pool_,
- nullptr};
+ &string_pool_};
+ tables::MemorySnapshotNodeTable memory_snapshot_node_table_{&string_pool_};
+ tables::MemorySnapshotEdgeTable memory_snapshot_edge_table_{&string_pool_};
// FrameTimeline tables
tables::ExpectedFrameTimelineSliceTable expected_frame_timeline_slice_table_{
@@ -956,12 +950,12 @@
&string_pool_, &slice_table_};
tables::ExperimentalProtoPathTable experimental_proto_path_table_{
- &string_pool_, nullptr};
+ &string_pool_};
tables::ExperimentalProtoContentTable experimental_proto_content_table_{
- &string_pool_, nullptr};
+ &string_pool_};
tables::ExpMissingChromeProcTable
- experimental_missing_chrome_processes_table_{&string_pool_, nullptr};
+ experimental_missing_chrome_processes_table_{&string_pool_};
views::ThreadSliceView thread_slice_view_{&slice_table_, &thread_track_table_,
&thread_table_};
diff --git a/src/trace_processor/tables/BUILD.gn b/src/trace_processor/tables/BUILD.gn
index 4e578cb..83145a4 100644
--- a/src/trace_processor/tables/BUILD.gn
+++ b/src/trace_processor/tables/BUILD.gn
@@ -18,7 +18,13 @@
perfetto_tp_tables("tables_python") {
sources = [
"android_tables.py",
+ "counter_tables.py",
+ "flow_tables.py",
+ "memory_tables.py",
"metadata_tables.py",
+ "profiler_tables.py",
+ "slice_tables.py",
+ "trace_proto_tables.py",
"track_tables.py",
]
generate_docs = true
@@ -26,17 +32,13 @@
source_set("tables") {
sources = [
- "android_tables.h",
"counter_tables.h",
"flow_tables.h",
"macros.h",
"macros_internal.h",
- "memory_tables.h",
- "metadata_tables.h",
"profiler_tables.h",
"slice_tables.h",
"table_destructors.cc",
- "trace_proto_tables.h",
]
deps = [
"../../../gn:default_deps",
diff --git a/src/trace_processor/tables/android_tables.h b/src/trace_processor/tables/android_tables.h
deleted file mode 100644
index 1f46c16..0000000
--- a/src/trace_processor/tables/android_tables.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#ifndef SRC_TRACE_PROCESSOR_TABLES_ANDROID_TABLES_H_
-#define SRC_TRACE_PROCESSOR_TABLES_ANDROID_TABLES_H_
-
-#include "src/trace_processor/tables/android_tables_py.h"
-#include "src/trace_processor/tables/macros.h"
-
-namespace perfetto {
-namespace trace_processor {
-namespace tables {
-
-// 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 standard_mode_supported bool whether standard mode is supported.
-// @param standard_mode_downscale resolution downscaling factor of standard
-// mode.
-// @param standard_mode_use_angle bool whether ANGLE is used in standard mode.
-// @param standard_mode_fps frame rate that the game is throttled at in standard
-// mode.
-// @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, standard_mode_supported) \
- C(base::Optional<double>, standard_mode_downscale) \
- C(base::Optional<int32_t>, standard_mode_use_angle) \
- C(base::Optional<double>, standard_mode_fps) \
- C(int32_t, perf_mode_supported) \
- C(base::Optional<double>, perf_mode_downscale) \
- C(base::Optional<int32_t>, perf_mode_use_angle) \
- C(base::Optional<double>, perf_mode_fps) \
- C(int32_t, battery_mode_supported) \
- C(base::Optional<double>, battery_mode_downscale) \
- C(base::Optional<int32_t>, battery_mode_use_angle) \
- C(base::Optional<double>, battery_mode_fps)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_ANDROID_GAME_INTERVENTION_LIST_DEF);
-
-// Dumpsys entries from Android dumpstate.
-//
-// @param section name of the dumpstate section.
-// @param service name of the dumpsys service. Only present when
-// dumpstate=="dumpsys", NULL otherwise.
-// @param line line-by-line contents of the section/service, one row per line.
-// @tablegroup Events
-#define PERFETTO_TP_ANDROID_DUMPSTATE_TABLE_DEF(NAME, PARENT, C) \
- NAME(AndroidDumpstateTable, "android_dumpstate") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(base::Optional<StringPool::Id>, section) \
- C(base::Optional<StringPool::Id>, service) \
- C(StringPool::Id, line)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_ANDROID_DUMPSTATE_TABLE_DEF);
-
-} // namespace tables
-} // namespace trace_processor
-} // namespace perfetto
-
-#endif // SRC_TRACE_PROCESSOR_TABLES_ANDROID_TABLES_H_
diff --git a/src/trace_processor/tables/android_tables.py b/src/trace_processor/tables/android_tables.py
index dc1b96f..b77afcb 100644
--- a/src/trace_processor/tables/android_tables.py
+++ b/src/trace_processor/tables/android_tables.py
@@ -14,13 +14,17 @@
"""Contains tables for relevant for Android."""
from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import CppDouble
+from python.generators.trace_processor_table.public import CppInt32
from python.generators.trace_processor_table.public import CppInt64
from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import CppSelfTableId
from python.generators.trace_processor_table.public import CppString
from python.generators.trace_processor_table.public import Table
from python.generators.trace_processor_table.public import TableDoc
from python.generators.trace_processor_table.public import CppTableId
from python.generators.trace_processor_table.public import CppUint32
+
from src.trace_processor.tables.metadata_tables import THREAD_TABLE
ANDROID_LOG_TABLE = Table(
@@ -49,7 +53,109 @@
'msg': 'Content of the log entry.'
}))
+ANDROID_GAME_INTERVENTION_LIST_TABLE = Table(
+ class_name='AndroidGameInterventionListTable',
+ sql_name='android_game_intervention_list',
+ columns=[
+ C('package_name', CppString()),
+ C('uid', CppInt64()),
+ C('current_mode', CppInt32()),
+ C('standard_mode_supported', CppInt32()),
+ C('standard_mode_downscale', CppOptional(CppDouble())),
+ C('standard_mode_use_angle', CppOptional(CppInt32())),
+ C('standard_mode_fps', CppOptional(CppDouble())),
+ C('perf_mode_supported', CppInt32()),
+ C('perf_mode_downscale', CppOptional(CppDouble())),
+ C('perf_mode_use_angle', CppOptional(CppInt32())),
+ C('perf_mode_fps', CppOptional(CppDouble())),
+ C('battery_mode_supported', CppInt32()),
+ C('battery_mode_downscale', CppOptional(CppDouble())),
+ C('battery_mode_use_angle', CppOptional(CppInt32())),
+ C('battery_mode_fps', CppOptional(CppDouble())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ A table presenting all game modes and interventions
+of games installed on the system.
+This is generated by the game_mode_intervention data-source.
+ ''',
+ group='Misc',
+ columns={
+ 'package_name':
+ '''name of the pakcage, e.g. com.google.android.gm.''',
+ 'uid':
+ '''UID processes of this package runs as.''',
+ 'current_mode':
+ '''current game mode the game is running at.''',
+ 'standard_mode_supported':
+ '''bool whether standard mode is supported.''',
+ 'standard_mode_downscale':
+ '''
+ resolution downscaling factor of standard
+ mode.
+ ''',
+ 'standard_mode_use_angle':
+ '''bool whether ANGLE is used in standard mode.''',
+ 'standard_mode_fps':
+ '''
+ frame rate that the game is throttled at in standard
+ mode.
+ ''',
+ 'perf_mode_supported':
+ '''bool whether performance mode is supported.''',
+ 'perf_mode_downscale':
+ '''resolution downscaling factor of performance mode.''',
+ 'perf_mode_use_angle':
+ '''bool whether ANGLE is used in performance mode.''',
+ 'perf_mode_fps':
+ '''
+ frame rate that the game is throttled at in performance
+ mode.
+ ''',
+ 'battery_mode_supported':
+ '''bool whether battery mode is supported.''',
+ 'battery_mode_downscale':
+ '''resolution downscaling factor of battery mode.''',
+ 'battery_mode_use_angle':
+ '''bool whether ANGLE is used in battery mode.''',
+ 'battery_mode_fps':
+ '''
+ frame rate that the game is throttled at in battery
+ mode.
+ '''
+ }))
+
+ANDROID_DUMPSTATE_TABLE = Table(
+ class_name='AndroidDumpstateTable',
+ sql_name='android_dumpstate',
+ columns=[
+ C('section', CppOptional(CppString())),
+ C('service', CppOptional(CppString())),
+ C('line', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Dumpsys entries from Android dumpstate.
+ ''',
+ group='Events',
+ columns={
+ 'section':
+ '''name of the dumpstate section.''',
+ 'service':
+ '''
+ name of the dumpsys service. Only present when
+ dumpstate=="dumpsys", NULL otherwise.
+ ''',
+ 'line':
+ '''
+ line-by-line contents of the section/service,
+ one row per line.
+ '''
+ }))
+
# Keep this list sorted.
ALL_TABLES = [
ANDROID_LOG_TABLE,
+ ANDROID_DUMPSTATE_TABLE,
+ ANDROID_GAME_INTERVENTION_LIST_TABLE,
]
diff --git a/src/trace_processor/tables/counter_tables.h b/src/trace_processor/tables/counter_tables.h
index e051980..7df627b 100644
--- a/src/trace_processor/tables/counter_tables.h
+++ b/src/trace_processor/tables/counter_tables.h
@@ -34,8 +34,6 @@
C(double, value) \
C(base::Optional<uint32_t>, arg_set_id)
-PERFETTO_TP_TABLE(PERFETTO_TP_COUNTER_TABLE_DEF);
-
} // namespace tables
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/tables/counter_tables.py b/src/trace_processor/tables/counter_tables.py
new file mode 100644
index 0000000..1dd6495
--- /dev/null
+++ b/src/trace_processor/tables/counter_tables.py
@@ -0,0 +1,50 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import CppDouble
+from python.generators.trace_processor_table.public import ColumnFlag
+from python.generators.trace_processor_table.public import CppInt64
+from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+
+from src.trace_processor.tables.track_tables import COUNTER_TRACK_TABLE
+
+COUNTER_TABLE = Table(
+ class_name='CounterTable',
+ sql_name='counter',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('track_id', CppTableId(COUNTER_TRACK_TABLE)),
+ C('value', CppDouble()),
+ C('arg_set_id', CppOptional(CppUint32())),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Events',
+ columns={
+ 'ts': '''''',
+ 'track_id': '''''',
+ 'value': '''''',
+ 'arg_set_id': '''''',
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ COUNTER_TABLE,
+]
diff --git a/src/trace_processor/tables/flow_tables.h b/src/trace_processor/tables/flow_tables.h
index 1023836..a00ee89 100644
--- a/src/trace_processor/tables/flow_tables.h
+++ b/src/trace_processor/tables/flow_tables.h
@@ -32,8 +32,6 @@
C(SliceTable::Id, slice_in) \
C(uint32_t, arg_set_id)
-PERFETTO_TP_TABLE(PERFETTO_TP_FLOW_TABLE_DEF);
-
} // namespace tables
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/tables/flow_tables.py b/src/trace_processor/tables/flow_tables.py
new file mode 100644
index 0000000..0491a31
--- /dev/null
+++ b/src/trace_processor/tables/flow_tables.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+
+from src.trace_processor.tables.slice_tables import SLICE_TABLE
+
+FLOW_TABLE = Table(
+ class_name='FlowTable',
+ sql_name='flow',
+ columns=[
+ C('slice_out', CppTableId(SLICE_TABLE)),
+ C('slice_in', CppTableId(SLICE_TABLE)),
+ C('arg_set_id', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'arg_set_id': '''''',
+ 'slice_out': '''''',
+ 'slice_in': ''''''
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ FLOW_TABLE,
+]
diff --git a/src/trace_processor/tables/memory_tables.h b/src/trace_processor/tables/memory_tables.h
deleted file mode 100644
index aa09667..0000000
--- a/src/trace_processor/tables/memory_tables.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#ifndef SRC_TRACE_PROCESSOR_TABLES_MEMORY_TABLES_H_
-#define SRC_TRACE_PROCESSOR_TABLES_MEMORY_TABLES_H_
-
-#include "src/trace_processor/tables/macros.h"
-#include "src/trace_processor/tables/track_tables_py.h"
-
-namespace perfetto {
-namespace trace_processor {
-namespace tables {
-
-// @tablegroup Memory Snapshots
-#define PERFETTO_TP_MEMORY_SNAPSHOT_DEF(NAME, PARENT, C) \
- NAME(MemorySnapshotTable, "memory_snapshot") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, timestamp) \
- C(TrackTable::Id, track_id) \
- C(StringPool::Id, detail_level)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_MEMORY_SNAPSHOT_DEF);
-
-// @tablegroup Memory Snapshots
-#define PERFETTO_TP_PROCESS_MEMORY_SNAPSHOT_DEF(NAME, PARENT, C) \
- NAME(ProcessMemorySnapshotTable, "process_memory_snapshot") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(MemorySnapshotTable::Id, snapshot_id) \
- C(uint32_t, upid)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_PROCESS_MEMORY_SNAPSHOT_DEF);
-
-// @tablegroup Memory Snapshots
-#define PERFETTO_TP_MEMORY_SNAPSHOT_NODE_DEF(NAME, PARENT, C) \
- NAME(MemorySnapshotNodeTable, "memory_snapshot_node") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(ProcessMemorySnapshotTable::Id, process_snapshot_id) \
- C(base::Optional<MemorySnapshotNodeTable::Id>, parent_node_id) \
- C(StringPool::Id, path) \
- C(int64_t, size) \
- C(int64_t, effective_size) \
- C(base::Optional<uint32_t>, arg_set_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_MEMORY_SNAPSHOT_NODE_DEF);
-
-// @tablegroup Memory Snapshots
-#define PERFETTO_TP_MEMORY_SNAPSHOT_EDGE_DEF(NAME, PARENT, C) \
- NAME(MemorySnapshotEdgeTable, "memory_snapshot_edge") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(MemorySnapshotNodeTable::Id, source_node_id) \
- C(MemorySnapshotNodeTable::Id, target_node_id) \
- C(uint32_t, importance)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_MEMORY_SNAPSHOT_EDGE_DEF);
-
-} // namespace tables
-} // namespace trace_processor
-} // namespace perfetto
-
-#endif // SRC_TRACE_PROCESSOR_TABLES_MEMORY_TABLES_H_
diff --git a/src/trace_processor/tables/memory_tables.py b/src/trace_processor/tables/memory_tables.py
new file mode 100644
index 0000000..65263f8
--- /dev/null
+++ b/src/trace_processor/tables/memory_tables.py
@@ -0,0 +1,106 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import CppInt64
+from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import CppSelfTableId
+from python.generators.trace_processor_table.public import CppString
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+
+from src.trace_processor.tables.track_tables import TRACK_TABLE
+
+MEMORY_SNAPSHOT_TABLE = Table(
+ class_name='MemorySnapshotTable',
+ sql_name='memory_snapshot',
+ columns=[
+ C('timestamp', CppInt64()),
+ C('track_id', CppTableId(TRACK_TABLE)),
+ C('detail_level', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Memory Snapshots',
+ columns={
+ 'timestamp': '''''',
+ 'track_id': '''''',
+ 'detail_level': ''''''
+ }))
+
+PROCESS_MEMORY_SNAPSHOT_TABLE = Table(
+ class_name='ProcessMemorySnapshotTable',
+ sql_name='process_memory_snapshot',
+ columns=[
+ C('snapshot_id', CppTableId(MEMORY_SNAPSHOT_TABLE)),
+ C('upid', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Memory Snapshots',
+ columns={
+ 'snapshot_id': '''''',
+ 'upid': ''''''
+ }))
+
+MEMORY_SNAPSHOT_NODE_TABLE = Table(
+ class_name='MemorySnapshotNodeTable',
+ sql_name='memory_snapshot_node',
+ columns=[
+ C('process_snapshot_id', CppTableId(PROCESS_MEMORY_SNAPSHOT_TABLE)),
+ C('parent_node_id', CppOptional(CppSelfTableId())),
+ C('path', CppString()),
+ C('size', CppInt64()),
+ C('effective_size', CppInt64()),
+ C('arg_set_id', CppOptional(CppUint32())),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Memory Snapshots',
+ columns={
+ 'process_snapshot_id': '''''',
+ 'parent_node_id': '''''',
+ 'path': '''''',
+ 'size': '''''',
+ 'effective_size': '''''',
+ 'arg_set_id': ''''''
+ }))
+
+MEMORY_SNAPSHOT_EDGE_TABLE = Table(
+ class_name='MemorySnapshotEdgeTable',
+ sql_name='memory_snapshot_edge',
+ columns=[
+ C('source_node_id', CppTableId(MEMORY_SNAPSHOT_NODE_TABLE)),
+ C('target_node_id', CppTableId(MEMORY_SNAPSHOT_NODE_TABLE)),
+ C('importance', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Memory Snapshots',
+ columns={
+ 'source_node_id': '''''',
+ 'target_node_id': '''''',
+ 'importance': ''''''
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ MEMORY_SNAPSHOT_EDGE_TABLE,
+ MEMORY_SNAPSHOT_NODE_TABLE,
+ MEMORY_SNAPSHOT_TABLE,
+ PROCESS_MEMORY_SNAPSHOT_TABLE,
+]
diff --git a/src/trace_processor/tables/metadata_tables.h b/src/trace_processor/tables/metadata_tables.h
deleted file mode 100644
index 76768ed..0000000
--- a/src/trace_processor/tables/metadata_tables.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#ifndef SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
-#define SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
-
-#include "src/trace_processor/tables/macros.h"
-#include "src/trace_processor/tables/metadata_tables_py.h"
-
-namespace perfetto {
-namespace trace_processor {
-namespace tables {
-
-// @param arg_set_id {@joinable args.arg_set_id}
-#define PERFETTO_TP_RAW_TABLE_DEF(NAME, PARENT, C) \
- NAME(RawTable, "raw") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts, Column::Flag::kSorted) \
- C(StringPool::Id, name) \
- C(uint32_t, cpu) \
- C(uint32_t, utid) \
- C(uint32_t, arg_set_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_RAW_TABLE_DEF);
-
-// @name args
-#define PERFETTO_TP_ARG_TABLE_DEF(NAME, PARENT, C) \
- NAME(ArgTable, "internal_args") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, arg_set_id, Column::Flag::kSorted) \
- C(StringPool::Id, flat_key) \
- C(StringPool::Id, key) \
- C(base::Optional<int64_t>, int_value) \
- C(base::Optional<StringPool::Id>, string_value) \
- C(base::Optional<double>, real_value) \
- C(StringPool::Id, value_type)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_ARG_TABLE_DEF);
-
-#define PERFETTO_TP_METADATA_TABLE_DEF(NAME, PARENT, C) \
- NAME(MetadataTable, "metadata") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, name) \
- C(StringPool::Id, key_type) \
- C(base::Optional<int64_t>, int_value) \
- C(base::Optional<StringPool::Id>, str_value)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_METADATA_TABLE_DEF);
-
-// Contains information of filedescriptors collected during the trace
-//
-// @name filedescriptor
-// @param ufd {int64_t} Unique fd. This is != the OS fd.
-// This is a monotonic number associated to each
-// filedescriptor. The OS assigned fd cannot be used as
-// primary key because fds are recycled by most kernels.
-// @param fd The OS id for this process. Note: this is *not*
-// unique over the lifetime of the trace so cannot be
-// used as a primary key. Use |ufd| instead.
-// @param ts The timestamp for when the fd was collected.
-// @param upid {@joinable process.upid} The upid of the process which
-// opened the filedescriptor.
-// @param path The path to the file or device backing the fd
-// In case this was a socket the path will be the port
-// number.
-#define PERFETTO_TP_FILEDESCRIPTOR_TABLE_DEF(NAME, PARENT, C) \
- NAME(FiledescriptorTable, "filedescriptor") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, fd) \
- C(base::Optional<int64_t>, ts) \
- C(base::Optional<uint32_t>, upid) \
- C(base::Optional<StringPool::Id>, path)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_FILEDESCRIPTOR_TABLE_DEF);
-
-// Experimental table, subject to arbitrary breaking changes.
-#define PERFETTO_TP_EXP_MISSING_CHROME_PROC_TABLE_DEF(NAME, PARENT, C) \
- NAME(ExpMissingChromeProcTable, "experimental_missing_chrome_processes") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, upid) \
- C(base::Optional<int64_t>, reliable_from)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_EXP_MISSING_CHROME_PROC_TABLE_DEF);
-
-// Contains information of processes seen during the trace
-//
-// @name cpu
-// @param id id of this CPU
-// @param cluster_id the cluster id is shared by CPUs in
-// the same cluster
-// @param processor a string describing this core
-#define PERFETTO_TP_CPU_TABLE_DEF(NAME, PARENT, C) \
- NAME(CpuTable, "cpu") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, cluster_id) \
- C(StringPool::Id, processor)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_CPU_TABLE_DEF);
-
-#define PERFETTO_TP_CPU_FREQ_TABLE_DEF(NAME, PARENT, C) \
- NAME(CpuFreqTable, "cpu_freq") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(CpuTable::Id, cpu_id) \
- C(uint32_t, freq)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_CPU_FREQ_TABLE_DEF);
-
-// Contains all the mapping between clock snapshots and trace time.
-//
-// NOTE: this table is not sorted by timestamp; this is why we omit the
-// sorted flag on the ts column.
-//
-// @param ts timestamp of the snapshot in trace time.
-// @param clock_id id of the clock (corresponds to the id in the trace).
-// @param clock_name the name of the clock for builtin clocks or null
-// otherwise.
-// @param clock_value timestamp of the snapshot in clock time.
-// @param snapshot_id the index of this snapshot (only useful for debugging)
-#define PERFETTO_TP_CLOCK_SNAPSHOT_TABLE_DEF(NAME, PARENT, C) \
- NAME(ClockSnapshotTable, "clock_snapshot") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts) \
- C(int64_t, clock_id) \
- C(base::Optional<StringPool::Id>, clock_name) \
- C(int64_t, clock_value) \
- C(uint32_t, snapshot_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_CLOCK_SNAPSHOT_TABLE_DEF);
-
-} // namespace tables
-} // namespace trace_processor
-} // namespace perfetto
-
-#endif // SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
diff --git a/src/trace_processor/tables/metadata_tables.py b/src/trace_processor/tables/metadata_tables.py
index a0fb5ee..621f3fc 100644
--- a/src/trace_processor/tables/metadata_tables.py
+++ b/src/trace_processor/tables/metadata_tables.py
@@ -16,6 +16,8 @@
from python.generators.trace_processor_table.public import Alias
from python.generators.trace_processor_table.public import Column as C
from python.generators.trace_processor_table.public import ColumnDoc
+from python.generators.trace_processor_table.public import ColumnFlag
+from python.generators.trace_processor_table.public import CppDouble
from python.generators.trace_processor_table.public import CppInt64
from python.generators.trace_processor_table.public import CppOptional
from python.generators.trace_processor_table.public import CppString
@@ -156,8 +158,193 @@
'''
}))
+RAW_TABLE = Table(
+ class_name='RawTable',
+ sql_name='raw',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('name', CppString()),
+ C('cpu', CppUint32()),
+ C('utid', CppUint32()),
+ C('arg_set_id', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'arg_set_id': '''''',
+ 'ts': '''''',
+ 'name': '''''',
+ 'cpu': '''''',
+ 'utid': ''''''
+ }))
+
+ARG_TABLE = Table(
+ class_name='ArgTable',
+ sql_name='internal_args',
+ columns=[
+ C('arg_set_id', CppUint32(), flags=ColumnFlag.SORTED),
+ C('flat_key', CppString()),
+ C('key', CppString()),
+ C('int_value', CppOptional(CppInt64())),
+ C('string_value', CppOptional(CppString())),
+ C('real_value', CppOptional(CppDouble())),
+ C('value_type', CppString()),
+ ],
+ wrapping_sql_view=WrappingSqlView(view_name='args'),
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'arg_set_id': '''''',
+ 'flat_key': '''''',
+ 'key': '''''',
+ 'int_value': '''''',
+ 'string_value': '''''',
+ 'real_value': '''''',
+ 'value_type': ''''''
+ }))
+
+METADATA_TABLE = Table(
+ class_name='MetadataTable',
+ sql_name='metadata',
+ columns=[
+ C('name', CppString()),
+ C('key_type', CppString()),
+ C('int_value', CppOptional(CppInt64())),
+ C('str_value', CppOptional(CppString())),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'name': '''''',
+ 'key_type': '''''',
+ 'int_value': '''''',
+ 'str_value': ''''''
+ }))
+
+FILEDESCRIPTOR_TABLE = Table(
+ class_name='FiledescriptorTable',
+ sql_name='filedescriptor',
+ columns=[
+ C('ufd', CppInt64()),
+ C('fd', CppInt64()),
+ C('ts', CppOptional(CppInt64())),
+ C('upid', CppOptional(CppUint32())),
+ C('path', CppOptional(CppString())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Contains information of filedescriptors collected during the trace
+ ''',
+ group='Misc',
+ columns={
+ 'ufd':
+ '''Unique fd. This is != the OS fd.
+This is a monotonic number associated to each
+filedescriptor. The OS assigned fd cannot be used as
+primary key because fds are recycled by most kernels.''',
+ 'fd':
+ '''The OS id for this process. Note: this is *not*
+unique over the lifetime of the trace so cannot be
+used as a primary key. Use |ufd| instead.''',
+ 'ts':
+ '''The timestamp for when the fd was collected.''',
+ 'upid':
+ ''' The upid of the process which
+opened the filedescriptor.''',
+ 'path':
+ '''The path to the file or device backing the fd
+In case this was a socket the path will be the port
+number.'''
+ }))
+
+EXP_MISSING_CHROME_PROC_TABLE = Table(
+ class_name='ExpMissingChromeProcTable',
+ sql_name='experimental_missing_chrome_processes',
+ columns=[
+ C('upid', CppUint32()),
+ C('reliable_from', CppOptional(CppInt64())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Experimental table, subject to arbitrary breaking changes.
+ ''',
+ group='Misc',
+ columns={
+ 'upid': '''''',
+ 'reliable_from': ''''''
+ }))
+
+CPU_TABLE = Table(
+ class_name='CpuTable',
+ sql_name='cpu',
+ columns=[
+ C('cluster_id', CppUint32()),
+ C('processor', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Contains information of processes seen during the trace
+ ''',
+ group='Misc',
+ columns={
+ 'cluster_id':
+ '''the cluster id is shared by CPUs in
+the same cluster''',
+ 'processor':
+ '''a string describing this core'''
+ }))
+
+CPU_FREQ_TABLE = Table(
+ class_name='CpuFreqTable',
+ sql_name='cpu_freq',
+ columns=[
+ C('cpu_id', CppTableId(CPU_TABLE)),
+ C('freq', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''', group='Misc', columns={
+ 'cpu_id': '''''',
+ 'freq': ''''''
+ }))
+
+CLOCK_SNAPSHOT_TABLE = Table(
+ class_name='ClockSnapshotTable',
+ sql_name='clock_snapshot',
+ columns=[
+ C('ts', CppInt64()),
+ C('clock_id', CppInt64()),
+ C('clock_name', CppOptional(CppString())),
+ C('clock_value', CppInt64()),
+ C('snapshot_id', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Contains all the mapping between clock snapshots and trace time.
+
+NOTE: this table is not sorted by timestamp; this is why we omit the
+sorted flag on the ts column.
+ ''',
+ group='Misc',
+ columns={
+ 'ts':
+ '''timestamp of the snapshot in trace time.''',
+ 'clock_id':
+ '''id of the clock (corresponds to the id in the trace).''',
+ 'clock_name':
+ '''the name of the clock for builtin clocks or null
+otherwise.''',
+ 'clock_value':
+ '''timestamp of the snapshot in clock time.''',
+ 'snapshot_id':
+ '''the index of this snapshot (only useful for debugging)'''
+ }))
+
# Keep this list sorted.
ALL_TABLES = [
- THREAD_TABLE,
- PROCESS_TABLE,
+ ARG_TABLE, CLOCK_SNAPSHOT_TABLE, CPU_FREQ_TABLE, CPU_TABLE,
+ EXP_MISSING_CHROME_PROC_TABLE, FILEDESCRIPTOR_TABLE, METADATA_TABLE,
+ PROCESS_TABLE, RAW_TABLE, THREAD_TABLE
]
diff --git a/src/trace_processor/tables/profiler_tables.h b/src/trace_processor/tables/profiler_tables.h
index 3523b80..fad8cfc 100644
--- a/src/trace_processor/tables/profiler_tables.h
+++ b/src/trace_processor/tables/profiler_tables.h
@@ -24,108 +24,6 @@
namespace trace_processor {
namespace tables {
-// The profiler smaps contains the memory stats for virtual memory ranges
-// captured by the [heap profiler](/docs/data-sources/native-heap-profiler.md).
-// @param upid The UniquePID of the process {@joinable process.upid}.
-// @param ts Timestamp of the snapshot. Multiple rows will have the same
-// timestamp.
-// @param path The mmaped file, as per /proc/pid/smaps.
-// @param size_kb Total size of the mapping.
-// @param private_dirty_kb KB of this mapping that are private dirty RSS.
-// @param swap_kb KB of this mapping that are in swap.
-// @param file_name
-// @param start_address
-// @param module_timestamp
-// @param module_debugid
-// @param module_debug_path
-// @param protection_flags
-// @param private_clean_resident_kb
-// @param shared_dirty_resident_kb
-// @param shared_clean_resident_kb
-// @param locked_kb
-// @param proportional_resident_kb
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_PROFILER_SMAPS_DEF(NAME, PARENT, C) \
- NAME(ProfilerSmapsTable, "profiler_smaps") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, upid) \
- C(int64_t, ts) \
- C(StringPool::Id, path) \
- C(int64_t, size_kb) \
- C(int64_t, private_dirty_kb) \
- C(int64_t, swap_kb) \
- C(StringPool::Id, file_name) \
- C(int64_t, start_address) \
- C(int64_t, module_timestamp) \
- C(StringPool::Id, module_debugid) \
- C(StringPool::Id, module_debug_path) \
- C(int64_t, protection_flags) \
- C(int64_t, private_clean_resident_kb) \
- C(int64_t, shared_dirty_resident_kb) \
- C(int64_t, shared_clean_resident_kb) \
- C(int64_t, locked_kb) \
- C(int64_t, proportional_resident_kb)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_PROFILER_SMAPS_DEF);
-
-// Metadata about packages installed on the system.
-// This is generated by the packages_list data-source.
-// @param package_name name of the package, e.g. com.google.android.gm.
-// @param uid UID processes of this package run as.
-// @param debuggable bool whether this app is debuggable.
-// @param profileable_from_shell bool whether this app is profileable.
-// @param version_code versionCode from the APK.
-#define PERFETTO_TP_PACKAGES_LIST_DEF(NAME, PARENT, C) \
- NAME(PackageListTable, "package_list") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, package_name) \
- C(int64_t, uid) \
- C(int32_t, debuggable) \
- C(int32_t, profileable_from_shell) \
- C(int64_t, version_code)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_PACKAGES_LIST_DEF);
-
-// A mapping (binary / library) in a process.
-// This is generated by the stack profilers: heapprofd and traced_perf.
-// @param build_id hex-encoded Build ID of the binary / library.
-// @param start start of the mapping in the process' address space.
-// @param end end of the mapping in the process' address space.
-// @param name filename of the binary / library {@joinable profiler_smaps.path}.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_STACK_PROFILE_MAPPING_DEF(NAME, PARENT, C) \
- NAME(StackProfileMappingTable, "stack_profile_mapping") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, build_id) \
- C(int64_t, exact_offset) \
- C(int64_t, start_offset) \
- C(int64_t, start) \
- C(int64_t, end) \
- C(int64_t, load_bias) \
- C(StringPool::Id, name)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_STACK_PROFILE_MAPPING_DEF);
-
-// A frame on the callstack. This is a location in a program.
-// This is generated by the stack profilers: heapprofd and traced_perf.
-// @param name name of the function this location is in.
-// @param mapping the mapping (library / binary) this location is in.
-// @param rel_pc the program counter relative to the start of the mapping.
-// @param symbol_set_id if the profile was offline symbolized, the offline
-// symbol information of this frame.
-// {@joinable stack_profile_symbol.symbol_set_id}
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_STACK_PROFILE_FRAME_DEF(NAME, PARENT, C) \
- NAME(StackProfileFrameTable, "stack_profile_frame") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, name) \
- C(StackProfileMappingTable::Id, mapping) \
- C(int64_t, rel_pc) \
- C(base::Optional<uint32_t>, symbol_set_id) \
- C(base::Optional<StringPool::Id>, deobfuscated_name)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_STACK_PROFILE_FRAME_DEF);
-
// A callsite. This is a list of frames that were on the stack.
// This is generated by the stack profilers: heapprofd and traced_perf.
// @param depth distance from the bottom-most frame of the callstack.
@@ -139,261 +37,6 @@
C(base::Optional<StackProfileCallsiteTable::Id>, parent_id) \
C(StackProfileFrameTable::Id, frame_id)
-PERFETTO_TP_TABLE(PERFETTO_TP_STACK_PROFILE_CALLSITE_DEF);
-
-// TODO(rsavitski): rethink what to do with the root table now that only chrome
-// callstacks use it.
-
-// Root table for timestamped stack samples.
-// @param ts timestamp of the sample.
-// @param callsite_id unwound callstack.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_STACK_SAMPLE_DEF(NAME, PARENT, C) \
- NAME(StackSampleTable, "stack_sample") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts, Column::Flag::kSorted) \
- C(StackProfileCallsiteTable::Id, callsite_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_STACK_SAMPLE_DEF);
-
-// Samples from the Chromium stack sampler.
-// @param utid thread that was active when the sample was taken.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_CPU_PROFILE_STACK_SAMPLE_DEF(NAME, PARENT, C) \
- NAME(CpuProfileStackSampleTable, "cpu_profile_stack_sample") \
- PARENT(PERFETTO_TP_STACK_SAMPLE_DEF, C) \
- C(uint32_t, utid) \
- C(int32_t, process_priority)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_CPU_PROFILE_STACK_SAMPLE_DEF);
-
-// Samples from the traced_perf profiler.
-//
-// @param ts timestamp of the sample.
-// @param utid sampled thread. {@joinable thread.utid}.
-// @param cpu the core the sampled thread was running on.
-// @param cpu_mode execution state (userspace/kernelspace) of the sampled
-// thread.
-// @param callsite_id if set, unwound callstack of the sampled thread.
-// @param unwind_error if set, indicates that the unwinding for this sample
-// encountered an error. Such samples still reference the best-effort
-// result via the callsite_id (with a synthetic error frame at the point
-// where unwinding stopped).
-// @param perf_session_id distinguishes samples from different profiling
-// streams (i.e. multiple data sources).
-// {@joinable perf_counter_track.perf_session_id}
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_PERF_SAMPLE_DEF(NAME, PARENT, C) \
- NAME(PerfSampleTable, "perf_sample") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts, Column::Flag::kSorted) \
- C(uint32_t, utid) \
- C(uint32_t, cpu) \
- C(StringPool::Id, cpu_mode) \
- C(base::Optional<StackProfileCallsiteTable::Id>, callsite_id) \
- C(base::Optional<StringPool::Id>, unwind_error) \
- C(uint32_t, perf_session_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_PERF_SAMPLE_DEF);
-
-// Symbolization data for a frame. Rows with the same symbol_set_id describe
-// one callframe, with the most-inlined symbol having id == symbol_set_id.
-//
-// For instance, if the function foo has an inlined call to the function bar,
-// which has an inlined call to baz, the stack_profile_symbol table would look
-// like this.
-//
-// ```
-// |id|symbol_set_id|name |source_file|line_number|
-// |--|-------------|-------------|-----------|-----------|
-// |1 | 1 |baz |foo.cc | 36 |
-// |2 | 1 |bar |foo.cc | 30 |
-// |3 | 1 |foo |foo.cc | 60 |
-// ```
-// @param name name of the function.
-// @param source_file name of the source file containing the function.
-// @param line_number line number of the frame in the source file. This is the
-// exact line for the corresponding program counter, not the beginning of the
-// function.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_SYMBOL_DEF(NAME, PARENT, C) \
- NAME(SymbolTable, "stack_profile_symbol") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, symbol_set_id, Column::Flag::kSorted | Column::Flag::kSetId) \
- C(StringPool::Id, name) \
- C(StringPool::Id, source_file) \
- C(uint32_t, line_number)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_SYMBOL_DEF);
-
-// Allocations that happened at a callsite.
-//
-//
-// NOTE: this table is not sorted by timestamp intentionanlly - see b/193757386
-// for details.
-// TODO(b/193757386): readd the sorted flag once this bug is fixed.
-//
-// This is generated by heapprofd.
-// @param ts the timestamp the allocations happened at. heapprofd batches
-// allocations and frees, and all data from a dump will have the same
-// timestamp.
-// @param upid the UniquePID of the allocating process.
-// {@joinable process.upid}
-// @param callsite_id the callsite the allocation happened at.
-// @param count if positive: number of allocations that happened at this
-// callsite. if negative: number of allocations that happened at this callsite
-// that were freed.
-// @param size if positive: size of allocations that happened at this
-// callsite. if negative: size of allocations that happened at this callsite
-// that were freed.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_HEAP_PROFILE_ALLOCATION_DEF(NAME, PARENT, C) \
- NAME(HeapProfileAllocationTable, "heap_profile_allocation") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts) \
- C(uint32_t, upid) \
- C(StringPool::Id, heap_name) \
- C(StackProfileCallsiteTable::Id, callsite_id) \
- C(int64_t, count) \
- C(int64_t, size)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_PROFILE_ALLOCATION_DEF);
-
-// Table used to render flamegraphs. This gives cumulative sizes of nodes in
-// the flamegraph.
-//
-// WARNING: This is experimental and the API is subject to change.
-// @tablegroup Callstack profilers
-#define PERFETTO_TP_EXPERIMENTAL_FLAMEGRAPH_NODES(NAME, PARENT, C) \
- NAME(ExperimentalFlamegraphNodesTable, "experimental_flamegraph_nodes") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts, Column::Flag::kSorted | Column::Flag::kHidden) \
- C(uint32_t, upid, Column::Flag::kHidden) \
- C(StringPool::Id, profile_type, Column::Flag::kHidden) \
- C(StringPool::Id, focus_str, Column::Flag::kHidden) \
- C(uint32_t, depth) \
- C(StringPool::Id, name) \
- C(StringPool::Id, map_name) \
- C(int64_t, count) \
- C(int64_t, cumulative_count) \
- C(int64_t, size) \
- C(int64_t, cumulative_size) \
- C(int64_t, alloc_count) \
- C(int64_t, cumulative_alloc_count) \
- C(int64_t, alloc_size) \
- C(int64_t, cumulative_alloc_size) \
- C(base::Optional<ExperimentalFlamegraphNodesTable::Id>, parent_id) \
- C(base::Optional<StringPool::Id>, source_file) \
- C(base::Optional<uint32_t>, line_number) \
- C(base::Optional<StringPool::Id>, upid_group)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_EXPERIMENTAL_FLAMEGRAPH_NODES);
-
-// @param name (potentially obfuscated) name of the class.
-// @param deobfuscated_name if class name was obfuscated and deobfuscation map
-// for it provided, the deobfuscated name.
-// @param location the APK / Dex / JAR file the class is contained in.
-// @tablegroup ART Heap Graphs
-//
-// classloader_id should really be HeapGraphObject::id, but that would
-// create a loop, which is currently not possible.
-// TODO(lalitm): resolve this
-#define PERFETTO_TP_HEAP_GRAPH_CLASS_DEF(NAME, PARENT, C) \
- NAME(HeapGraphClassTable, "heap_graph_class") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, name) \
- C(base::Optional<StringPool::Id>, deobfuscated_name) \
- C(base::Optional<StringPool::Id>, location) \
- C(base::Optional<HeapGraphClassTable::Id>, superclass_id) \
- C(base::Optional<uint32_t>, classloader_id) \
- C(StringPool::Id, kind)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_GRAPH_CLASS_DEF);
-
-// The objects on the Dalvik heap.
-//
-// All rows with the same (upid, graph_sample_ts) are one dump.
-// @param upid UniquePid of the target {@joinable process.upid}.
-// @param graph_sample_ts timestamp this dump was taken at.
-// @param self_size size this object uses on the Java Heap.
-// @param native_size approximate amount of native memory used by this object,
-// as reported by libcore.util.NativeAllocationRegistry.size.
-// @param reference_set_id join key with heap_graph_reference containing all
-// objects referred in this object's fields.
-// {@joinable heap_graph_reference.reference_set_id}
-// @param reachable bool whether this object is reachable from a GC root. If
-// false, this object is uncollected garbage.
-// @param type_id class this object is an instance of.
-// @param root_type if not NULL, this object is a GC root.
-// @tablegroup ART Heap Graphs
-#define PERFETTO_TP_HEAP_GRAPH_OBJECT_DEF(NAME, PARENT, C) \
- NAME(HeapGraphObjectTable, "heap_graph_object") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, upid) \
- C(int64_t, graph_sample_ts) \
- C(int64_t, self_size) \
- C(int64_t, native_size) \
- C(base::Optional<uint32_t>, reference_set_id, Column::Flag::kDense) \
- C(int32_t, reachable) \
- C(HeapGraphClassTable::Id, type_id) \
- C(base::Optional<StringPool::Id>, root_type) \
- C(int32_t, root_distance, Column::Flag::kHidden)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_GRAPH_OBJECT_DEF);
-
-// Many-to-many mapping between heap_graph_object.
-//
-// This associates the object with given reference_set_id with the objects
-// that are referred to by its fields.
-// @param reference_set_id join key to heap_graph_object.
-// @param owner_id id of object that has this reference_set_id.
-// @param owned_id id of object that is referred to.
-// @param field_name the field that refers to the object. E.g. Foo.name.
-// @param field_type_name the static type of the field. E.g. java.lang.String.
-// @param deobfuscated_field_name if field_name was obfuscated and a
-// deobfuscation mapping was provided for it, the deobfuscated name.
-// @tablegroup ART Heap Graphs
-#define PERFETTO_TP_HEAP_GRAPH_REFERENCE_DEF(NAME, PARENT, C) \
- NAME(HeapGraphReferenceTable, "heap_graph_reference") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(uint32_t, reference_set_id, Column::Flag::kSorted | Column::Flag::kSetId) \
- C(HeapGraphObjectTable::Id, owner_id) \
- C(base::Optional<HeapGraphObjectTable::Id>, owned_id) \
- C(StringPool::Id, field_name) \
- C(StringPool::Id, field_type_name) \
- C(base::Optional<StringPool::Id>, deobfuscated_field_name)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_GRAPH_REFERENCE_DEF);
-
-// @param arg_set_id {@joinable args.arg_set_id}
-#define PERFETTO_TP_VULKAN_MEMORY_ALLOCATIONS_DEF(NAME, PARENT, C) \
- NAME(VulkanMemoryAllocationsTable, "vulkan_memory_allocations") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(StringPool::Id, source) \
- C(StringPool::Id, operation) \
- C(int64_t, timestamp) \
- C(base::Optional<uint32_t>, upid) \
- C(base::Optional<int64_t>, device) \
- C(base::Optional<int64_t>, device_memory) \
- C(base::Optional<uint32_t>, memory_type) \
- C(base::Optional<uint32_t>, heap) \
- C(base::Optional<StringPool::Id>, function_name) \
- C(base::Optional<int64_t>, object_handle) \
- C(base::Optional<int64_t>, memory_address) \
- C(base::Optional<int64_t>, memory_size) \
- C(StringPool::Id, scope) \
- C(base::Optional<uint32_t>, arg_set_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_VULKAN_MEMORY_ALLOCATIONS_DEF);
-
-#define PERFETTO_TP_GPU_COUNTER_GROUP_DEF(NAME, PARENT, C) \
- NAME(GpuCounterGroupTable, "gpu_counter_group") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int32_t, group_id) \
- C(TrackTable::Id, track_id)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_GPU_COUNTER_GROUP_DEF);
-
} // namespace tables
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/tables/profiler_tables.py b/src/trace_processor/tables/profiler_tables.py
new file mode 100644
index 0000000..d428009
--- /dev/null
+++ b/src/trace_processor/tables/profiler_tables.py
@@ -0,0 +1,611 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import ColumnFlag
+from python.generators.trace_processor_table.public import CppInt32
+from python.generators.trace_processor_table.public import CppInt64
+from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import CppSelfTableId
+from python.generators.trace_processor_table.public import CppString
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+
+from src.trace_processor.tables.track_tables import TRACK_TABLE
+
+PROFILER_SMAPS_TABLE = Table(
+ class_name='ProfilerSmapsTable',
+ sql_name='profiler_smaps',
+ columns=[
+ C('upid', CppUint32()),
+ C('ts', CppInt64()),
+ C('path', CppString()),
+ C('size_kb', CppInt64()),
+ C('private_dirty_kb', CppInt64()),
+ C('swap_kb', CppInt64()),
+ C('file_name', CppString()),
+ C('start_address', CppInt64()),
+ C('module_timestamp', CppInt64()),
+ C('module_debugid', CppString()),
+ C('module_debug_path', CppString()),
+ C('protection_flags', CppInt64()),
+ C('private_clean_resident_kb', CppInt64()),
+ C('shared_dirty_resident_kb', CppInt64()),
+ C('shared_clean_resident_kb', CppInt64()),
+ C('locked_kb', CppInt64()),
+ C('proportional_resident_kb', CppInt64()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ The profiler smaps contains the memory stats for virtual memory ranges
+captured by the [heap profiler](/docs/data-sources/native-heap-profiler.md).
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'upid':
+ '''The UniquePID of the process.''',
+ 'ts':
+ '''Timestamp of the snapshot. Multiple rows will have the same
+timestamp.''',
+ 'path':
+ '''The mmaped file, as per /proc/pid/smaps.''',
+ 'size_kb':
+ '''Total size of the mapping.''',
+ 'private_dirty_kb':
+ '''KB of this mapping that are private dirty RSS.''',
+ 'swap_kb':
+ '''KB of this mapping that are in swap.''',
+ 'file_name':
+ '''''',
+ 'start_address':
+ '''''',
+ 'module_timestamp':
+ '''''',
+ 'module_debugid':
+ '''''',
+ 'module_debug_path':
+ '''''',
+ 'protection_flags':
+ '''''',
+ 'private_clean_resident_kb':
+ '''''',
+ 'shared_dirty_resident_kb':
+ '''''',
+ 'shared_clean_resident_kb':
+ '''''',
+ 'locked_kb':
+ '''''',
+ 'proportional_resident_kb':
+ ''''''
+ }))
+
+PACKAGE_LIST_TABLE = Table(
+ class_name='PackageListTable',
+ sql_name='package_list',
+ columns=[
+ C('package_name', CppString()),
+ C('uid', CppInt64()),
+ C('debuggable', CppInt32()),
+ C('profileable_from_shell', CppInt32()),
+ C('version_code', CppInt64()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Metadata about packages installed on the system.
+This is generated by the packages_list data-source.
+ ''',
+ group='Misc',
+ columns={
+ 'package_name':
+ '''name of the package, e.g. com.google.android.gm.''',
+ 'uid':
+ '''UID processes of this package run as.''',
+ 'debuggable':
+ '''bool whether this app is debuggable.''',
+ 'profileable_from_shell':
+ '''bool whether this app is profileable.''',
+ 'version_code':
+ '''versionCode from the APK.'''
+ }))
+
+STACK_PROFILE_MAPPING_TABLE = Table(
+ class_name='StackProfileMappingTable',
+ sql_name='stack_profile_mapping',
+ columns=[
+ C('build_id', CppString()),
+ C('exact_offset', CppInt64()),
+ C('start_offset', CppInt64()),
+ C('start', CppInt64()),
+ C('end', CppInt64()),
+ C('load_bias', CppInt64()),
+ C('name', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ A mapping (binary / library) in a process.
+This is generated by the stack profilers: heapprofd and traced_perf.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'build_id': '''hex-encoded Build ID of the binary / library.''',
+ 'start': '''start of the mapping in the process' address space.''',
+ 'end': '''end of the mapping in the process' address space.''',
+ 'name': '''filename of the binary / library.''',
+ 'exact_offset': '''''',
+ 'start_offset': '''''',
+ 'load_bias': ''''''
+ }))
+
+STACK_PROFILE_FRAME_TABLE = Table(
+ class_name='StackProfileFrameTable',
+ sql_name='stack_profile_frame',
+ columns=[
+ C('name', CppString()),
+ C('mapping', CppTableId(STACK_PROFILE_MAPPING_TABLE)),
+ C('rel_pc', CppInt64()),
+ C('symbol_set_id', CppOptional(CppUint32())),
+ C('deobfuscated_name', CppOptional(CppString())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ A frame on the callstack. This is a location in a program.
+This is generated by the stack profilers: heapprofd and traced_perf.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'name':
+ '''name of the function this location is in.''',
+ 'mapping':
+ '''the mapping (library / binary) this location is in.''',
+ 'rel_pc':
+ '''the program counter relative to the start of the mapping.''',
+ 'symbol_set_id':
+ '''if the profile was offline symbolized, the offline
+symbol information of this frame.''',
+ 'deobfuscated_name':
+ ''''''
+ }))
+
+STACK_PROFILE_CALLSITE_TABLE = Table(
+ class_name='StackProfileCallsiteTable',
+ sql_name='stack_profile_callsite',
+ columns=[
+ C('depth', CppUint32()),
+ C('parent_id', CppOptional(CppSelfTableId())),
+ C('frame_id', CppTableId(STACK_PROFILE_FRAME_TABLE)),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ A callsite. This is a list of frames that were on the stack.
+This is generated by the stack profilers: heapprofd and traced_perf.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'depth':
+ '''distance from the bottom-most frame of the callstack.''',
+ 'parent_id':
+ '''parent frame on the callstack. NULL for the bottom-most.''',
+ 'frame_id':
+ '''frame at this position in the callstack.'''
+ }))
+
+STACK_SAMPLE_TABLE = Table(
+ class_name='StackSampleTable',
+ sql_name='stack_sample',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('callsite_id', CppTableId(STACK_PROFILE_CALLSITE_TABLE)),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Root table for timestamped stack samples.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'ts': '''timestamp of the sample.''',
+ 'callsite_id': '''unwound callstack.'''
+ }))
+
+CPU_PROFILE_STACK_SAMPLE_TABLE = Table(
+ class_name='CpuProfileStackSampleTable',
+ sql_name='cpu_profile_stack_sample',
+ columns=[
+ C('utid', CppUint32()),
+ C('process_priority', CppInt32()),
+ ],
+ parent=STACK_SAMPLE_TABLE,
+ tabledoc=TableDoc(
+ doc='''
+ Samples from the Chromium stack sampler.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'utid': '''thread that was active when the sample was taken.''',
+ 'process_priority': ''''''
+ }))
+
+PERF_SAMPLE_TABLE = Table(
+ class_name='PerfSampleTable',
+ sql_name='perf_sample',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('utid', CppUint32()),
+ C('cpu', CppUint32()),
+ C('cpu_mode', CppString()),
+ C('callsite_id', CppOptional(CppTableId(STACK_PROFILE_CALLSITE_TABLE))),
+ C('unwind_error', CppOptional(CppString())),
+ C('perf_session_id', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Samples from the traced_perf profiler.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'ts':
+ '''timestamp of the sample.''',
+ 'utid':
+ '''sampled thread..''',
+ 'cpu':
+ '''the core the sampled thread was running on.''',
+ 'cpu_mode':
+ '''execution state (userspace/kernelspace) of the sampled
+thread.''',
+ 'callsite_id':
+ '''if set, unwound callstack of the sampled thread.''',
+ 'unwind_error':
+ '''if set, indicates that the unwinding for this sample
+encountered an error. Such samples still reference the best-effort
+result via the callsite_id (with a synthetic error frame at the point
+where unwinding stopped).''',
+ 'perf_session_id':
+ '''distinguishes samples from different profiling
+streams (i.e. multiple data sources).'''
+ }))
+
+SYMBOL_TABLE = Table(
+ class_name='SymbolTable',
+ sql_name='stack_profile_symbol',
+ columns=[
+ C('symbol_set_id',
+ CppUint32(),
+ flags=ColumnFlag.SORTED | ColumnFlag.SET_ID),
+ C('name', CppString()),
+ C('source_file', CppString()),
+ C('line_number', CppUint32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Symbolization data for a frame. Rows with the same symbol_set_id
+ describe one callframe, with the most-inlined symbol having
+ id == symbol_set_id.
+
+ For instance, if the function foo has an inlined call to the
+ function bar, which has an inlined call to baz, the
+ stack_profile_symbol table would look like this.
+
+ ```
+ |id|symbol_set_id|name |source_file|line_number|
+ |--|-------------|-------------|-----------|-----------|
+ |1 | 1 |baz |foo.cc | 36 |
+ |2 | 1 |bar |foo.cc | 30 |
+ |3 | 1 |foo |foo.cc | 60 |
+ ```
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'name':
+ '''name of the function.''',
+ 'source_file':
+ '''name of the source file containing the function.''',
+ 'line_number':
+ '''
+ line number of the frame in the source file. This is the
+ exact line for the corresponding program counter, not the
+ beginning of the function.
+ ''',
+ 'symbol_set_id':
+ ''''''
+ }))
+
+HEAP_PROFILE_ALLOCATION_TABLE = Table(
+ class_name='HeapProfileAllocationTable',
+ sql_name='heap_profile_allocation',
+ columns=[
+ C('ts', CppInt64()),
+ C('upid', CppUint32()),
+ C('heap_name', CppString()),
+ C('callsite_id', CppTableId(STACK_PROFILE_CALLSITE_TABLE)),
+ C('count', CppInt64()),
+ C('size', CppInt64()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Allocations that happened at a callsite.
+
+
+NOTE: this table is not sorted by timestamp intentionanlly - see b/193757386
+for details.
+TODO(b/193757386): readd the sorted flag once this bug is fixed.
+
+This is generated by heapprofd.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'ts':
+ '''the timestamp the allocations happened at. heapprofd batches
+allocations and frees, and all data from a dump will have the same
+timestamp.''',
+ 'upid':
+ '''the UniquePID of the allocating process.''',
+ 'callsite_id':
+ '''the callsite the allocation happened at.''',
+ 'count':
+ '''if positive: number of allocations that happened at this
+callsite. if negative: number of allocations that happened at this callsite
+that were freed.''',
+ 'size':
+ '''if positive: size of allocations that happened at this
+callsite. if negative: size of allocations that happened at this callsite
+that were freed.''',
+ 'heap_name':
+ ''''''
+ }))
+
+EXPERIMENTAL_FLAMEGRAPH_NODES_TABLE = Table(
+ class_name='ExperimentalFlamegraphNodesTable',
+ sql_name='experimental_flamegraph_nodes',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED | ColumnFlag.HIDDEN),
+ C('upid', CppUint32(), flags=ColumnFlag.HIDDEN),
+ C('profile_type', CppString(), flags=ColumnFlag.HIDDEN),
+ C('focus_str', CppString(), flags=ColumnFlag.HIDDEN),
+ C('depth', CppUint32()),
+ C('name', CppString()),
+ C('map_name', CppString()),
+ C('count', CppInt64()),
+ C('cumulative_count', CppInt64()),
+ C('size', CppInt64()),
+ C('cumulative_size', CppInt64()),
+ C('alloc_count', CppInt64()),
+ C('cumulative_alloc_count', CppInt64()),
+ C('alloc_size', CppInt64()),
+ C('cumulative_alloc_size', CppInt64()),
+ C('parent_id', CppOptional(CppSelfTableId())),
+ C('source_file', CppOptional(CppString())),
+ C('line_number', CppOptional(CppUint32())),
+ C('upid_group', CppOptional(CppString())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Table used to render flamegraphs. This gives cumulative sizes of
+ nodes in the flamegraph.
+
+ WARNING: This is experimental and the API is subject to change.
+ ''',
+ group='Callstack profilers',
+ columns={
+ 'ts': '''''',
+ 'upid': '''''',
+ 'profile_type': '''''',
+ 'focus_str': '''''',
+ 'depth': '''''',
+ 'name': '''''',
+ 'map_name': '''''',
+ 'count': '''''',
+ 'cumulative_count': '''''',
+ 'size': '''''',
+ 'cumulative_size': '''''',
+ 'alloc_count': '''''',
+ 'cumulative_alloc_count': '''''',
+ 'alloc_size': '''''',
+ 'cumulative_alloc_size': '''''',
+ 'parent_id': '''''',
+ 'source_file': '''''',
+ 'line_number': '''''',
+ 'upid_group': ''''''
+ }))
+
+HEAP_GRAPH_CLASS_TABLE = Table(
+ class_name='HeapGraphClassTable',
+ sql_name='heap_graph_class',
+ columns=[
+ C('name', CppString()),
+ C('deobfuscated_name', CppOptional(CppString())),
+ C('location', CppOptional(CppString())),
+ C('superclass_id', CppOptional(CppSelfTableId())),
+ C('classloader_id', CppOptional(CppUint32())),
+ C('kind', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='ART Heap Graphs',
+ columns={
+ 'name':
+ '''(potentially obfuscated) name of the class.''',
+ 'deobfuscated_name':
+ '''if class name was obfuscated and deobfuscation map
+for it provided, the deobfuscated name.''',
+ 'location':
+ '''the APK / Dex / JAR file the class is contained in.
+
+classloader_id should really be HeapGraphObject::id, but that would
+create a loop, which is currently not possible.
+TODO(lalitm): resolve this''',
+ 'superclass_id':
+ '''''',
+ 'classloader_id':
+ '''''',
+ 'kind':
+ ''''''
+ }))
+
+HEAP_GRAPH_OBJECT_TABLE = Table(
+ class_name='HeapGraphObjectTable',
+ sql_name='heap_graph_object',
+ columns=[
+ C('upid', CppUint32()),
+ C('graph_sample_ts', CppInt64()),
+ C('self_size', CppInt64()),
+ C('native_size', CppInt64()),
+ C('reference_set_id', CppOptional(CppUint32()), flags=ColumnFlag.DENSE),
+ C('reachable', CppInt32()),
+ C('type_id', CppTableId(HEAP_GRAPH_CLASS_TABLE)),
+ C('root_type', CppOptional(CppString())),
+ C('root_distance', CppInt32(), flags=ColumnFlag.HIDDEN),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ The objects on the Dalvik heap.
+
+All rows with the same (upid, graph_sample_ts) are one dump.
+ ''',
+ group='ART Heap Graphs',
+ columns={
+ 'upid':
+ '''UniquePid of the target.''',
+ 'graph_sample_ts':
+ '''timestamp this dump was taken at.''',
+ 'self_size':
+ '''size this object uses on the Java Heap.''',
+ 'native_size':
+ '''approximate amount of native memory used by this object,
+as reported by libcore.util.NativeAllocationRegistry.size.''',
+ 'reference_set_id':
+ '''join key with heap_graph_reference containing all
+objects referred in this object's fields.''',
+ 'reachable':
+ '''bool whether this object is reachable from a GC root. If
+false, this object is uncollected garbage.''',
+ 'type_id':
+ '''class this object is an instance of.''',
+ 'root_type':
+ '''if not NULL, this object is a GC root.''',
+ 'root_distance':
+ ''''''
+ }))
+
+HEAP_GRAPH_REFERENCE_TABLE = Table(
+ class_name='HeapGraphReferenceTable',
+ sql_name='heap_graph_reference',
+ columns=[
+ C('reference_set_id',
+ CppUint32(),
+ flags=ColumnFlag.SORTED | ColumnFlag.SET_ID),
+ C('owner_id', CppTableId(HEAP_GRAPH_OBJECT_TABLE)),
+ C('owned_id', CppOptional(CppTableId(HEAP_GRAPH_OBJECT_TABLE))),
+ C('field_name', CppString()),
+ C('field_type_name', CppString()),
+ C('deobfuscated_field_name', CppOptional(CppString())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Many-to-many mapping between heap_graph_object.
+
+This associates the object with given reference_set_id with the objects
+that are referred to by its fields.
+ ''',
+ group='ART Heap Graphs',
+ columns={
+ 'reference_set_id':
+ '''join key to heap_graph_object.''',
+ 'owner_id':
+ '''id of object that has this reference_set_id.''',
+ 'owned_id':
+ '''id of object that is referred to.''',
+ 'field_name':
+ '''the field that refers to the object. E.g. Foo.name.''',
+ 'field_type_name':
+ '''the static type of the field. E.g. java.lang.String.''',
+ 'deobfuscated_field_name':
+ '''if field_name was obfuscated and a
+deobfuscation mapping was provided for it, the deobfuscated name.'''
+ }))
+
+VULKAN_MEMORY_ALLOCATIONS_TABLE = Table(
+ class_name='VulkanMemoryAllocationsTable',
+ sql_name='vulkan_memory_allocations',
+ columns=[
+ C('arg_set_id', CppOptional(CppUint32())),
+ C('source', CppString()),
+ C('operation', CppString()),
+ C('timestamp', CppInt64()),
+ C('upid', CppOptional(CppUint32())),
+ C('device', CppOptional(CppInt64())),
+ C('device_memory', CppOptional(CppInt64())),
+ C('memory_type', CppOptional(CppUint32())),
+ C('heap', CppOptional(CppUint32())),
+ C('function_name', CppOptional(CppString())),
+ C('object_handle', CppOptional(CppInt64())),
+ C('memory_address', CppOptional(CppInt64())),
+ C('memory_size', CppOptional(CppInt64())),
+ C('scope', CppString()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'arg_set_id': '''''',
+ 'source': '''''',
+ 'operation': '''''',
+ 'timestamp': '''''',
+ 'upid': '''''',
+ 'device': '''''',
+ 'device_memory': '''''',
+ 'memory_type': '''''',
+ 'heap': '''''',
+ 'function_name': '''''',
+ 'object_handle': '''''',
+ 'memory_address': '''''',
+ 'memory_size': '''''',
+ 'scope': ''''''
+ }))
+
+GPU_COUNTER_GROUP_TABLE = Table(
+ class_name='GpuCounterGroupTable',
+ sql_name='gpu_counter_group',
+ columns=[
+ C('group_id', CppInt32()),
+ C('track_id', CppTableId(TRACK_TABLE)),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'group_id': '''''',
+ 'track_id': ''''''
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ CPU_PROFILE_STACK_SAMPLE_TABLE,
+ EXPERIMENTAL_FLAMEGRAPH_NODES_TABLE,
+ GPU_COUNTER_GROUP_TABLE,
+ HEAP_GRAPH_CLASS_TABLE,
+ HEAP_GRAPH_OBJECT_TABLE,
+ HEAP_GRAPH_REFERENCE_TABLE,
+ HEAP_PROFILE_ALLOCATION_TABLE,
+ PACKAGE_LIST_TABLE,
+ PERF_SAMPLE_TABLE,
+ PROFILER_SMAPS_TABLE,
+ STACK_PROFILE_CALLSITE_TABLE,
+ STACK_PROFILE_FRAME_TABLE,
+ STACK_PROFILE_MAPPING_TABLE,
+ STACK_SAMPLE_TABLE,
+ SYMBOL_TABLE,
+ VULKAN_MEMORY_ALLOCATIONS_TABLE,
+]
diff --git a/src/trace_processor/tables/slice_tables.h b/src/trace_processor/tables/slice_tables.h
index c66cba8..b82e3eb 100644
--- a/src/trace_processor/tables/slice_tables.h
+++ b/src/trace_processor/tables/slice_tables.h
@@ -24,15 +24,6 @@
namespace trace_processor {
namespace tables {
-// @name slice
-// @tablegroup Events
-// @param ts timestamp of the start of the slice (in nanoseconds)
-// @param dur duration of the slice (in nanoseconds)
-// @param arg_set_id {@joinable args.arg_set_id}
-// @param thread_instruction_count The value of the CPU instruction counter at
-// the start of the slice.
-// @param thread_instruction_delta The change in value from
-// @param thread_instruction_count to the end of the slice.
#define PERFETTO_TP_SLICE_TABLE_DEF(NAME, PARENT, C) \
NAME(SliceTable, "internal_slice") \
PERFETTO_TP_ROOT_TABLE(PARENT, C) \
@@ -51,27 +42,6 @@
C(base::Optional<int64_t>, thread_instruction_count) \
C(base::Optional<int64_t>, thread_instruction_delta)
-PERFETTO_TP_TABLE(PERFETTO_TP_SLICE_TABLE_DEF);
-
-// @name sched_slice
-// This table holds slices with kernel thread scheduling information.
-// These slices are collected when the Linux "ftrace" data source is
-// used with the "sched/switch" and "sched/wakeup*" events enabled.
-// @tablegroup Events
-// @param id The row id for the table row.
-// @param type This field always contains the string 'sched_slice'.
-// @param ts The timestamp at the start of the slice (in nanoseconds).
-// @param dur The duration of the slice (in nanoseconds).
-// @param utid The thread's unique id in the trace. {@joinable thread.utid}.
-// @param cpu The CPU that the slice executed on.
-// @param end_state A string representing the scheduling state of the
-// kernel thread at the end of the slice. The individual characters in
-// the string mean the following: R (runnable), S (awaiting a wakeup),
-// D (in an uninterruptible sleep), T (suspended), t (being traced),
-// X (exiting), P (parked), W (waking), I (idle), N (not contributing
-// to the load average), K (wakeable on fatal signals) and
-// Z (zombie, awaiting cleanup).
-// @param priority The kernel priority that the thread ran at.
#define PERFETTO_TP_SCHED_SLICE_TABLE_DEF(NAME, PARENT, C) \
NAME(SchedSliceTable, "sched_slice") \
PERFETTO_TP_ROOT_TABLE(PARENT, C) \
@@ -82,95 +52,6 @@
C(StringPool::Id, end_state) \
C(int32_t, priority)
-PERFETTO_TP_TABLE(PERFETTO_TP_SCHED_SLICE_TABLE_DEF);
-
-// @tablegroup Events
-// @param utid {@joinable thread.utid}
-#define PERFETTO_TP_THREAD_STATE_TABLE_DEF(NAME, PARENT, C) \
- NAME(ThreadStateTable, "thread_state") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts) \
- C(int64_t, dur) \
- C(base::Optional<uint32_t>, cpu) \
- C(uint32_t, utid) \
- C(StringPool::Id, state) \
- C(base::Optional<uint32_t>, io_wait) \
- C(base::Optional<StringPool::Id>, blocked_function) \
- C(base::Optional<uint32_t>, waker_utid)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_THREAD_STATE_TABLE_DEF);
-
-// @tablegroup Events
-#define PERFETTO_TP_GPU_SLICES_DEF(NAME, PARENT, C) \
- NAME(GpuSliceTable, "gpu_slice") \
- PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \
- C(base::Optional<int64_t>, context_id) \
- C(base::Optional<int64_t>, render_target) \
- C(StringPool::Id, render_target_name) \
- C(base::Optional<int64_t>, render_pass) \
- C(StringPool::Id, render_pass_name) \
- C(base::Optional<int64_t>, command_buffer) \
- C(StringPool::Id, command_buffer_name) \
- C(base::Optional<uint32_t>, frame_id) \
- C(base::Optional<uint32_t>, submission_id) \
- C(base::Optional<int64_t>, hw_queue_id) \
- C(StringPool::Id, render_subpasses)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_GPU_SLICES_DEF);
-
-// @tablegroup Events
-#define PERFETTO_TP_GRAPHICS_FRAME_SLICES_DEF(NAME, PARENT, C) \
- NAME(GraphicsFrameSliceTable, "frame_slice") \
- PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \
- C(uint32_t, frame_number) \
- C(StringPool::Id, layer_name) \
- C(int64_t, queue_to_acquire_time) \
- C(int64_t, acquire_to_latch_time) \
- C(int64_t, latch_to_present_time)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_GRAPHICS_FRAME_SLICES_DEF);
-
-#define PERFETTO_TP_EXPECTED_FRAME_TIMELINE_SLICES_DEF(NAME, PARENT, C) \
- NAME(ExpectedFrameTimelineSliceTable, "expected_frame_timeline_slice") \
- PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \
- C(int64_t, display_frame_token) \
- C(int64_t, surface_frame_token) \
- C(uint32_t, upid) \
- C(StringPool::Id, layer_name)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_EXPECTED_FRAME_TIMELINE_SLICES_DEF);
-
-#define PERFETTO_TP_ACTUAL_FRAME_TIMELINE_SLICES_DEF(NAME, PARENT, C) \
- NAME(ActualFrameTimelineSliceTable, "actual_frame_timeline_slice") \
- PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \
- C(int64_t, display_frame_token) \
- C(int64_t, surface_frame_token) \
- C(uint32_t, upid) \
- C(StringPool::Id, layer_name) \
- C(StringPool::Id, present_type) \
- C(int32_t, on_time_finish) \
- C(int32_t, gpu_composition) \
- C(StringPool::Id, jank_type) \
- C(StringPool::Id, prediction_type) \
- C(StringPool::Id, jank_tag)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_ACTUAL_FRAME_TIMELINE_SLICES_DEF);
-
-#define PERFETTO_TP_EXPERIMENTAL_FLAT_SLICE_TABLE_DEF(NAME, PARENT, C) \
- NAME(ExperimentalFlatSliceTable, "experimental_flat_slice") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, ts) \
- C(int64_t, dur) \
- C(TrackTable::Id, track_id) \
- C(base::Optional<StringPool::Id>, category) \
- C(base::Optional<StringPool::Id>, name) \
- C(uint32_t, arg_set_id) \
- C(base::Optional<SliceTable::Id>, source_id) \
- C(int64_t, start_bound, Column::Flag::kHidden) \
- C(int64_t, end_bound, Column::Flag::kHidden)
-
-PERFETTO_TP_TABLE(PERFETTO_TP_EXPERIMENTAL_FLAT_SLICE_TABLE_DEF);
-
} // namespace tables
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/tables/slice_tables.py b/src/trace_processor/tables/slice_tables.py
new file mode 100644
index 0000000..50b8c3e
--- /dev/null
+++ b/src/trace_processor/tables/slice_tables.py
@@ -0,0 +1,284 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import ColumnFlag
+from python.generators.trace_processor_table.public import CppInt32
+from python.generators.trace_processor_table.public import CppInt64
+from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import CppSelfTableId
+from python.generators.trace_processor_table.public import CppString
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import WrappingSqlView
+
+from src.trace_processor.tables.track_tables import TRACK_TABLE
+
+SLICE_TABLE = Table(
+ class_name='SliceTable',
+ sql_name='internal_slice',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('dur', CppInt64()),
+ C('track_id', CppTableId(TRACK_TABLE)),
+ C('category', CppOptional(CppString())),
+ C('name', CppOptional(CppString())),
+ C('depth', CppUint32()),
+ C('stack_id', CppInt64()),
+ C('parent_stack_id', CppInt64()),
+ C('parent_id', CppOptional(CppSelfTableId())),
+ C('arg_set_id', CppUint32()),
+ C('thread_ts', CppOptional(CppInt64())),
+ C('thread_dur', CppOptional(CppInt64())),
+ C('thread_instruction_count', CppOptional(CppInt64())),
+ C('thread_instruction_delta', CppOptional(CppInt64())),
+ ],
+ wrapping_sql_view=WrappingSqlView('slice'),
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Events',
+ columns={
+ 'ts': '''timestamp of the start of the slice (in nanoseconds)''',
+ 'dur': '''duration of the slice (in nanoseconds)''',
+ 'arg_set_id': '''''',
+ 'thread_instruction_count': '''to the end of the slice.''',
+ 'thread_instruction_delta': '''The change in value from''',
+ 'track_id': '''''',
+ 'category': '''''',
+ 'name': '''''',
+ 'depth': '''''',
+ 'stack_id': '''''',
+ 'parent_stack_id': '''''',
+ 'parent_id': '''''',
+ 'thread_ts': '''''',
+ 'thread_dur': ''''''
+ }))
+
+SCHED_SLICE_TABLE = Table(
+ class_name='SchedSliceTable',
+ sql_name='sched_slice',
+ columns=[
+ C('ts', CppInt64(), flags=ColumnFlag.SORTED),
+ C('dur', CppInt64()),
+ C('cpu', CppUint32()),
+ C('utid', CppUint32()),
+ C('end_state', CppString()),
+ C('priority', CppInt32()),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ This table holds slices with kernel thread scheduling information.
+These slices are collected when the Linux "ftrace" data source is
+used with the "sched/switch" and "sched/wakeup*" events enabled.
+ ''',
+ group='Events',
+ columns={
+ 'ts':
+ '''The timestamp at the start of the slice (in nanoseconds).''',
+ 'dur':
+ '''The duration of the slice (in nanoseconds).''',
+ 'utid':
+ '''The thread's unique id in the trace..''',
+ 'cpu':
+ '''The CPU that the slice executed on.''',
+ 'end_state':
+ '''A string representing the scheduling state of the
+kernel thread at the end of the slice. The individual characters in
+the string mean the following: R (runnable), S (awaiting a wakeup),
+D (in an uninterruptible sleep), T (suspended), t (being traced),
+X (exiting), P (parked), W (waking), I (idle), N (not contributing
+to the load average), K (wakeable on fatal signals) and
+Z (zombie, awaiting cleanup).''',
+ 'priority':
+ '''The kernel priority that the thread ran at.'''
+ }))
+
+THREAD_STATE_TABLE = Table(
+ class_name='ThreadStateTable',
+ sql_name='thread_state',
+ columns=[
+ C('utid', CppUint32()),
+ C('ts', CppInt64()),
+ C('dur', CppInt64()),
+ C('cpu', CppOptional(CppUint32())),
+ C('state', CppString()),
+ C('io_wait', CppOptional(CppUint32())),
+ C('blocked_function', CppOptional(CppString())),
+ C('waker_utid', CppOptional(CppUint32())),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Events',
+ columns={
+ 'utid': '''''',
+ 'ts': '''''',
+ 'dur': '''''',
+ 'cpu': '''''',
+ 'state': '''''',
+ 'io_wait': '''''',
+ 'blocked_function': '''''',
+ 'waker_utid': ''''''
+ }))
+
+GPU_SLICE_TABLE = Table(
+ class_name='GpuSliceTable',
+ sql_name='gpu_slice',
+ columns=[
+ C('context_id', CppOptional(CppInt64())),
+ C('render_target', CppOptional(CppInt64())),
+ C('render_target_name', CppString()),
+ C('render_pass', CppOptional(CppInt64())),
+ C('render_pass_name', CppString()),
+ C('command_buffer', CppOptional(CppInt64())),
+ C('command_buffer_name', CppString()),
+ C('frame_id', CppOptional(CppUint32())),
+ C('submission_id', CppOptional(CppUint32())),
+ C('hw_queue_id', CppOptional(CppInt64())),
+ C('render_subpasses', CppString()),
+ ],
+ parent=SLICE_TABLE,
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Events',
+ columns={
+ 'context_id': '''''',
+ 'render_target': '''''',
+ 'render_target_name': '''''',
+ 'render_pass': '''''',
+ 'render_pass_name': '''''',
+ 'command_buffer': '''''',
+ 'command_buffer_name': '''''',
+ 'frame_id': '''''',
+ 'submission_id': '''''',
+ 'hw_queue_id': '''''',
+ 'render_subpasses': ''''''
+ }))
+
+GRAPHICS_FRAME_SLICE_TABLE = Table(
+ class_name='GraphicsFrameSliceTable',
+ sql_name='frame_slice',
+ columns=[
+ C('frame_number', CppUint32()),
+ C('layer_name', CppString()),
+ C('queue_to_acquire_time', CppInt64()),
+ C('acquire_to_latch_time', CppInt64()),
+ C('latch_to_present_time', CppInt64()),
+ ],
+ parent=SLICE_TABLE,
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Events',
+ columns={
+ 'frame_number': '''''',
+ 'layer_name': '''''',
+ 'queue_to_acquire_time': '''''',
+ 'acquire_to_latch_time': '''''',
+ 'latch_to_present_time': ''''''
+ }))
+
+EXPECTED_FRAME_TIMELINE_SLICE_TABLE = Table(
+ class_name='ExpectedFrameTimelineSliceTable',
+ sql_name='expected_frame_timeline_slice',
+ columns=[
+ C('display_frame_token', CppInt64()),
+ C('surface_frame_token', CppInt64()),
+ C('upid', CppUint32()),
+ C('layer_name', CppString()),
+ ],
+ parent=SLICE_TABLE,
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'display_frame_token': '''''',
+ 'surface_frame_token': '''''',
+ 'upid': '''''',
+ 'layer_name': ''''''
+ }))
+
+ACTUAL_FRAME_TIMELINE_SLICE_TABLE = Table(
+ class_name='ActualFrameTimelineSliceTable',
+ sql_name='actual_frame_timeline_slice',
+ columns=[
+ C('display_frame_token', CppInt64()),
+ C('surface_frame_token', CppInt64()),
+ C('upid', CppUint32()),
+ C('layer_name', CppString()),
+ C('present_type', CppString()),
+ C('on_time_finish', CppInt32()),
+ C('gpu_composition', CppInt32()),
+ C('jank_type', CppString()),
+ C('prediction_type', CppString()),
+ C('jank_tag', CppString()),
+ ],
+ parent=SLICE_TABLE,
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'display_frame_token': '''''',
+ 'surface_frame_token': '''''',
+ 'upid': '''''',
+ 'layer_name': '''''',
+ 'present_type': '''''',
+ 'on_time_finish': '''''',
+ 'gpu_composition': '''''',
+ 'jank_type': '''''',
+ 'prediction_type': '''''',
+ 'jank_tag': ''''''
+ }))
+
+EXPERIMENTAL_FLAT_SLICE_TABLE = Table(
+ class_name='ExperimentalFlatSliceTable',
+ sql_name='experimental_flat_slice',
+ columns=[
+ C('ts', CppInt64()),
+ C('dur', CppInt64()),
+ C('track_id', CppTableId(TRACK_TABLE)),
+ C('category', CppOptional(CppString())),
+ C('name', CppOptional(CppString())),
+ C('arg_set_id', CppUint32()),
+ C('source_id', CppOptional(CppTableId(SLICE_TABLE))),
+ C('start_bound', CppInt64(), flags=ColumnFlag.HIDDEN),
+ C('end_bound', CppInt64(), flags=ColumnFlag.HIDDEN),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'ts': '''''',
+ 'dur': '''''',
+ 'track_id': '''''',
+ 'category': '''''',
+ 'name': '''''',
+ 'arg_set_id': '''''',
+ 'source_id': '''''',
+ 'start_bound': '''''',
+ 'end_bound': ''''''
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ ACTUAL_FRAME_TIMELINE_SLICE_TABLE,
+ EXPECTED_FRAME_TIMELINE_SLICE_TABLE,
+ EXPERIMENTAL_FLAT_SLICE_TABLE,
+ GPU_SLICE_TABLE,
+ GRAPHICS_FRAME_SLICE_TABLE,
+ SCHED_SLICE_TABLE,
+ SLICE_TABLE,
+ THREAD_STATE_TABLE,
+]
diff --git a/src/trace_processor/tables/table_destructors.cc b/src/trace_processor/tables/table_destructors.cc
index b8e0482..5025ab3 100644
--- a/src/trace_processor/tables/table_destructors.cc
+++ b/src/trace_processor/tables/table_destructors.cc
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include "src/trace_processor/tables/android_tables.h"
-#include "src/trace_processor/tables/counter_tables.h"
-#include "src/trace_processor/tables/flow_tables.h"
-#include "src/trace_processor/tables/memory_tables.h"
-#include "src/trace_processor/tables/metadata_tables.h"
-#include "src/trace_processor/tables/profiler_tables.h"
-#include "src/trace_processor/tables/slice_tables.h"
-#include "src/trace_processor/tables/trace_proto_tables.h"
+#include "src/trace_processor/tables/android_tables_py.h"
+#include "src/trace_processor/tables/counter_tables_py.h"
+#include "src/trace_processor/tables/flow_tables_py.h"
+#include "src/trace_processor/tables/memory_tables_py.h"
+#include "src/trace_processor/tables/metadata_tables_py.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
+#include "src/trace_processor/tables/slice_tables_py.h"
+#include "src/trace_processor/tables/trace_proto_tables_py.h"
#include "src/trace_processor/tables/track_tables_py.h"
namespace perfetto {
@@ -32,15 +32,15 @@
} // namespace macros_internal
namespace tables {
-// android_tables.h
+// android_tables_py.h
AndroidDumpstateTable::~AndroidDumpstateTable() = default;
AndroidGameInterventionListTable::~AndroidGameInterventionListTable() = default;
AndroidLogTable::~AndroidLogTable() = default;
-// counter_tables.h
+// counter_tables_py.h
CounterTable::~CounterTable() = default;
-// metadata_tables.h
+// metadata_tables_py.h
RawTable::~RawTable() = default;
ArgTable::~ArgTable() = default;
ExpMissingChromeProcTable::~ExpMissingChromeProcTable() = default;
@@ -52,7 +52,7 @@
FiledescriptorTable::~FiledescriptorTable() = default;
ClockSnapshotTable::~ClockSnapshotTable() = default;
-// profiler_tables.h
+// profiler_tables_py.h
StackProfileMappingTable::~StackProfileMappingTable() = default;
StackProfileFrameTable::~StackProfileFrameTable() = default;
StackProfileCallsiteTable::~StackProfileCallsiteTable() = default;
@@ -70,7 +70,7 @@
ProfilerSmapsTable::~ProfilerSmapsTable() = default;
GpuCounterGroupTable::~GpuCounterGroupTable() = default;
-// slice_tables.h
+// slice_tables_py.h
SliceTable::~SliceTable() = default;
FlowTable::~FlowTable() = default;
SchedSliceTable::~SchedSliceTable() = default;
@@ -99,11 +99,11 @@
UidCounterTrackTable::~UidCounterTrackTable() = default;
EnergyPerUidCounterTrackTable::~EnergyPerUidCounterTrackTable() = default;
-// trace_proto_tables.h
+// trace_proto_tables_py.h
ExperimentalProtoPathTable::~ExperimentalProtoPathTable() = default;
ExperimentalProtoContentTable::~ExperimentalProtoContentTable() = default;
-// memory_tables.h
+// memory_tables_py.h
MemorySnapshotTable::~MemorySnapshotTable() = default;
ProcessMemorySnapshotTable::~ProcessMemorySnapshotTable() = default;
MemorySnapshotNodeTable::~MemorySnapshotNodeTable() = default;
diff --git a/src/trace_processor/tables/trace_proto_tables.py b/src/trace_processor/tables/trace_proto_tables.py
new file mode 100644
index 0000000..f6f5f9d
--- /dev/null
+++ b/src/trace_processor/tables/trace_proto_tables.py
@@ -0,0 +1,72 @@
+# Copyright (C) 2023 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.
+"""Contains tables for relevant for TODO."""
+
+from python.generators.trace_processor_table.public import Column as C
+from python.generators.trace_processor_table.public import CppInt64
+from python.generators.trace_processor_table.public import CppOptional
+from python.generators.trace_processor_table.public import CppSelfTableId
+from python.generators.trace_processor_table.public import CppString
+from python.generators.trace_processor_table.public import Table
+from python.generators.trace_processor_table.public import TableDoc
+from python.generators.trace_processor_table.public import CppTableId
+from python.generators.trace_processor_table.public import CppUint32
+
+EXPERIMENTAL_PROTO_PATH_TABLE = Table(
+ class_name='ExperimentalProtoPathTable',
+ sql_name='experimental_proto_path',
+ columns=[
+ C('parent_id', CppOptional(CppSelfTableId())),
+ C('field_type', CppString()),
+ C('field_name', CppOptional(CppString())),
+ C('arg_set_id', CppOptional(CppUint32())),
+ ],
+ tabledoc=TableDoc(
+ doc='''
+ Experimental table, subject to arbitrary breaking changes.
+ ''',
+ group='Misc',
+ columns={
+ 'parent_id': '''''',
+ 'field_type': '''''',
+ 'field_name': '''''',
+ 'arg_set_id': ''''''
+ }))
+
+EXPERIMENTAL_PROTO_CONTENT_TABLE = Table(
+ class_name='ExperimentalProtoContentTable',
+ sql_name='experimental_proto_content',
+ columns=[
+ C('path', CppString()),
+ C('path_id', CppTableId(EXPERIMENTAL_PROTO_PATH_TABLE)),
+ C('total_size', CppInt64()),
+ C('size', CppInt64()),
+ C('count', CppInt64()),
+ ],
+ tabledoc=TableDoc(
+ doc='''''',
+ group='Misc',
+ columns={
+ 'path': '''''',
+ 'path_id': '''''',
+ 'total_size': '''''',
+ 'size': '''''',
+ 'count': ''''''
+ }))
+
+# Keep this list sorted.
+ALL_TABLES = [
+ EXPERIMENTAL_PROTO_CONTENT_TABLE,
+ EXPERIMENTAL_PROTO_PATH_TABLE,
+]
diff --git a/src/trace_processor/util/annotated_callsites.cc b/src/trace_processor/util/annotated_callsites.cc
index 5e23130..840577d 100644
--- a/src/trace_processor/util/annotated_callsites.cc
+++ b/src/trace_processor/util/annotated_callsites.cc
@@ -19,7 +19,7 @@
#include <iostream>
#include "perfetto/ext/base/optional.h"
-#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
#include "src/trace_processor/types/trace_processor_context.h"
namespace perfetto {
diff --git a/src/trace_processor/util/profile_builder.h b/src/trace_processor/util/profile_builder.h
index 9e1c873..1fb18ec 100644
--- a/src/trace_processor/util/profile_builder.h
+++ b/src/trace_processor/util/profile_builder.h
@@ -25,7 +25,7 @@
#include "protos/third_party/pprof/profile.pbzero.h"
#include "src/trace_processor/containers/string_pool.h"
#include "src/trace_processor/storage/trace_storage.h"
-#include "src/trace_processor/tables/profiler_tables.h"
+#include "src/trace_processor/tables/profiler_tables_py.h"
#include "src/trace_processor/util/annotated_callsites.h"
#include <algorithm>
diff --git a/src/trace_processor/views/slice_views.h b/src/trace_processor/views/slice_views.h
index 4c2d3bf..287fd02 100644
--- a/src/trace_processor/views/slice_views.h
+++ b/src/trace_processor/views/slice_views.h
@@ -18,8 +18,9 @@
#define SRC_TRACE_PROCESSOR_VIEWS_SLICE_VIEWS_H_
#include "src/trace_processor/db/view.h"
-#include "src/trace_processor/tables/metadata_tables.h"
+#include "src/trace_processor/tables/metadata_tables_py.h"
#include "src/trace_processor/tables/slice_tables.h"
+#include "src/trace_processor/tables/slice_tables_py.h"
#include "src/trace_processor/tables/track_tables_py.h"
#include "src/trace_processor/views/macros.h"