mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 06:25:16 -07:00
feat(test): add large conversation scenario for performance test (#25331)
This commit is contained in:
@@ -147,7 +147,9 @@ export class PerfTestHarness {
|
||||
throw new Error(`No active timer found for label "${label}"`);
|
||||
}
|
||||
|
||||
const wallClockMs = performance.now() - timer.startTime;
|
||||
// Round wall-clock time to nearest 0.1 ms
|
||||
const wallClockMs =
|
||||
Math.round((performance.now() - timer.startTime) * 10) / 10;
|
||||
const cpuDelta = process.cpuUsage(timer.startCpuUsage);
|
||||
this.activeTimers.delete(label);
|
||||
|
||||
|
||||
@@ -193,6 +193,28 @@ export function checkModelOutputContent(
|
||||
return isValid;
|
||||
}
|
||||
|
||||
export interface MetricDataPoint {
|
||||
attributes?: Record<string, unknown>;
|
||||
value?: {
|
||||
sum?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
count?: number;
|
||||
};
|
||||
startTime?: [number, number];
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
export interface TelemetryMetric {
|
||||
descriptor: {
|
||||
name: string;
|
||||
type?: string;
|
||||
description?: string;
|
||||
unit?: string;
|
||||
};
|
||||
dataPoints: MetricDataPoint[];
|
||||
}
|
||||
|
||||
export interface ParsedLog {
|
||||
attributes?: {
|
||||
'event.name'?: string;
|
||||
@@ -213,11 +235,7 @@ export interface ParsedLog {
|
||||
prompt_id?: string;
|
||||
};
|
||||
scopeMetrics?: {
|
||||
metrics: {
|
||||
descriptor: {
|
||||
name: string;
|
||||
};
|
||||
}[];
|
||||
metrics: TelemetryMetric[];
|
||||
}[];
|
||||
}
|
||||
|
||||
@@ -1297,6 +1315,10 @@ export class TestRig {
|
||||
return logs;
|
||||
}
|
||||
|
||||
readTelemetryLogs(): ParsedLog[] {
|
||||
return this._readAndParseTelemetryLog();
|
||||
}
|
||||
|
||||
private _readAndParseTelemetryLog(): ParsedLog[] {
|
||||
// Telemetry is always written to the test directory
|
||||
const logFilePath = join(this.homeDir!, 'telemetry.log');
|
||||
@@ -1450,7 +1472,7 @@ export class TestRig {
|
||||
);
|
||||
}
|
||||
|
||||
readMetric(metricName: string): Record<string, unknown> | null {
|
||||
readMetric(metricName: string): TelemetryMetric | null {
|
||||
const logs = this._readAndParseTelemetryLog();
|
||||
for (const logData of logs) {
|
||||
if (logData.scopeMetrics) {
|
||||
|
||||
Reference in New Issue
Block a user