mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 17:41:24 -07:00
Add render counter in debug mode (#5242)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
32
packages/cli/src/ui/components/DebugProfiler.tsx
Normal file
32
packages/cli/src/ui/components/DebugProfiler.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { Text, useInput } from 'ink';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
export const DebugProfiler = () => {
|
||||
const numRenders = useRef(0);
|
||||
const [showNumRenders, setShowNumRenders] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
numRenders.current++;
|
||||
});
|
||||
|
||||
useInput((input, key) => {
|
||||
if (key.ctrl && input === 'b') {
|
||||
setShowNumRenders((prev) => !prev);
|
||||
}
|
||||
});
|
||||
|
||||
if (!showNumRenders) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Text color={Colors.AccentYellow}>Renders: {numRenders.current} </Text>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user