3
0
Fork 0
Read-only mirror of the profiler cog from https://github.com/vertyco/vrt-cogs
Find a file
2026-03-05 16:00:55 +00:00
.cog-mirrorer Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
commands Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
common Update profiler to upstream commit 24da731f4609fc007828b93318bcabefba924fa4 2026-03-05 16:00:55 +00:00
views Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
.gitignore Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
__init__.py Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
abc.py Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
info.json Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
LICENSE Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00
main.py Update profiler to upstream commit 24da731f4609fc007828b93318bcabefba924fa4 2026-03-05 16:00:55 +00:00
README.md Update profiler to upstream commit f41f47a9a7cd7e575a90c8b07588d0c56e7b4600 2026-02-21 08:00:36 +00:00

Profiler Help

Cog profiling tools for bot owners and developers

This cog provides tools to profile the performance of other cogs' commands, methods, tasks, and listeners.

By default, metrics are not stored persistently and are only kept for 1 hour in memory. You can change these settings with the [p]profiler base command.

profiler

  • Usage: [p]profiler
  • Restricted to: BOT_OWNER

Profiling commands

profiler pyspy

  • Usage: [p]profiler pyspy [duration=30] [subprocesses=False]
  • Aliases: fullprofile and cpuprofile

Run a full CPU profile using py-spy.

This command attaches py-spy to the bot process and records CPU usage for the specified duration. It then displays a breakdown of where the bot is spending its CPU time, helping identify performance bottlenecks.

Arguments:
- duration: How long to profile in seconds (default: 30, max: 300)
- subprocesses: Profile subprocesses too (default: False)

Requirements:
- py-spy must be installed: pip install py-spy
- On Linux, may need to set ptrace scope: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

profiler verbose

  • Usage: [p]profiler verbose

Toggle verbose stats

profiler attach

  • Usage: [p]profiler attach <cogs>

Attach a profiler to a cog

profiler view

  • Usage: [p]profiler view
  • Aliases: v

View a menu of the current stats

profiler settings

  • Usage: [p]profiler settings

View the current profiler settings

profiler memory

  • Usage: [p]profiler memory [limit=15]
  • Aliases: mem and m

Profile memory usage of objects in the current environment

profiler methods

  • Usage: [p]profiler methods
  • Aliases: list

List all available methods that can be tracked

Sends a text file containing all trackable methods organized by cog. Useful for finding specific methods to profile without attaching to entire cogs.

profiler save

  • Usage: [p]profiler save

Toggle saving stats persistently

Warning: The config size can grow very large if this is enabled for a long time

profiler delta

  • Usage: [p]profiler delta <delta>

Set the data retention period in hours

profiler detach

  • Usage: [p]profiler detach <cogs>

Remove a cog from the profiling list

This will remove all collected stats for this cog from the config