Store mem profile file in /tmp

This commit is contained in:
Sleepy Monax 2024-01-22 14:56:46 +01:00
parent 35843cce22
commit da8d82e09f

View file

@ -209,7 +209,7 @@ def debug(cmd: list[str], debugger: str = "lldb", wait: bool = False):
def _profileCpu(cmd: list[str], rate=1000): def _profileCpu(cmd: list[str], rate=1000):
mkdir(const.TMP_DIR) mkdir(const.TMP_DIR)
perfFile = f"{const.TMP_DIR}/perf.data" perfFile = f"{const.TMP_DIR}/cpu-profile.data"
try: try:
exec( exec(
"perf", "perf",
@ -241,7 +241,8 @@ def _profileCpu(cmd: list[str], rate=1000):
def _profileMem(cmd: list[str]): def _profileMem(cmd: list[str]):
exec("heaptrack", *cmd) perfFile = f"{const.TMP_DIR}/mem-profile.data"
exec("heaptrack", "-o", perfFile, *cmd)
def profile(cmd: list[str], rate=1000, what: Literal["cpu", "mem"] = "cpu"): def profile(cmd: list[str], rate=1000, what: Literal["cpu", "mem"] = "cpu"):