perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

Certain tables dont get populated with data

Open amenbreaks opened this issue 2 years ago • 1 comments

Hey, I want to profile a few apps, I am using a moto g40 fusion with android 12. My perfetto settings are:- image image image image image image image image image image

I made a script to parse the trace file and convert it to csv's of various relevant tables

from perfetto.trace_processor import TraceProcessor

FILE="example.trace"

tp = TraceProcessor(trace=FILE)

def run(table):
        qr_it = tp.query(f'select * from {table};')
        qr_it.as_pandas_dataframe().to_csv(FILE[:-6]+f'.{table}.csv')

tp.query('INCLUDE PERFETTO MODULE android.dvfs;')
tp.query('INCLUDE PERFETTO MODULE common.slices;')
tp.query('INCLUDE PERFETTO MODULE android.anrs;')
tp.query('INCLUDE PERFETTO MODULE android.battery;')
tp.query('INCLUDE PERFETTO MODULE android.binder;')
tp.query('INCLUDE PERFETTO MODULE android.io;')
tp.query('INCLUDE PERFETTO MODULE android.monitor_contention;')
tp.query('INCLUDE PERFETTO MODULE android.network_packets;')
tp.query('INCLUDE PERFETTO MODULE android.process_metadata;')
tp.query('INCLUDE PERFETTO MODULE android.statsd;')
tp.query('INCLUDE PERFETTO MODULE linux.cpu_idle;')
tp.query('INCLUDE PERFETTO MODULE pkvm.hypervisor;')
tp.query('INCLUDE PERFETTO MODULE sched.thread_level_parallelism;')

tables = ["android_dvfs_counters", "thread_slice", "process_slice", "android_anrs", 
          "android_battery_charge","android_binder_metrics_by_process", "android_sync_binder_metrics_by_txn", 
          "android_sync_binder_thread_state_by_txn", "android_sync_binder_blocked_functions_by_txn", 
          "android_async_binder_metrics_by_txn", "android_binder_txns", "android_io_f2fs_counter_stats", 
          "android_io_f2fs_write_stats", "android_io_f2fs_aggregate_write_stats", "android_monitor_contention", 
          "android_monitor_contention_chain", "android_monitor_contention_chain_thread_state", 
          "android_monitor_contention_chain_thread_state_by_txn", "android_monitor_contention_chain_blocked_functions_by_txn", 
          "android_network_packets", "android_process_metadata", "android_statsd_atoms", "linux_cpu_idle_stats", 
          "pkvm_hypervisor_events", "sched_runnable_thread_count", "sched_active_cpu_count"]

for t in tables:
        run(t)

Using this code, a lot of tables are empty, namely, android_anrs, android_dvfs_counters, android_io_f2fs_aggregate_write_stats, android_io_f2fs_counter_stats, android_io_f2fs_write_stats, android_monitor_contention_chain, linux_cpu_idle_stats and pkvm_hypervisor_events.

Now the problem is, with this app, I happen to interact with the filesystem as I saved a file in the storage so I expect the io f2fs tables to get populated, and the app is pretty slow so I believe ANRs should also be present. I know nothing about dvfs counters, so if you could tell me what dvfs is, or point me to the right direction, then it would be much appreciated.

amenbreaks avatar Mar 06 '24 12:03 amenbreaks

The way Trace Processor is written all of the tables will always be accessible, they might just be empty if there would be no data available from the trace to populate the tables. The best approach is to look for table/tables you know and understand why they would be populated, rather then trying a bunch of them without fully understanding what is the data they should contain.

If you have a table that you expect to be populated with the config you have, please provide us with both

  • config (load the trace in the UI, open the "Info and stats" tab, config is the "trace_config_pbtx" row)
  • trace and we will try to debug the issue.

Hope it helps. Feel free to ask for any explanation or give any suggestions if documentation is unclear.

aMayzner avatar Mar 08 '24 14:03 aMayzner