feat: add --cprofile flag for runtime profiling
Writes cProfile stats to a file on shutdown for performance analysis. Enable in compose.yaml for container profiling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,6 +15,7 @@ build/
|
|||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
*.log
|
*.log
|
||||||
|
*.prof
|
||||||
|
|
||||||
# Personal config (keep example only)
|
# Personal config (keep example only)
|
||||||
config/bouncer.toml
|
config/bouncer.toml
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./src:/app/src:Z,ro
|
- ./src:/app/src:Z,ro
|
||||||
- ./config:/data:Z
|
- ./config:/data:Z
|
||||||
command: ["-c", "/data/bouncer.toml", "-v"]
|
command: ["-c", "/data/bouncer.toml", "-v", "--cprofile", "/data/bouncer.prof"]
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="enable debug logging",
|
help="enable debug logging",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--cprofile",
|
||||||
|
type=Path,
|
||||||
|
default=None,
|
||||||
|
metavar="PATH",
|
||||||
|
help="enable cProfile, write stats to PATH on shutdown",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--version",
|
"--version",
|
||||||
action="version",
|
action="version",
|
||||||
|
|||||||
Reference in New Issue
Block a user