{{about|the command that runs time profiler and function trace|the performance profiler|Commands/perf|the jvm profiler|Commands/jfr|other uses of "debug"|Debug}} {{exclusive|java}} {{Infobox command |name=debug |oplevel=3 }} 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 : Used the same way as [[Commands/function|/function]] to get more detailed information of commands' execution. Could not be called directly or indirectly by {{cmd|return run}} or another {{cmd|debug function}}. == Arguments == {{argument|name|function}} : {{arg desc|je=function}} == Result == {{Result table|onlyje=1}} {{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable}} {{Result table|cmd=/debug start|A debug profiling session has already been started.|fail}} {{Result table|cmd=/debug stop|There's no debug profiling session running.}} {{Result table|cmd=/debug function|The specified functions or function tags do not exist.}} {{Result table|cmd=/debug function|This command execution is caused by {{cmd|return run}} or another {{cmd|debug function}}.}} {{Result table|cmd=|succeed}} {{Result table}} == Output == {{Output table}} {{Output table|edition=je|On fail|N/A|0|0}} {{Output table|cmd=/debug start|On success|N/A|1|0}} {{Output table|cmd=/debug stop|On success|N/A|1|the average tps (ticks per second) during debug profiling}} {{Output table|cmd=/debug function|On success|N/A|1|the total number of commands in the functions}} {{Output table}} == File structure == === Function trace === When using {{cmd|debug function|link=none}}, a txt file titled '''debug-trace-yyyy-MM-dd_HH.mm.ss.txt''' is created in .minecraft/debug. In this file, *[C] means the is executed. *[M] means a message is returned. *[E] means a failure message is returned. *[R = ] means the returns a '''brigadier return value'''. *[C] -> means the is executed and returns a '''brigadier return value'''. *[F] size= means a function is called. For most of 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 ... * ... at ... * ... positioned as ... * ... rotated as ... * ... facing entity ... Some commands like /return and /function has no brigadier return value。 === Profile result === {{Outdated feature|section=1}} When using {{cmd|debug stop|link=none}}, 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 === {{Outdated feature|section=1}} When using {{cmd|debug report|link=none}}, 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 '''''' **** '''overworld''' or '''the_end''' or '''the_nether''' or '''''' ***** '''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 {{cd|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 {{cd|x,y,z,uuid,type,alive,custom_name}}. ***** '''example_crash.txt''': An example crash file. ***** '''stats.txt''': Contains some stats. ** '''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 rule]]s and their values (=). ** '''stats.txt''': Contains some stats. ** '''threads.txt''': All running threads.
== History == {{HistoryTable |{{HistoryLine|java}} |{{HistoryLine||1.3.1|dev=12w27a|Added {{cmd|debug|link=none}}.}} |{{HistoryLine||1.8|dev=14w31a|{{cmd|debug|link=none}} can now be run in single-player. |Added {{cmd|debug chunk|link=none}}.}} |{{HistoryLine||1.8.1|dev=pre1|Removed {{cmd|debug chunk|link=none}}.}} |{{HistoryLine||1.13|dev=18w03a|Added commands to the profiler.}} |{{HistoryLine||1.14.4|dev=pre1|Added {{cmd|debug report|link=none}}, used to get more detailed information while debugging performance.}} |{{HistoryLine||1.17|dev=21w15a|Added {{cmd|debug function|link=none}}.}} |{{HistoryLine|||dev=Pre-release 1|Removed {{cmd|debug report|link=none}}. Replaced by F3+L and {{cmd|perf|link=none}}.}} |{{HistoryLine||1.20.3|dev=23w41a|Now the result value of {{cmd|debug function|link=none}} is the total number of commands in the functions. |Now {{cmd|debug function|link=none}} cannot be called by {{cmd|debug function|link=none}}.}} |{{HistoryLine|||dev=23w44a|Now {{cmd|debug function|link=none}} cannot be called by {{cmd|return run}}.}} }} == Navigation == {{Navbox commands}} [[de:Befehl/debug]] [[ja:コマンド/debug]] [[pt:Comandos/debug]] [[ru:Команды консоли/debug]] [[zh:命令/debug]]