Share elapsed-time rounding for bundle downloads

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Henry Mercer
2026-09-16 19:51:23 +01:00
parent 89606bbad1
commit f4fa111630
5 changed files with 63 additions and 31 deletions

56
lib/entry-points.js generated
View File

@@ -4305,7 +4305,7 @@ var require_util2 = __commonJS({
var { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = require_constants3();
var { getGlobalOrigin } = require_global();
var { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require_data_url();
var { performance: performance7 } = require("node:perf_hooks");
var { performance: performance8 } = require("node:perf_hooks");
var { isBlobLike, ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util();
var assert = require("node:assert");
var { isUint8Array } = require("node:util/types");
@@ -4464,7 +4464,7 @@ var require_util2 = __commonJS({
};
}
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
return coarsenTime(performance7.now(), crossOriginIsolatedCapability);
return coarsenTime(performance8.now(), crossOriginIsolatedCapability);
}
function createOpaqueTimingInfo(timingInfo) {
return {
@@ -142119,7 +142119,7 @@ module.exports = __toCommonJS(entry_points_exports);
// src/analyze-action.ts
var fs23 = __toESM(require("fs"));
var import_path5 = __toESM(require("path"));
var import_perf_hooks5 = require("perf_hooks");
var import_perf_hooks6 = require("perf_hooks");
var core17 = __toESM(require_core());
// src/action-common.ts
@@ -142201,6 +142201,7 @@ var fs = __toESM(require("fs"));
var fsPromises = __toESM(require("fs/promises"));
var os = __toESM(require("os"));
var path = __toESM(require("path"));
var import_perf_hooks = require("perf_hooks");
var core2 = __toESM(require_core());
var io = __toESM(require_io());
@@ -145892,6 +145893,9 @@ async function bundleDb(config, language, codeql, dbName, { includeDiagnostics }
);
return databaseBundlePath;
}
function durationMsSince(startTime) {
return Math.round(import_perf_hooks.performance.now() - startTime);
}
async function delay(milliseconds, opts) {
const { allowProcessExit } = opts || {};
return new Promise((resolve14) => {
@@ -148633,7 +148637,7 @@ var SarifScanOrder = [
// src/analyze.ts
var fs17 = __toESM(require("fs"));
var path16 = __toESM(require("path"));
var import_perf_hooks4 = require("perf_hooks");
var import_perf_hooks5 = require("perf_hooks");
var io5 = __toESM(require_io());
// src/autobuild.ts
@@ -148897,7 +148901,7 @@ function wrapCliConfigurationError(cliError) {
// src/config-utils.ts
var fs10 = __toESM(require("fs"));
var path11 = __toESM(require("path"));
var import_perf_hooks = require("perf_hooks");
var import_perf_hooks2 = require("perf_hooks");
var core10 = __toESM(require_core());
// src/caching-utils.ts
@@ -150523,9 +150527,9 @@ async function initActionState({
};
}
async function downloadCacheWithTime(codeQL, languages, logger) {
const start = import_perf_hooks.performance.now();
const start = import_perf_hooks2.performance.now();
const trapCaches = await downloadTrapCaches(codeQL, languages, logger);
const trapCacheDownloadTime = import_perf_hooks.performance.now() - start;
const trapCacheDownloadTime = import_perf_hooks2.performance.now() - start;
return { trapCaches, trapCacheDownloadTime };
}
async function loadUserConfig(actionState, configFile, workspacePath, apiDetails, tempDir) {
@@ -150929,10 +150933,10 @@ async function initConfig(actionState, inputs) {
}
if (await features.getValue("ignore_generated_files" /* IgnoreGeneratedFiles */) && isDynamicWorkflow()) {
try {
const generatedFilesCheckStartedAt = import_perf_hooks.performance.now();
const generatedFilesCheckStartedAt = import_perf_hooks2.performance.now();
const generatedFiles = await getGeneratedFiles(inputs.sourceRoot);
const generatedFilesDuration = Math.round(
import_perf_hooks.performance.now() - generatedFilesCheckStartedAt
import_perf_hooks2.performance.now() - generatedFilesCheckStartedAt
);
if (generatedFiles.length > 0) {
config.computedConfig["paths-ignore"] ??= [];
@@ -151216,7 +151220,7 @@ async function logGeneratedFilesTelemetry(config, duration, generatedFilesCount)
// src/setup-codeql.ts
var fs14 = __toESM(require("fs"));
var path13 = __toESM(require("path"));
var import_perf_hooks3 = require("perf_hooks");
var import_perf_hooks4 = require("perf_hooks");
var core12 = __toESM(require_core());
var toolcache3 = __toESM(require_tool_cache());
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
@@ -151789,7 +151793,7 @@ function inferCompressionMethod(tarPath) {
var fs13 = __toESM(require("fs"));
var os4 = __toESM(require("os"));
var path12 = __toESM(require("path"));
var import_perf_hooks2 = require("perf_hooks");
var import_perf_hooks3 = require("perf_hooks");
var core11 = __toESM(require_core());
var import_http_client = __toESM(require_lib());
var toolcache2 = __toESM(require_tool_cache());
@@ -151802,7 +151806,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
logger.info(
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`
);
const startTime = import_perf_hooks2.performance.now();
const startTime = import_perf_hooks3.performance.now();
try {
if (compressionMethod === "zstd" && process.platform === "linux") {
logger.info(`Streaming the extraction of the CodeQL bundle.`);
@@ -151814,7 +151818,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
tarVersion,
logger
);
const totalDurationMs = Math.round(import_perf_hooks2.performance.now() - startTime);
const totalDurationMs = durationMsSince(startTime);
logger.info(
`Finished downloading and extracting CodeQL bundle to ${dest} (${formatDuration(
totalDurationMs
@@ -151832,14 +151836,14 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
);
core11.warning(`Falling back to downloading the bundle before extracting.`);
}
const toolsDownloadStart = import_perf_hooks2.performance.now();
const toolsDownloadStart = import_perf_hooks3.performance.now();
const archivedBundlePath = await toolcache2.downloadTool(
codeqlURL,
void 0,
authorization,
headers
);
const downloadDurationMs = Math.round(import_perf_hooks2.performance.now() - toolsDownloadStart);
const downloadDurationMs = durationMsSince(toolsDownloadStart);
logger.info(
`Finished downloading CodeQL bundle to ${archivedBundlePath} (${formatDuration(
downloadDurationMs
@@ -151848,7 +151852,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
let extractionDurationMs;
try {
logger.info("Extracting CodeQL bundle.");
const extractionStart = import_perf_hooks2.performance.now();
const extractionStart = import_perf_hooks3.performance.now();
await extract(
archivedBundlePath,
dest,
@@ -151856,7 +151860,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
tarVersion,
logger
);
extractionDurationMs = Math.round(import_perf_hooks2.performance.now() - extractionStart);
extractionDurationMs = durationMsSince(extractionStart);
logger.info(
`Finished extracting CodeQL bundle to ${dest} (${formatDuration(
extractionDurationMs
@@ -151868,7 +151872,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
return {
downloadDurationMs,
extractionDurationMs,
totalDurationMs: Math.round(import_perf_hooks2.performance.now() - startTime)
totalDurationMs: durationMsSince(startTime)
};
}
async function downloadAndExtractZstdWithStreaming(codeqlURL, dest, authorization, headers, tarVersion, logger) {
@@ -152679,7 +152683,7 @@ async function downloadCodeQLBundle(action, source, apiDetails, tarVersion, temp
const { bundle } = source;
const { logger } = action;
await tryDeleteToolcacheBundles(action);
const startTime = import_perf_hooks3.performance.now();
const startTime = import_perf_hooks4.performance.now();
try {
return await downloadCodeQL(
source,
@@ -152709,7 +152713,7 @@ async function downloadCodeQLBundle(action, source, apiDetails, tarVersion, temp
...result,
statusReport: {
...result.statusReport,
totalDurationMs: Math.round(import_perf_hooks3.performance.now() - startTime),
totalDurationMs: durationMsSince(startTime),
perLanguageBundleFallback: true
}
};
@@ -153873,10 +153877,10 @@ function dbIsFinalized(config, language, logger) {
}
}
async function finalizeDatabaseCreation(codeql, features, config, threadsFlag, memoryFlag, logger) {
const extractionStart = import_perf_hooks4.performance.now();
const extractionStart = import_perf_hooks5.performance.now();
await runExtraction(codeql, features, config, logger);
const extractionTime = import_perf_hooks4.performance.now() - extractionStart;
const trapImportStart = import_perf_hooks4.performance.now();
const extractionTime = import_perf_hooks5.performance.now() - extractionStart;
const trapImportStart = import_perf_hooks5.performance.now();
for (const language of config.languages) {
if (dbIsFinalized(config, language, logger)) {
logger.info(
@@ -153893,7 +153897,7 @@ async function finalizeDatabaseCreation(codeql, features, config, threadsFlag, m
logger.endGroup();
}
}
const trapImportTime = import_perf_hooks4.performance.now() - trapImportStart;
const trapImportTime = import_perf_hooks5.performance.now() - trapImportStart;
return {
scanned_language_extraction_duration_ms: Math.round(extractionTime),
trap_import_duration_ms: Math.round(trapImportTime)
@@ -156700,9 +156704,9 @@ async function run({ startedAt, logger }) {
features,
logger
);
const trapCacheUploadStartTime = import_perf_hooks5.performance.now();
const trapCacheUploadStartTime = import_perf_hooks6.performance.now();
didUploadTrapCaches = await uploadTrapCaches(codeql, config, logger);
trapCacheUploadTime = import_perf_hooks5.performance.now() - trapCacheUploadStartTime;
trapCacheUploadTime = import_perf_hooks6.performance.now() - trapCacheUploadStartTime;
trapCacheCleanupTelemetry = await cleanupTrapCaches(
config,
features,