diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c3358..011c5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v0.0.4-dev -- Implement automatic benchmarking +- Export benchmarking utilities to a separate pack # v0.0.3 - Implement benchmarking utilities diff --git a/README.md b/README.md index c9e9701..e4219a8 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,10 @@ Scorespace | `tkb` - [Where did the idea come from?](#where-did-the-idea-come-from) - [Configuration](#configuration) - [Target tick time](#target-tick-time) - - [Benchmarking](#benchmarking) - [Overclocking](#overclocking) - [Debug mode](#debug-mode) - [Scoreboard](#scoreboard) - [`tkb.config` objective](#tkbconfig-objective) - - [`tkb.bench` objective](#tkbbench-objective) - [`tkb.math` objective](#tkbmath-objective) - [Entity Tags](#entity-tags) - [Event Hooks](#event-hooks) @@ -91,9 +89,6 @@ scoreboard players set $target tkb.config 0 Allowed values are `0..50` and anything outside this range will wrap accordingly. -### Benchmarking -TODO - ### Overclocking Normally the target tick time is capped at `50` but there is a toggle that will allow you to go beyond. Generally this is not recommended because it will directly result in lag and high CPU usage. **Use at your own risk.** @@ -117,27 +112,15 @@ tag add tickbuster.debug Objective | Criteria | Usage | Description ------------- | --------- | --------- | ----------- `tkb.config` | `dummy` | Input | Reserved for configuration options. -`tkb.bench` | `dummy` | Read-only | Reserved for benchmark calculations. `tkb.math` | `dummy` | Read-only | Reserved for sensitive operations. `tkb.module` | `dummy` | Read-only | Reserved for SMF. ### `tkb.config` objective Fakeplayer | Default | Description ------------- | ------- | ----------- -`$autobench` | `0` | The number of ticks to automatically benchmark at. Set to `0` to disable. `$overclock` | `0` | Whether to allow [overclocking](#overclocking) the target tick time. `$target` | `20` | The [target tick time](#target-tick-time), in milliseconds. -### `tkb.bench` objective -**These values are read-only and should not be altered.** - -Fakeplayer | Description ------------------ | ----------- -`$current_iters` | The number of iterations, over the course of the current tick. -`$iters_per_tick` | The average number of iterations per tick, over the course of the benchmark. -`$total_iters` | The total number of iterations, over the course of the benchmark. -`$total_ticks` | The totla number of ticks, over the course of the benchmark. - ### `tkb.math` objective **These values are read-only and should not be altered.** diff --git a/data/tickbuster/functions/bench.mcfunction b/data/tickbuster/functions/bench.mcfunction deleted file mode 100644 index a639cb2..0000000 --- a/data/tickbuster/functions/bench.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# tickbuster:bench - -# run this function to print and reset the benchmark -# you'll need to tag the functions in `tickbuster:bench/handles` to use it - -function tickbuster:bench/proc diff --git a/data/tickbuster/functions/bench/calc.mcfunction b/data/tickbuster/functions/bench/calc.mcfunction deleted file mode 100644 index ef49413..0000000 --- a/data/tickbuster/functions/bench/calc.mcfunction +++ /dev/null @@ -1,4 +0,0 @@ -# tickbuster:bench/calc - -scoreboard players operation $iters_per_tick tkb.bench = $total_iters tkb.bench -scoreboard players operation $iters_per_tick tkb.bench /= $total_ticks tkb.bench diff --git a/data/tickbuster/functions/bench/clear.mcfunction b/data/tickbuster/functions/bench/clear.mcfunction deleted file mode 100644 index e8e0bee..0000000 --- a/data/tickbuster/functions/bench/clear.mcfunction +++ /dev/null @@ -1,4 +0,0 @@ -# tickbuster:bench/clear - -scoreboard players set $total_ticks tkb.bench 0 -scoreboard players set $total_iters tkb.bench 0 diff --git a/data/tickbuster/functions/bench/handles/after_loop.mcfunction b/data/tickbuster/functions/bench/handles/after_loop.mcfunction deleted file mode 100644 index b685a9f..0000000 --- a/data/tickbuster/functions/bench/handles/after_loop.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# tickbuster:bench/after_loop - -# tag this function with `tickbuster:hooks/after_loop` to run benchmarks - -scoreboard players add $total_ticks tkb.bench 1 -scoreboard players operation $total_iters tkb.bench += $current_iters tkb.bench - -execute if score $autobench tkb.config matches 1.. if score $total_ticks tkb.bench >= $autobench tkb.config run function tickbuster:bench/proc diff --git a/data/tickbuster/functions/bench/handles/before_loop.mcfunction b/data/tickbuster/functions/bench/handles/before_loop.mcfunction deleted file mode 100644 index 0dfd2c9..0000000 --- a/data/tickbuster/functions/bench/handles/before_loop.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# tickbuster:bench/before_loop - -# tag this function with `tickbuster:hooks/before_loop` to run benchmarks - -scoreboard players set $current_iters tkb.bench 0 diff --git a/data/tickbuster/functions/bench/handles/loop.mcfunction b/data/tickbuster/functions/bench/handles/loop.mcfunction deleted file mode 100644 index 467e31e..0000000 --- a/data/tickbuster/functions/bench/handles/loop.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# tickbuster:bench/loop - -# tag this function with `tickbuster:hooks/loop` to run benchmarks - -scoreboard players add $current_iters tkb.bench 1 diff --git a/data/tickbuster/functions/bench/proc.mcfunction b/data/tickbuster/functions/bench/proc.mcfunction deleted file mode 100644 index d083b7b..0000000 --- a/data/tickbuster/functions/bench/proc.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# tickbuster:bench/proc - -function tickbuster:bench/calc - -execute as @a[tag=tickbuster.debug] run function tickbuster:bench/tell - -# just in case a non-debug player is here -execute as @s[tag=!tickbuster.debug] run function tickbuster:bench/tell - -function tickbuster:bench/clear diff --git a/data/tickbuster/functions/bench/tell.mcfunction b/data/tickbuster/functions/bench/tell.mcfunction deleted file mode 100644 index bc11694..0000000 --- a/data/tickbuster/functions/bench/tell.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -# tickbuster:bench/tell - -tellraw @s [{"text": "[tickbuster:bench] Averaged ", "color": "gray"}, {"score": {"name": "$iters_per_tick", "objective": "tkb.bench"}, "color": "aqua"}, {"text": " iterations per tick over ", "color": "gray"}, {"score": {"name": "$total_ticks", "objective": "tkb.bench"}}, {"text": " ticks."}] diff --git a/data/tickbuster/functions/module/api/load.mcfunction b/data/tickbuster/functions/module/api/load.mcfunction index 7f2a78c..e6858f4 100644 --- a/data/tickbuster/functions/module/api/load.mcfunction +++ b/data/tickbuster/functions/module/api/load.mcfunction @@ -1,3 +1 @@ # tickbuster:module/api/load - -function tickbuster:bench/clear diff --git a/data/tickbuster/functions/module/api/setup.mcfunction b/data/tickbuster/functions/module/api/setup.mcfunction index 5395cfc..d2e8529 100644 --- a/data/tickbuster/functions/module/api/setup.mcfunction +++ b/data/tickbuster/functions/module/api/setup.mcfunction @@ -1,11 +1,9 @@ # tickbuster:module/api/setup scoreboard objectives add tkb.config dummy -scoreboard objectives add tkb.bench dummy scoreboard objectives add tkb.math dummy # defaults -scoreboard players set $autobench tkb.config 0 scoreboard players set $overclock tkb.config 0 scoreboard players set $target tkb.config 20 diff --git a/data/tickbuster/functions/module/api/teardown.mcfunction b/data/tickbuster/functions/module/api/teardown.mcfunction index 1dec54b..59b70b8 100644 --- a/data/tickbuster/functions/module/api/teardown.mcfunction +++ b/data/tickbuster/functions/module/api/teardown.mcfunction @@ -1,5 +1,4 @@ # tickbuster:module/api/teardown scoreboard objectives remove tkb.config -scoreboard objectives remove tkb.bench scoreboard objectives remove tkb.math