mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
feat: add --show_memory_usage flag to display memory usage in status bar (#606)
This commit is contained in:
parent
3291ffbe09
commit
01768d7759
10 changed files with 205 additions and 12 deletions
16
packages/cli/src/ui/utils/formatters.ts
Normal file
16
packages/cli/src/ui/utils/formatters.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
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 `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
||||
}
|
||||
return `${gb.toFixed(2)} GB`;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue