@@ -201,6 +201,8 @@ class TrackDecider {
201
201
children : [ ] ,
202
202
} ;
203
203
204
+ private hasCpuUsage = true ;
205
+
204
206
// Set of |upid| from the |process| table recording
205
207
// processes that are idle (< 0.1% CPU)
206
208
private idleUpids = new Set < number > ( ) ;
@@ -1736,7 +1738,10 @@ class TrackDecider {
1736
1738
// Don't need the Idle Threads group in a process that is idle
1737
1739
// because all of its threads would redundantly be in that group.
1738
1740
// And don't create a group for just one idle thread.
1739
- const idle = upid === null ? undefined : this . idleUtids . get ( upid ) ;
1741
+ // And finally, idle has no meaning without CPU usage information
1742
+ const idle = ! this . hasCpuUsage || upid === null ?
1743
+ undefined :
1744
+ this . idleUtids . get ( upid ) ;
1740
1745
const isIdleProcess = upid !== null && this . idleUpids . has ( upid ) ;
1741
1746
return idle !== undefined && ! isIdleProcess &&
1742
1747
( idle . has ( utid ) && idle . size > 1 ) ?
@@ -1862,8 +1867,11 @@ class TrackDecider {
1862
1867
// Map of process upid to its track group descriptor
1863
1868
const processTrackGroups = new Map < string , AddTrackGroupArgs > ( ) ;
1864
1869
1865
- // Map of idle process upid to its track group for descriptor
1866
- const idleProcessTrackGroups = new Map < string , AddTrackGroupArgs > ( ) ;
1870
+ // Map of idle process upid to its track group for descriptor. But if we
1871
+ // didn't capture CPU information then this concept has no meaning
1872
+ const idleProcessTrackGroups = this . hasCpuUsage ?
1873
+ new Map < string , AddTrackGroupArgs > ( ) :
1874
+ undefined ;
1867
1875
1868
1876
// We want to create groups of tracks in a specific order.
1869
1877
// The tracks should be grouped:
@@ -2003,10 +2011,12 @@ class TrackDecider {
2003
2011
chromeProcessLabels : STR ,
2004
2012
} ) ;
2005
2013
2006
- const idleProcessesGroupId = this . lazyTrackGroup ( 'Idle Processes (< 0.1%)' ,
2007
- { collapsed : true ,
2008
- description : 'CPU usage of an idle process accounts for less than 0.1% of the total trace duration.' ,
2009
- lazyParentGroup : this . processesGroup } ) ;
2014
+ const idleProcessesGroupId = idleProcessTrackGroups ?
2015
+ this . lazyTrackGroup ( 'Idle Processes (< 0.1%)' ,
2016
+ { collapsed : true ,
2017
+ description : 'CPU usage of an idle process accounts for less than 0.1% of the total trace duration.' ,
2018
+ lazyParentGroup : this . processesGroup } ) :
2019
+ undefined ;
2010
2020
2011
2021
// An "idle process" is measured against the duration of the trace.
2012
2022
// The threshold is 0.1%, or one one-thousandth, of the trace time.
@@ -2092,13 +2102,13 @@ class TrackDecider {
2092
2102
// many expanded process tracks for some perf traces, leading to
2093
2103
// jankyness.
2094
2104
collapsed : ! hasHeapProfiles ,
2095
- parentGroup : ! idleProcess ?
2105
+ parentGroup : ! idleProcess || ! idleProcessesGroupId ?
2096
2106
this . processesGroup ( ) :
2097
2107
idleProcessesGroupId ( ) ,
2098
2108
} ;
2099
2109
this . trackGroupsToAdd . push ( trackGroup ) ;
2100
2110
processTrackGroups . set ( pUuid , trackGroup ) ;
2101
- if ( idleProcess ) {
2111
+ if ( idleProcess && idleProcessTrackGroups ) {
2102
2112
idleProcessTrackGroups . set ( pUuid , trackGroup ) ;
2103
2113
}
2104
2114
}
@@ -2122,7 +2132,7 @@ class TrackDecider {
2122
2132
2123
2133
const totalProcessCount = threadsPerProcess . numRows ( ) ;
2124
2134
const shownProcessCount = processTrackGroups . size ;
2125
- const idleProcessCount = idleProcessTrackGroups . size ;
2135
+ const idleProcessCount = idleProcessTrackGroups ? .size ?? 0 ;
2126
2136
const nullProcessCount = totalProcessCount - shownProcessCount ;
2127
2137
2128
2138
if ( shownProcessCount > 0 ) {
@@ -2139,7 +2149,7 @@ class TrackDecider {
2139
2149
}
2140
2150
}
2141
2151
}
2142
- if ( idleProcessCount > 0 ) {
2152
+ if ( idleProcessCount > 0 && idleProcessesGroupId ) {
2143
2153
// There are idle processes actually showing tracks
2144
2154
const idleProcessesGroup = this . getTrackGroup ( idleProcessesGroupId ( ) ) ;
2145
2155
if ( idleProcessesGroup ) {
@@ -2511,6 +2521,9 @@ class TrackDecider {
2511
2521
async decideTracks ( filterTracks = false ) : Promise < DeferredAction [ ] > {
2512
2522
await this . defineMaxLayoutDepthSqlFunction ( ) ;
2513
2523
2524
+ const cpus = await this . engine . getCpus ( ) ;
2525
+ this . hasCpuUsage = cpus . length > 0 ;
2526
+
2514
2527
// Add first the global tracks that don't require per-process track groups.
2515
2528
await this . addCpuSchedulingTracks ( ) ;
2516
2529
await this . addFtraceTrack (
0 commit comments