tui: add heap snapshot option to system menu for debugging memory usage
This commit is contained in:
parent
db8d83b53d
commit
2aaea71eb3
1 changed files with 15 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ import { KVProvider, useKV } from "./context/kv"
|
||||||
import { Provider } from "@/provider/provider"
|
import { Provider } from "@/provider/provider"
|
||||||
import { ArgsProvider, useArgs, type Args } from "./context/args"
|
import { ArgsProvider, useArgs, type Args } from "./context/args"
|
||||||
import open from "open"
|
import open from "open"
|
||||||
|
import { writeHeapSnapshot } from "v8"
|
||||||
import { PromptRefProvider, usePromptRef } from "./context/prompt"
|
import { PromptRefProvider, usePromptRef } from "./context/prompt"
|
||||||
|
|
||||||
async function getTerminalBackgroundColor(): Promise<"dark" | "light"> {
|
async function getTerminalBackgroundColor(): Promise<"dark" | "light"> {
|
||||||
|
|
@ -475,6 +476,20 @@ function App() {
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Write heap snapshot",
|
||||||
|
category: "System",
|
||||||
|
value: "app.heap_snapshot",
|
||||||
|
onSelect: (dialog) => {
|
||||||
|
const path = writeHeapSnapshot()
|
||||||
|
toast.show({
|
||||||
|
variant: "info",
|
||||||
|
message: `Heap snapshot written to ${path}`,
|
||||||
|
duration: 5000,
|
||||||
|
})
|
||||||
|
dialog.clear()
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Suspend terminal",
|
title: "Suspend terminal",
|
||||||
value: "terminal.suspend",
|
value: "terminal.suspend",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue