feat: Add startup profiler to measure and record application initialization phases. (#13638)

This commit is contained in:
Kevin Ramdass
2025-12-01 10:06:13 -08:00
committed by GitHub
parent 613fb2fed6
commit db027dd95b
10 changed files with 591 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import { isDevelopment } from '../utils/installationInfo.js';
import type { ICommandLoader } from './types.js';
import type { SlashCommand } from '../ui/commands/types.js';
import type { Config } from '@google/gemini-cli-core';
import { startupProfiler } from '@google/gemini-cli-core';
import { aboutCommand } from '../ui/commands/aboutCommand.js';
import { authCommand } from '../ui/commands/authCommand.js';
import { bugCommand } from '../ui/commands/bugCommand.js';
@@ -56,6 +57,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
* @returns A promise that resolves to an array of `SlashCommand` objects.
*/
async loadCommands(_signal: AbortSignal): Promise<SlashCommand[]> {
const handle = startupProfiler.start('load_builtin_commands');
const allDefinitions: Array<SlashCommand | null> = [
aboutCommand,
authCommand,
@@ -92,7 +94,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
setupGithubCommand,
terminalSetupCommand,
];
handle?.end();
return allDefinitions.filter((cmd): cmd is SlashCommand => cmd !== null);
}
}