File tree Expand file tree Collapse file tree 6 files changed +14
-7
lines changed
com.android.AndroidPerfTraceCounters
com.android.WearLongBatteryTracing
dev.perfetto.ProcessSummary
dev.perfetto.TraceInfoPage/tabs Expand file tree Collapse file tree 6 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -525,7 +525,7 @@ async function getTraceInfo(
525525 ( await engine . query ( `select * from ftrace_event limit 1` ) ) . numRows ( ) > 0 ;
526526
527527 const uuidRes = await engine . query ( `select str_value as uuid from metadata
528- where name = 'trace_uuid'` ) ;
528+ where name = 'trace_uuid' limit 1 ` ) ;
529529 // trace_uuid can be missing from the TP tables if the trace is empty or in
530530 // other similar edge cases.
531531 const uuid = uuidRes . numRows ( ) > 0 ? uuidRes . firstRow ( { uuid : STR } ) . uuid : '' ;
@@ -555,7 +555,7 @@ async function getTraceInfo(
555555
556556async function getTraceType ( engine : Engine ) {
557557 const result = await engine . query (
558- `select str_value from metadata where name = 'trace_type'` ,
558+ `select str_value from metadata where name = 'trace_type' limit 1 ` ,
559559 ) ;
560560
561561 if ( result . numRows ( ) === 0 ) return undefined ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const PERF_TRACE_COUNTERS_PRECONDITION = `
2424 WHERE
2525 name = 'trace_config_pbtxt'
2626 AND str_value GLOB '*ftrace_events: "perf_trace_counters/sched_switch_with_ctrs"*'
27+ LIMIT 1
2728` ;
2829
2930export default class implements PerfettoPlugin {
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ export default class WearLongBatteryTracingPlugin implements PerfettoPlugin {
213213 */
214214 async onTraceLoad ( ctx : Trace ) : Promise < void > {
215215 const result = await ctx . engine . query (
216- `SELECT int_value FROM metadata WHERE name = 'statsd_triggering_subscription_id'` ,
216+ `SELECT int_value FROM metadata WHERE name = 'statsd_triggering_subscription_id' limit 1 ` ,
217217 ) ;
218218 const row = result . maybeFirstRow ( { int_value : LONG } ) ;
219219 if ( ! row ) {
Original file line number Diff line number Diff line change @@ -84,9 +84,9 @@ export default class implements PerfettoPlugin {
8484 android_process_metadata.debuggable as isDebuggable,
8585 case
8686 when process.name = 'system_server' then
87- ifnull((select int_value from metadata where name = 'android_profile_system_server'), 0)
87+ ifnull((select int_value from metadata where name = 'android_profile_system_server' limit 1 ), 0)
8888 when process.name GLOB 'zygote*' then
89- ifnull((select int_value from metadata where name = 'android_profile_boot_classpath'), 0)
89+ ifnull((select int_value from metadata where name = 'android_profile_boot_classpath' limit 1 ), 0)
9090 else 0
9191 end as isBootImageProfiling,
9292 ifnull((
Original file line number Diff line number Diff line change @@ -85,6 +85,11 @@ export async function loadImportErrorsData(
8585 logs : [ ] as ImportLogRow [ ] ,
8686 } ) ) ;
8787
88+ const categoryMap = new Map < string , ErrorCategory > ( ) ;
89+ for ( const category of categories ) {
90+ categoryMap . set ( category . name , category ) ;
91+ }
92+
8893 // Load import logs for each category
8994 const logsResult = await engine . query ( `
9095 select
@@ -100,7 +105,7 @@ export async function loadImportErrorsData(
100105 ` ) ;
101106
102107 for ( const iter = logsResult . iter ( importLogSpec ) ; iter . valid ( ) ; iter . next ( ) ) {
103- const category = categories . find ( ( c ) => c . name === iter . name ) ;
108+ const category = categoryMap . get ( iter . name ) ;
104109 if ( ! category ) continue ;
105110
106111 const traceId = iter . trace_id ;
Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ export async function hasWattsonSufficientCPUConfigs(
3939 const query = `
4040 SELECT str_value
4141 FROM metadata
42- WHERE name = 'trace_config_pbtxt';
42+ WHERE name = 'trace_config_pbtxt'
43+ LIMIT 1;
4344 ` ;
4445
4546 const result = await engine . query ( query ) ;
You can’t perform that action at this time.
0 commit comments