Skip to content

Conversation

@vpstackhub
Copy link
Contributor

This PR completes Issue #78 by adding Render Mode options to the UI:

  • Users can now choose from:
    • Charts (JFreeChart only)
    • Table (results table only)
    • Charts + Table (both shown)

Changes made:

  • New RenderMode enum in App.java
  • renderCombo dropdown added to MainFrame.java
  • Logic added to show/hide the chart panel depending on selected mode
  • UI wiring completed via Gui.java
  • Chart visibility tested with toggling logic

Let me know if you'd like any refinements!

@vpstackhub
Copy link
Contributor Author

@jamesmarkchan ready for review – this completes #78

@jamesmarkchan
Copy link
Member

@vpstackhub I was thinking this is a less likely to be configured item that the items in the main settings area so should be under the options file menu if possible and default to "Per Sample" where the graph would update per sample. If the user selected the option "Per Operation" the chart would update after a read or write operation is complete. and if a per interval is selected we would need to do some time stamping and computation if the update window has passed before the next update occurs. Should be free to tag up tomorrow or thursday or this weekend if you are free.

image

@jamesmarkchan
Copy link
Member

jamesmarkchan commented Sep 17, 2025

i was just checking, the only two things i think we would drag over from the palette is the "Menu" and the "Menu Item". Bringing over a Menu into a Menus creates a submenu within the menu, then we'd populate it with several sub items.

  • Per Sample - once a sample is plotted the graph is updated.
  • Per Operation - once an operation is complete the graph is updated.
  • Per 100ms - once 100ms since the last update another update can occur.
  • Per 500ms - once 500ms since the last update another update can occur.
  • Per 1000ms - once 1s since the last update another update can occur.
image

@jamesmarkchan
Copy link
Member

The BenchmarkWorker.java is likely where most of the action will happen.

the publish samples i believe is where the graph gets updated so if we're not on per sample, instead of just publishing the sample we'll want to put the sample into an array or some container so it can all be added later when the rendering interval is up.

TABLE,
CHARTS_AND_TABLE;

@Override
Copy link
Member

Choose a reason for hiding this comment

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

so here the modes would be like:

  1. PER_SAMPLE
  2. PER_OPERATION
  3. PER_100MS
  4. PER_500MS
  5. PER_1000MS

return switch (this) {
case CHARTS -> "Charts";
case TABLE -> "Table";
case CHARTS_AND_TABLE -> "Charts + Table";
Copy link
Member

Choose a reason for hiding this comment

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

for your awareness lines 47-52 would be indented all by x4 spaces more.

case CHARTS_AND_TABLE -> "Charts + Table";
};
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe good to put RenderMode enum into the Gui.java class or it's own class entirely.

@jamesmarkchan
Copy link
Member

jamesmarkchan commented Sep 17, 2025

it's likely we'll want to pull this from here and save the slot for a Profiles dropdown that we'll add later as part of #42.

image

@vpstackhub
Copy link
Contributor Author

vpstackhub commented Sep 18, 2025 via email

@jamesmarkchan
Copy link
Member

jamesmarkchan commented Sep 19, 2025

another option is we start a new dialog window called Advanced Options that is brought up from the Options Menu where the user can select a dropdown with the options we are talking about. Later we can migrate the other advanced options that are not that commonly set to this menu to keep the front primary controls for the common user clutter free and the enthusiast would bring up the advanced options to tune their benchmarks to their liking.

See #90 for a brief description of the advanced options dialogue window approach, which we can start to migrate advanced options into.

private static jdiskmark.RenderFrequencyMode renderFrequencyMode = jdiskmark.RenderFrequencyMode.PER_SAMPLE;

public static RenderFrequencyMode getRenderFrequencyMode() {
return renderFrequencyMode;
Copy link
Member

Choose a reason for hiding this comment

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

this and line 49 could be indented by 4 spaces.

@jamesmarkchan
Copy link
Member

hey @vpstackhub, i checked out and tested and noticed a few things:

  1. when selecting the render mode from the menu, the current version should be selected. There should be a way to make the Render Interval options so each option is exclusively selected (only one) and the selection is indicated. For example good to take a look at the Color Palette sub menu where only one of the palettes can be selected at a time.
    image
  2. the other thing is I'm not sure this is expected behavior? to see if this is a regression (breaking an existing feature) should be able to check out the original dev and see if that behavior is there. if it is than it's probably something i had introduced on dev and we should create a bug for it.
    image
  3. Perhaps it would be good to remove this control unless we wanted to repurpose the controls to handle the Profiles feature on the same branch?
    image
  4. when we test the Render mode in per operation and the Benchmark Type is Write it should not plot the graph until the entire operation is complete. Per sample behavior should be like our normal per sample update, Per 1000ms, we should see updates only every second. per 500ms updates only after half a second.
  5. Less important but if the render mode is displayed for the benchmark, when it is selected in the Benchmark Operations tab the render mode should probably update in the graph area so we can see the render mode that was used for that benchmark. It seems to just show the render mode of what the current setting is.
    image

Unfortunately I'm not sure what is causing some of these artifacts and how to correct at the moment but wanted to share some initial feedback.

@vpstackhub
Copy link
Contributor Author

This PR completes Issue #78 by finalizing the Render Mode functionality and cleaning up the rendering logic.

Features Implemented

Render Mode Options now available in the UI:

Charts – show JFreeChart only

Table – show results table only

Charts + Table – show both

Render Mode submenu added under Options with radio buttons.

New RenderFrequencyMode enum (PER_SAMPLE, PER_OPERATION, PER_100MS, PER_500MS, PER_1000MS).

Dropdown wiring completed in MainFrame and Gui, with dynamic chart visibility toggle.

Code Changes

Consolidated duplicate logic in BenchmarkWorker:

Removed redundant switch(currentMode) blocks.

Centralized per-sample, per-operation, and interval-based buffering logic.

Added getIntervalMillis() helper for clean timing control.

Integrated with existing metrics (App.updateMetrics, publish, etc.).

Preserved thread safety and UI responsiveness with buffered sample publishing.

Testing Performed

Per Sample: results update continuously (no mid-test warnings).

Per Operation: results batch flush correctly at operation boundaries.

Per 500ms / 1000ms: results render at expected intervals, with charts/table progressively updating.

Verified toggling between Charts / Table / Charts+Table updates the UI correctly.

Clean + Build and Run behave consistently, no regressions observed.

Next Steps

Follow-up PR could focus on:

Persisting Render Mode preference in jdm.properties.

Additional GUI refinements if requested.

@jamesmarkchan
Copy link
Member

Hey @vpstackhub i pulled and tested your branch really quickly but have not had a chance to look at the code, really quickly it seems there is a Render Mode in the Options menu that has different options from the Render mode on the main control panel. I feel this could confuse users and we can probably remove the Render mode in the control panel area and leave the one in the Options menu? Or were you thinking there is another render mode control we should introduce. Generally for less used controls like the Render mode it is good to hide them away in an options since it might not be of interest to most users and we can save the main control area for the primary controls. Our tool has more controls than the other competing tools. also noticed that some of the stats were not getting filled out as each record was completed.

image

should be free this evening if you have time for a call.

@vpstackhub
Copy link
Contributor Author

Thanks @jamesmarkchan for the detailed review and testing. Based on your notes, here’s my plan:

  1. Remove duplicate Render Mode control from the main panel → keep only under Options menu.

  2. Update Render Interval submenu to behave like Color Palette (only one active selection at a time).

  3. Investigate why stats in Benchmark Operations are stuck at 0/0 → confirm if regression exists in dev.

  4. Adjust logic so:

Per Sample = update each sample
Per Operation = update only after operation completes
Per Interval = update after selected ms window passes

  1. Ensure the Benchmark Operations tab shows the render mode used for that benchmark, not just the global setting.

  2. Look into chart artifacts (flat zones / unexpected values).

  3. Default render mode = Per Sample.

@jamesmarkchan
Copy link
Member

there are two identical pull request and I think this is the better one to keep open for this branch. it is okay to rebranch from dev and start over to reset the gui builder portions if needed.

Copy link
Member

@jamesmarkchan jamesmarkchan left a comment

Choose a reason for hiding this comment

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

i think there are functional aspects to address first or possible you did not push the latest code changes to the branch. i know the generated code can be challenging to maintain, usually what i do is to revert the generated code if it gets a little too jumbled. we'll have to look at breaking up the generated code more so it is easier to maintain in the future.


// Dynamically add Render Mode column
DefaultTableModel model = (DefaultTableModel) runTable.getModel();
model.addColumn("Render Mode");
Copy link
Member

Choose a reason for hiding this comment

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

oh sorry i should have been more specific, even though we should save the render mode to the database i don't think we need to add a column. but we should save the value and load it and send it back to the community portal. we do need a solution to show the render mode when a selected benchmark is loaded.

public static void updateRenderView() {
RenderFrequencyMode mode = Gui.mainFrame.getRenderMode();

boolean showChart = true; // all modes show chart in this example
Copy link
Member

Choose a reason for hiding this comment

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

i'm not sure we need showChart and showTable or possible to share what you had in mind for them?

mode == RenderFrequencyMode.PER_500MS ||
mode == RenderFrequencyMode.PER_1000MS);

if (chartPanel != null) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe we need to hide the chart, can likely remove lines 113-114 unless I'm overlooking something.

chartPanel.setVisible(showChart);
}

Gui.mainFrame.setTableVisible(showTable);
Copy link
Member

Choose a reason for hiding this comment

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

this is probably not needed also right? or let me know if otherwise.

if (renderModeLabel != null) {
renderModeLabel.setText("Render Mode: " + getRenderFrequencyMode());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

so if a render mode is displayed on the chart i believe it should show the render mode of the active selected benchmark or the selected loaded benchmark and not the mode selected for the next benchmark because the user can see the mode selected for the next benchmark from the menu. good to keep in mind that we have controls that tell us the info of a selected or current benchmark and controls that tell us what will be used for the next benchmark that is run. I might have confused the behavior with how the main benchmark controls are being used for both. In theory it is nice to keep them separate.

wrapperPanel.add(chartPanel, java.awt.BorderLayout.CENTER);

return wrapperPanel;
}
Copy link
Member

Choose a reason for hiding this comment

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

going to ignore formatting comments for now since we'll want to get the functionality working first but normally we would not want to see the return and the closing bracket on the same column like here. the closing bracket would be lined up with the first line of the open bracket usually. does this make sense?

image

return label;
}
}

Copy link
Member

Choose a reason for hiding this comment

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

this class looks good!

Copy link
Member

Choose a reason for hiding this comment

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

we might not need an attribute converter class as the RenderFrequencyMode is an enumeration and we have been able to store enumerations into our derby database wo attribute converters in the past for instance there is the BenchmarkType enumeration and the IOMode enumeration. Perhaps we can model those for storing the Render frequency into the db.

image

orderComboBox.addItem(BenchmarkOperation.BlockSequence.SEQUENTIAL);
orderComboBox.addItem(BenchmarkOperation.BlockSequence.RANDOM);
}

Copy link
Member

Choose a reason for hiding this comment

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

@vpstackhub are you using vs code or netbeans for code editing? want to warn you that the entire constructor appears to have had it's indentation bumped by four making the entire function appear as a new change and the old remove. usually we want to avoid this so a git diff can in the review tell us specifically which lines changed instead of saying the entire function changed and the user has to look for the changes specifically. it might be good to use vs code to review the changes in the source control panel before making the commit so we an avoid accidental white space adjustments.

image

public void initializeComboSettings() {
typeCombo.setSelectedItem(App.benchmarkType);
loadSettings();
loadSettings();
Copy link
Member

Choose a reason for hiding this comment

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

minor but looks like we are adding extra spaces after the line.

@jamesmarkchan jamesmarkchan changed the title #78 - Implement Render Mode Options (Charts, Table, Charts + Table) #78 - Implement Render Mode Options Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants