Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Addon: Timing Blocks and Line-By-Line Profiling for Debugger #7443

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Joeclinton1
Copy link
Contributor

@Joeclinton1 Joeclinton1 commented May 17, 2024

Resolves #7418

Changes

This is the biggest addon I've made to date. It adds:

  • two new blocks: "start timer" and "stop timer"
    • the block-switching addon is modified to account for these blocks
  • a new tab for debugger called "Timing"
  • Timing tab use a logView to show a table of the stored timing data from the started timers
    • The info shown is: Total Time, Average Time, Percent Time, Call count
    • Via a setting you can replace Percent Time with Ratio time, which is the total time divided by the minimum total time
    • Every logged timer has a label either with the timer name or the block name, which is clickable and takes you to the start timing/ block line.
  • A "tools" button is added which when clicked shows a dropdown toolbar. The toolbar has 3 buttons:
    • View Line-by-line: This triggers a custom profiler to enable itself, and begin tracking line by line times. Each line adds it's own timer
    • Show RTC: this begins tracking the Relative Time Cost (RTC) for each line. Where RTC is a precomputed time cost which is derived from the total set of block used in the line. When RTC is shown a column is added displaying elapsed RTC for each column
    • Show Heatmap: this recolours the block line associated with each timer, with a heatmap colour scale to visually represent the percentage time of that line.
    • If heatmap is shown, then a slider appears that lets you adjust the maximum heatmap range.
  • clicking the table headers sorts the column
  • there is a setting which lets you automatically stop the previous timer when a start timer is called, which helps if you want to have many consecutive timers. (also cuts down on overhead)
  • an export button, will export the timing table in csv format

image

image

Reason for changes

See #7418

Tests

The functionality described in Changes has been tested and works.

Remaining stuff:

  • Making RTC account for blocks that are selected via dropdown
  • Making RTC account for o(n) time blocks
  • Make RTC account for blocks that depend on the size of the sprite
  • Make RTC account for stamp blocks dependency on bitmap/vector
  • Localise all the strings

@Samq64 Samq64 added type: enhancement New feature for the project scope: addon Related to one or multiple addons labels May 17, 2024
@DNin01
Copy link
Member

DNin01 commented May 18, 2024

We could maybe move the timing data into the Performance tab, if necessary. There might not be enough space to fit four tabs in some languages…?

@Joeclinton1
Copy link
Contributor Author

Joeclinton1 commented May 18, 2024

We could maybe move the timing data into the Performance tab, if necessary. There might not be enough space to fit four tabs in some languages…?

It would just be cluttered. the performance tab has these graphs. you'd need to put them above or below the timers which makes them less easy to use. To remedy that you need a second level set of tabs and things get annoying quickly. I made the window wider by the width of the word timers. Technically yes it's not going to fit. perhaps we can resize the whole window if it doesn't fit dynamically with js. Maybe a burger menu, could automatically enable when it runs out space, and the 4 tabs become a dropdown or side menu?

We could also ask translators to pick between the translation of profiler, profiling, timer and timing, for whichever is shortest.
For example in spanish it's "temporizadores" but profiling is "perfilado"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: addon Related to one or multiple addons type: enhancement New feature for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New addon: Timing and RTC profiler
3 participants