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

Fix debug timers not displaying milliseconds #175

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,10 @@ void DoSpriteIndexOverlay()
paintboard();
}

float clockToMs(float clockTicks) {
return clockTicks / (CLOCKS_PER_SEC/1000);
}

void paintboard()
{
DFHack::CoreSuspender suspend;
Expand Down Expand Up @@ -939,12 +943,12 @@ void paintboard()

if(ssConfig.config.debug_mode) {
auto& contentLoader = stonesenseState.contentLoader;
draw_textf_border(font, uiColor(1), 10, 3*fontHeight, 0, "Map Read Time: %.2fms", float(stonesenseState.stoneSenseTimers.read_time));
draw_textf_border(font, uiColor(1), 10, 4*fontHeight, 0, "Map Beautification Time: %.2fms", float(stonesenseState.stoneSenseTimers.beautify_time));
draw_textf_border(font, uiColor(1), 10, 5*fontHeight, 0, "Tile Sprite Assembly Time: %.2fms", float(stonesenseState.stoneSenseTimers.assembly_time));
draw_textf_border(font, uiColor(1), 10, 6*fontHeight, 0, "DF Renderer Overlay Time: %.2fms", float(stonesenseState.stoneSenseTimers.overlay_time));
draw_textf_border(font, uiColor(1), 10, 2*fontHeight, 0, "FPS: %.2f", float(1000.0/stonesenseState.stoneSenseTimers.frame_total));
draw_textf_border(font, uiColor(1), 10, 7*fontHeight, 0, "Draw: %.2fms", float(stonesenseState.stoneSenseTimers.draw_time));
draw_textf_border(font, uiColor(1), 10, 3*fontHeight, 0, "Map Read Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.read_time));
draw_textf_border(font, uiColor(1), 10, 4*fontHeight, 0, "Map Beautification Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.beautify_time));
draw_textf_border(font, uiColor(1), 10, 5*fontHeight, 0, "Tile Sprite Assembly Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.assembly_time));
draw_textf_border(font, uiColor(1), 10, 6*fontHeight, 0, "DF Renderer Overlay Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.overlay_time));
draw_textf_border(font, uiColor(1), 10, 2*fontHeight, 0, "FPS: %.2f", 1000.0/clockToMs(stonesenseState.stoneSenseTimers.frame_total));
draw_textf_border(font, uiColor(1), 10, 7*fontHeight, 0, "Draw: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.draw_time));
draw_textf_border(font, uiColor(1), 10, 9*fontHeight, 0, "%i/%i/%i, %i:%i", contentLoader->currentDay+1, contentLoader->currentMonth+1, contentLoader->currentYear, contentLoader->currentHour, (contentLoader->currentTickRel*60)/50);

drawDebugInfo(segment);
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Template for new versions:
- `stonesense`: fixed announcement text rendering off-screen with larger font sizes
- `stonesense`: screen dimensions are now properly set when overriden by a window manager
- `stonesense`: fixed glass cabinets and bookcases being misaligned by 1 pixel
- `stonesense`: fixed debug performance timers to show milliseconds as intended

## Misc Improvements
- `stonesense`: improved the way altars look
Expand Down
Loading