mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-12 23:21:27 -07:00
19 lines
472 B
TypeScript
19 lines
472 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
export const bytesToMB = (bytes: number): number => bytes / (1024 * 1024);
|
|
|
|
export const formatMemoryUsage = (bytes: number): string => {
|
|
const gb = bytes / (1024 * 1024 * 1024);
|
|
if (bytes < 1024 * 1024) {
|
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
}
|
|
if (bytes < 1024 * 1024 * 1024) {
|
|
return `${bytesToMB(bytes).toFixed(1)} MB`;
|
|
}
|
|
return `${gb.toFixed(2)} GB`;
|
|
};
|