/debug
/debug| Permission level required |
3 |
|---|---|
| Restrictions |
None |
{
"title": "<code>/debug</code>",
"rows": [
{
"field": "3",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "None",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Starts or stops a time profiler session. Gets more detailed information of function execution.
Syntax
debug start
- Starts a new debug time profiler session.
debug stop
- Stops the active debug time profiler session.
debug function <name>
- Used the same way as /function to get more detailed information of commands' execution. Could not be called directly or indirectly by
/return runor another/ function.
Arguments
<name>: function
- It must be a resource location or one prefixed with a
#, which resolves into a function or a function tag during command execution.
Result
| Command | Trigger | Java Edition |
|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable |
/debug start | A debug profiling session has already been started. | Failed |
/debug stop | There's no debug profiling session running. | |
/debug function | The specified functions or function tags do not exist. | |
/debug function | This command execution is caused by /return run or another / function. | |
| Any | Otherwise | Successful |
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | On fail | N/A | 0 | 0 |
/debug start | On success | N/A | 1 | 0 | |
/debug stop | On success | N/A | 1 | the average tps (ticks per second) during debug profiling | |
/debug function | On success | N/A | 1 | the total number of commands in the functions |
File structure
Function trace
When using /debug function, a txt file titled debug-trace-yyyy-MM-dd_HH.mm.ss.txt is created in .minecraft/debug.
In this file,
[C] <command>means the<command>is executed.[M] <message>means a message is returned.[E] <message>means a failure message is returned.[R = <num>] <command>means the<command>returns a brigadier return value.[C] <command> -> <num>means the<command>is executed and returns a brigadier return value.[F] <function> size=<num>means a function is called.
For most commands, the brigadier return value is equal to the result value that can be stored with /execute store result.
But for /execute ... with one or more of the following subcommands, each branch returns its success value as its brigadier return value:
... if ...(not at the end)... unless ...(not at the end)... as <targets> ...... at <targets> ...... positioned as <targets> ...... rotated as <targets> ...... facing entity <targets> <anchor> ...
Some commands like /return and /function have no brigadier return value.
Profile result
When using /debug stop, a txt file titled profile-results-yyyy-MM-dd_HH.mm.ss.txt is created in .minecraft/debug, which includes the result of profile dump.
Report
When using /debug report, a ZIP file is created with in .minecraft/debug/profiling the following structure:
- debug-report-yyyy-MM-dd_HH.mm.ss.zip
- levels
- minecraft or <other custom namespaces>
- overworld or the_end or the_nether or <other custom dimensions>
- block_entities.csv: Contains a list of block entities in the world in the format
x,y,z,type. - chunks.csv: Contains a list of chunk information in the format
x,z,level,in_memory,status,full_status,accessible_ready,ticking_ready,entity_ticking_ready,ticket,spawning,entity_count,block_entity_count. - entities.csv: Contains a list of entities in the world in the format
x,y,z,uuid,type,alive,custom_name. - example_crash.txt: An example crash file.
- stats.txt: Contains some stats.
- block_entities.csv: Contains a list of block entities in the world in the format
- overworld or the_end or the_nether or <other custom dimensions>
- minecraft or <other custom namespaces>
- classpath.txt: Contains the file paths of the external jars Minecraft uses.
- example_crash.txt: An example crash file.
- gamerules.txt: A plain text file containing a list of game rules and their values (
<gamerule>=<value>). - stats.txt: Contains some stats.
- threads.txt: All running threads.
- levels
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.3.1 | 12w27a | Added /debug. | |||||
| 1.8 | 14w31a | /debug can now be run in single-player.
| |||||
Added /debug chunk. | |||||||
| 1.8.1 | pre1 | Removed /debug chunk. | |||||
| 1.13 | 18w03a | Added commands to the profiler. | |||||
| 1.14.4 | pre1 | Added /debug report, used to get more detailed information while debugging performance. | |||||
| 1.17 | 21w15a | Added /debug function. | |||||
| Pre-release 1 | Removed /debug report. Replaced by F3+L and /perf. | ||||||
| 1.20.3 | 23w41a | Now the result value of /debug function is the total number of commands in the functions.
| |||||
Now /debug function cannot be called by /debug function. | |||||||
| 23w44a | Now /debug function cannot be called by /return run. | ||||||