@@ -31,7 +31,21 @@ const STREAMING_STALL_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
3131const TOOLCACHE_TOOL_NAME = "CodeQL" ;
3232
3333export type ToolsDownloadStatusReport = {
34+ /**
35+ * Time spent downloading the bundle, in milliseconds. Not populated when the bundle is downloaded
36+ * and extracted concurrently, since the two cannot be told apart.
37+ */
3438 downloadDurationMs ?: number ;
39+ /**
40+ * Time spent extracting the bundle, in milliseconds. Not populated when the bundle is downloaded
41+ * and extracted concurrently, since the two cannot be told apart.
42+ */
43+ extractionDurationMs ?: number ;
44+ /**
45+ * Total time taken to make the bundle available on disk, in milliseconds. This includes any time
46+ * spent on a streaming attempt that failed and fell back to downloading before extracting.
47+ */
48+ totalDurationMs : number ;
3549} ;
3650
3751export async function downloadAndExtract (
@@ -47,11 +61,12 @@ export async function downloadAndExtract(
4761 `Downloading CodeQL tools from ${ codeqlURL } . This may take a while.` ,
4862 ) ;
4963
64+ const startTime = performance . now ( ) ;
65+
5066 try {
5167 if ( compressionMethod === "zstd" && process . platform === "linux" ) {
5268 logger . info ( `Streaming the extraction of the CodeQL bundle.` ) ;
5369
54- const toolsInstallStart = performance . now ( ) ;
5570 await downloadAndExtractZstdWithStreaming (
5671 codeqlURL ,
5772 dest ,
@@ -61,16 +76,14 @@ export async function downloadAndExtract(
6176 logger ,
6277 ) ;
6378
64- const combinedDurationMs = Math . round (
65- performance . now ( ) - toolsInstallStart ,
66- ) ;
79+ const totalDurationMs = Math . round ( performance . now ( ) - startTime ) ;
6780 logger . info (
6881 `Finished downloading and extracting CodeQL bundle to ${ dest } (${ formatDuration (
69- combinedDurationMs ,
82+ totalDurationMs ,
7083 ) } ).`,
7184 ) ;
7285
73- return { } ;
86+ return { totalDurationMs } ;
7487 }
7588 } catch ( e ) {
7689 core . warning (
@@ -98,7 +111,7 @@ export async function downloadAndExtract(
98111 ) } ).`,
99112 ) ;
100113
101- let extractionDurationMs : number ;
114+ let extractionDurationMs : number | undefined ;
102115
103116 try {
104117 logger . info ( "Extracting CodeQL bundle." ) ;
@@ -120,7 +133,11 @@ export async function downloadAndExtract(
120133 await cleanUpPath ( archivedBundlePath , "CodeQL bundle archive" , logger ) ;
121134 }
122135
123- return { downloadDurationMs } ;
136+ return {
137+ downloadDurationMs,
138+ extractionDurationMs,
139+ totalDurationMs : Math . round ( performance . now ( ) - startTime ) ,
140+ } ;
124141}
125142
126143async function downloadAndExtractZstdWithStreaming (
0 commit comments