@@ -49,9 +49,31 @@ export const startTrace = defineTool({
4949 } ) ;
5050 }
5151
52- // TODO(jacktfranklin): determine the exact list of categories and
53- // align with DevTools
54- await page . tracing . start ( ) ;
52+ // This panel may be opened with trace data recorded in other tools.
53+ // Keep in sync with the categories arrays in:
54+ // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/timeline/TimelineController.ts
55+ // https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/gather/gatherers/trace.js
56+ const categories = [
57+ '-*' ,
58+ 'blink.console' ,
59+ 'blink.user_timing' ,
60+ 'devtools.timeline' ,
61+ 'disabled-by-default-devtools.screenshot' ,
62+ 'disabled-by-default-devtools.timeline' ,
63+ 'disabled-by-default-devtools.timeline.invalidationTracking' ,
64+ 'disabled-by-default-devtools.timeline.frame' ,
65+ 'disabled-by-default-devtools.timeline.stack' ,
66+ 'disabled-by-default-v8.cpu_profiler' ,
67+ 'disabled-by-default-v8.cpu_profiler.hires' ,
68+ 'latencyInfo' ,
69+ 'loading' ,
70+ 'disabled-by-default-lighthouse' ,
71+ 'v8.execute' ,
72+ 'v8' ,
73+ ] ;
74+ await page . tracing . start ( {
75+ categories,
76+ } ) ;
5577
5678 if ( request . params . reload ) {
5779 await page . goto ( pageUrlForTracing , {
@@ -98,8 +120,14 @@ async function stopTracingAndAppendOutput(
98120 response . appendResponseLine ( 'The performance trace has been stopped.' ) ;
99121 if ( result ) {
100122 const insightText = insightOutput ( result ) ;
101- response . appendResponseLine ( 'Insights with performance opportunities:' ) ;
102- response . appendResponseLine ( insightText ) ;
123+ if ( insightText ) {
124+ response . appendResponseLine ( 'Insights with performance opportunities:' ) ;
125+ response . appendResponseLine ( insightText ) ;
126+ } else {
127+ response . appendResponseLine (
128+ 'No insights has been found. The performance looks good!' ,
129+ ) ;
130+ }
103131 }
104132 } catch ( e ) {
105133 logger (
0 commit comments