Skip to content
Open
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
14 changes: 14 additions & 0 deletions src/jdiskmark/BenchmarkOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class BenchmarkOperation implements Serializable {
static final DecimalFormat DFT = new DecimalFormat("###");
static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");



public enum IOMode {
READ {
@Override
Expand Down Expand Up @@ -76,6 +78,9 @@ public enum BlockSequence {
@Column
BlockSequence blockOrder;
@Column
@Convert(converter = RenderFrequencyModeAttributeConverter.class)
private RenderFrequencyMode renderMode;
@Column
int numBlocks = 0;
@Column
int blockSize = 0;
Expand Down Expand Up @@ -229,6 +234,15 @@ public void setIops(long iops) {
this.iops = iops;
}

public RenderFrequencyMode getRenderMode() {
return renderMode;
}

public void setRenderMode(RenderFrequencyMode renderMode) {
this.renderMode = renderMode;
}


// utility methods for collection

static List<BenchmarkOperation> findAll() {
Expand Down
6 changes: 5 additions & 1 deletion src/jdiskmark/BenchmarkPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class BenchmarkPanel extends javax.swing.JPanel {
public BenchmarkPanel() {
initComponents();
Gui.runPanel = BenchmarkPanel.this;

// 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.


// Tooltip only – keep it simple
runTable.setToolTipText("Mode: Write* means Write Sync was enabled");
Expand Down Expand Up @@ -123,7 +127,6 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {


public void addRun(Benchmark run) {

List<BenchmarkOperation> operations = run.getOperations();
DefaultTableModel model = (DefaultTableModel) this.runTable.getModel();
for (BenchmarkOperation o : operations) {
Expand All @@ -142,6 +145,7 @@ public void addRun(Benchmark run) {
o.getAccTimeDisplay(),
o.getBwMinMaxDisplay(),
o.getBwAvgDisplay(),
(o.getRenderMode() != null ? o.getRenderMode().toString() : "-")
});
}
}
Expand Down
309 changes: 191 additions & 118 deletions src/jdiskmark/BenchmarkWorker.java

Large diffs are not rendered by default.

75 changes: 67 additions & 8 deletions src/jdiskmark/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.jfree.chart.ChartMouseEvent;
import org.jfree.chart.ChartMouseListener;
import javax.swing.UIManager;
Expand All @@ -26,6 +28,8 @@
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleInsets;
import jdiskmark.App;


/**
* Store GUI references for easy access
Expand All @@ -35,7 +39,18 @@ public final class Gui {
public static enum Palette { CLASSIC, BLUE_GREEN, BARD_COOL, BARD_WARM };
public static Palette palette = Palette.CLASSIC;

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.

}

public static void setRenderFrequencyMode(RenderFrequencyMode mode) {
renderFrequencyMode = mode;
}

public static ChartPanel chartPanel = null;
public static JLabel renderModeLabel = new JLabel("Render Mode: PER_SAMPLE");
public static MainFrame mainFrame = null;
public static SelectDriveFrame selFrame = null;
public static XYSeries wSeries, wAvgSeries, wMaxSeries, wMinSeries, wDrvAccess;
Expand Down Expand Up @@ -87,7 +102,29 @@ public static void configureLaf() {
}
}

public static ChartPanel createChartPanel() {
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?

boolean showTable = (mode == RenderFrequencyMode.PER_100MS ||
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.


}

public static void refreshRenderLabel() {
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.


public static JPanel createChartPanel() {

wSeries = new XYSeries("Write");
wAvgSeries = new XYSeries("Write Avg");
Expand Down Expand Up @@ -175,12 +212,9 @@ public static ChartPanel createChartPanel() {

chart = new JFreeChart("", null , plot, true);

// correct the parenthesis from being below vertical centering
chart.getTitle().setFont(new Font("Verdana", Font.BOLD, 17));

chartPanel = new ChartPanel(chart) {
// Only way to set the size of chart panel
// ref: http://www.jfree.org/phpBB2/viewtopic.php?p=75516
@Override
public Dimension getPreferredSize() {
return new Dimension(500, 325);
Expand Down Expand Up @@ -209,10 +243,35 @@ public void chartMouseMoved(ChartMouseEvent cme) {
// no action
}
});
updateLegendAndAxis();
return chartPanel;
}

updateLegendAndAxis();

// Creates a wrapper panel with vertical layout
JPanel wrapperPanel = new JPanel(new java.awt.BorderLayout());

// Creates a small left-aligned panel for the label
JPanel topPanel = new JPanel(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 2));
topPanel.setOpaque(false);

// Render Mode label
renderModeLabel = new JLabel("Render Mode: " + Gui.getRenderFrequencyMode());
renderModeLabel.setFont(new Font("Verdana", Font.BOLD, 10));
renderModeLabel.setForeground(Color.BLACK);

// Add subtle light-gray background with slight transparency
renderModeLabel.setOpaque(true);
renderModeLabel.setBackground(new Color(240, 240, 240, 200)); // light gray w/ transparency
renderModeLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 6, 2, 6)); // padding

// Add label to top panel
topPanel.add(renderModeLabel);

// Add top panel and chart panel to wrapper
wrapperPanel.add(topPanel, java.awt.BorderLayout.NORTH);
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


public static void addWriteSample(Sample s) {
wSeries.add(s.sampleNum, s.bwMbSec);
wAvgSeries.add(s.sampleNum, s.cumAvg);
Expand Down
Loading