Skip to content

Make dietpi-benchmark a standalone shell command with TUI menu#7982

Merged
MichaIng merged 7 commits intodevfrom
copilot/merge-tui-menu-into-benchmark
Feb 25, 2026
Merged

Make dietpi-benchmark a standalone shell command with TUI menu#7982
MichaIng merged 7 commits intodevfrom
copilot/merge-tui-menu-into-benchmark

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

dietpi-benchmark had CLI-only usage while its whiptail menu lived in dietpi-config as Menu_FilesystemBenchmark (TARGETMENUID=12). The script has been restructured and promoted to a first-class standalone command, following the same pattern as dietpi-display and dietpi-ddns.

dietpi/dietpi-benchmark (moved from dietpi/func/dietpi-benchmark)

  • Script moved to /boot/dietpi/dietpi-benchmark so it sits alongside other top-level DietPi tools; the old path is cleaned up via an update patch
  • A readonly USAGE variable documents available commands (matching dietpi-ddns style); invalid CLI input prints this usage text
  • Invoking with no arguments launches an interactive Main_Menu() loop with three entries: Full Benchmark, Custom Filesystem, and Network LAN
  • Each benchmark type has a dedicated interactive menu function (Menu_Full_Benchmark, Menu_Custom_Filesystem, Menu_Network_Lan) that handles all G_WHIP_* input/confirmation/result dialogs for that type
  • The underlying benchmark functions (CPU_Benchmark, Filesystem_Benchmark, Benchmark_Survey, Benchmark_Lan_Client) are pure non-interactive functions
  • A new Run_Benchmark(type) function wraps execution: sets highest CPU/I/O priority, stops services, calls the benchmark, restarts services, saves results, and uploads to the survey
  • Load_Results is called once at the very start of the script regardless of CLI argument
  • Menu_* functions are called from both Main_Menu (interactive mode) and the CLI main loop (inputs 14)
  • CLI modes 14 remain backward-compatible; the former init-only mode 0 has been removed as it is no longer needed

rootfs/etc/bashrc.d/dietpi.bash

  • Shell alias dietpi-benchmark added, so the tool can be invoked directly from the console without a full path

dietpi/dietpi-config

  • Menu_FilesystemBenchmark() and its TARGETMENUID=12 case removed
  • Menu_Tools now calls /boot/dietpi/dietpi-benchmark directly (no args)

.update/patches

  • Patch_10_2() removes the old /boot/dietpi/func/dietpi-benchmark script location on update

CHANGELOG.txt

  • v10.2 Enhancements entry added describing the new standalone accessibility

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Copilot AI changed the title [WIP] Merge whiptail-based TUI menu into benchmark script Merge benchmark TUI menu into dietpi-benchmark Feb 24, 2026
Copilot AI requested a review from MichaIng February 24, 2026 16:36
@MichaIng
Copy link
Owner

@copilot
Please streamline the script as follows:

  • Rename the 'DietPi-Benchmark' menu entry into Full Benchmark and remove the two '' '●─ ...' entries. So we have 3 types of benchmarks available via CLI as well as via menu.
  • Every benchmark type has one or more interactive G_WHIP_* menus to get input or ask for confirmation. /boot/dietpi/dietpi-drive_manager 1 as well shows a menu to select a mountpoint. And each benchmark type function has a results dialog as well. Move those interactive dialogs/menus into a dedicated functions for each benchmark type: Menu_Full_Benchmark etc, out of Main_Menu as well as out of Filesystem_Benchmark and respectively.
  • Those new functions should be called from the main loop if input is given, as well as from the Main_Menu, if respective entry was selected.
  • Create a new Run_Benchmark function, which takes as argument the benchmark type index, does the services and results handling, and calls the final Filesystem_Benchmark and respectively. Reorder the calls in this new function like this:
    # Run at highest CPU and I/O priority
    renice -n -19 $$
    ionice -p $$ -c 1 -n 0
    # Stop services while benchmark is running
    /boot/dietpi/dietpi-services stop
    Filesystem_Benchmark
    /boot/dietpi/dietpi-services start
    # Export results data for other scripts
    Save_Results
    # Upload if in survey, else, prompt
    Upload_Survey
    Load_Results only needs to be called once at the very start of the script, and regardless of CLI argument. That reduces code duplication, we have non-interactive benchmark run functions, and interactive input/result dialogs. Services are stopped only right before the actual benchmark starts, and restarted right after it finished, to minimize downtime.

…r main loop

Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot
Please streamline the script as follows:

  • Rename the 'DietPi-Benchmark' menu entry into Full Benchmark and remove the two '' '●─ ...' entries. So we have 3 typ...

Done in a24a343. Here's what was changed:

  • 'DietPi-Benchmark' renamed to 'Full Benchmark'; the two ●─ separator entries removed — Main_Menu now has 3 clean entries (Full Benchmark, Custom Filesystem, Network LAN)
  • All interactive G_WHIP_* dialogs extracted into Menu_Full_Benchmark(), Menu_Custom_Filesystem(), and Menu_Network_Lan() — the underlying CPU_Benchmark, Filesystem_Benchmark, Benchmark_Survey, and Benchmark_Lan_Client are now pure non-interactive functions
  • Run_Benchmark(type) created with exactly the structure you described (renice/ionice → services stop → benchmark → services start → Save_Results → Upload_Survey); called from all Menu_* functions
  • Load_Results called once at the very top of the main loop, regardless of CLI argument
  • Menu_* functions called from both Main_Menu (menu mode) and the CLI main loop (INPUT 1–4)
  • SHOW_RESULTS variable removed (no longer needed)

Copy link
Owner

@MichaIng MichaIng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please address my code review comments.

…chmark default case, remove G_INTERACTIVE check and input 0

Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot please address my code review comments.

All addressed in ed69e5e.

Copilot AI requested a review from MichaIng February 24, 2026 20:52
@MichaIng MichaIng marked this pull request as ready for review February 24, 2026 21:06
Copy link
Owner

@MichaIng MichaIng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot
See my new comments. And then, now that the script has a proper TUI, move it one directory up to dietpi/dietpi-benchmark. Assure that all calls in our code use /boot/dietpi/dietpi-benchmark accordingly.

Then add a shell alias to https://github.com/MichaIng/DietPi/blob/dev/rootfs/etc/bashrc.d/dietpi.bash

Finally create a changelog entry that the dietpi-benchmark script has been made better accessible as standalone shell command. It does not need to contain all the other changes this PR did, as this is mostly internal restructure, not exposing new features or visible enhancements for users. For them, the only major difference is that they do not need to browse through dietpi-config anymore, but can call the benchmark menu or a particular submenu directly from the console without full script path.

… fix temp display, add changelog

Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot
See my new comments. And then, now that the script has a proper TUI, move it one directory up to dietpi/dietpi-benchmark. Assure that all calls in our code use `/boot/dietpi/dietpi-benchm...

Done in 53b54e3:

  • Script moved to dietpi/dietpi-benchmark; dietpi/func/dietpi-benchmark is now a redirect stub (exec /boot/dietpi/dietpi-benchmark "$@") for backward compatibility
  • All internal references updated (dietpi-config, dietpi-drive_manager)
  • alias dietpi-benchmark='/boot/dietpi/dietpi-benchmark' added to rootfs/etc/bashrc.d/dietpi.bash (after dietpi-display)
  • Changelog entry added to v10.2 Enhancements

Copilot AI changed the title Merge benchmark TUI menu into dietpi-benchmark Make dietpi-benchmark a standalone shell command with TUI menu Feb 24, 2026
Copilot AI requested a review from MichaIng February 24, 2026 21:43
Copy link
Owner

@MichaIng MichaIng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot
See my new comment. Also, please remove the old dietpi/func/dietpi-benchmark entirely. No need to keep the wrapper to preserve the old path.

What I forgot: In https://github.com/MichaIng/DietPi/blob/dev/.update/patches, add a removal of the old script location to Patch_10_2():

G_DIETPI-NOTIFY 2 'Removing old dietpi-benchmark script: It lives now at /boot/dietpi/dietpi-benchmark and is accessible via "dietpi-benchmark" console command.'
G_EXEC rm -f /boot/dietpi/func/dietpi-benchmark

…og entry

Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot
See my new comment. Also, please remove the old dietpi/func/dietpi-benchmark entirely. No need to keep the wrapper to preserve the old path.
...

Done in 5932a4c:

  • dietpi/func/dietpi-benchmark removed entirely (no redirect stub)
  • Patch_10_2() in .update/patches now removes /boot/dietpi/func/dietpi-benchmark on update with an informational message

@MichaIng MichaIng force-pushed the copilot/merge-tui-menu-into-benchmark branch from 33d2f53 to 07c8a21 Compare February 25, 2026 00:43
@MichaIng MichaIng merged commit a707bf0 into dev Feb 25, 2026
2 checks passed
@MichaIng MichaIng deleted the copilot/merge-tui-menu-into-benchmark branch February 25, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants