Commit c75e57c0 authored by James's avatar James

v0.4e

 - updated eclipselink to 2.6 allows auto schema update
 - improved gui initialization
 - add path and drive type (usb, local) - works windows only
parent 3dc2c4de
......@@ -20,11 +20,9 @@ https://sourceforge.net/projects/jdiskmark/
== Release Notes ==
v0.1
- initial release
v0.2
- auto generate zip release ie. jdiskmark-v0.2.zip
- added tabbed pane near bottom to organize new controls
- format excessive decimal places
......@@ -32,15 +30,24 @@ v0.2
- default to nimbus look and feel
v0.3
- persist recent run with embedded derby db
- remove "transfer mark number" from graph
- changed graph background to dark gray
- resizing main frame stretches tabbed pane instead of empty panel
v0.4e
- updated eclipselink to 2.6 allows auto schema update
- improved gui initialization
- add path and drive type (usb, local) - works windows only
desired features
- hard drive specs, ie. manufacturer, size, speed
- hard drive specs, ie. manufacturer, model, capacity
on linux: "hdparm -I /dev/sda"
https://www.cyberciti.biz/faq/linux-getting-scsi-ide-harddisk-information/
http://unix.stackexchange.com/questions/5085/how-to-see-disk-details-like-manufacturer-in-linux
on windows: "wmic diskdrive get name,size,model"
https://whatsonmypc.wordpress.com/2011/09/01/wmic/
https://sourceforge.net/projects/jacob-project/
- auto clear disk cache linux
- auto clear disk cache windows
......@@ -73,7 +73,7 @@
-->
<!-- software revision number -->
<property name="version" value="0.3"/>
<property name="version" value="0.4e"/>
<property name="releaseDir" value="jdiskmark-v${version}"/>
<target name="-post-jar">
......
......@@ -30,15 +30,20 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.derby.jar=libs\\derby.jar
file.reference.eclipselink.jar=libs\\eclipselink.jar
file.reference.javax.persistence_2.1.1.v201509150925.jar=libs\\javax.persistence_2.1.1.v201509150925.jar
file.reference.jcommon-1.0.21.jar=libs/jcommon-1.0.21.jar
file.reference.jfreechart-1.0.17.jar=libs/jfreechart-1.0.17.jar
file.reference.org.eclipse.persistence.jpa.modelgen_2.6.4.v20160829-44060b6.jar=libs\\org.eclipse.persistence.jpa.modelgen_2.6.4.v20160829-44060b6.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.jcommon-1.0.21.jar}:\
${file.reference.jfreechart-1.0.17.jar}:\
${libs.eclipselink.classpath}:\
${file.reference.derby.jar}
${file.reference.derby.jar}:\
${file.reference.eclipselink.jar}:\
${file.reference.javax.persistence_2.1.1.v201509150925.jar}:\
${file.reference.org.eclipse.persistence.jpa.modelgen_2.6.4.v20160829-44060b6.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
......
......@@ -4,10 +4,11 @@
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<!--<property name="eclipselink.logging.level" value="FINE"/>-->
<property name="eclipselink.logging.level" value="FINE"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:derbyDB;create=true"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
</properties>
</persistence-unit>
</persistence>
......@@ -106,6 +106,9 @@ public class App {
return version;
}
/**
* Initialize the GUI Application.
*/
public static void init() {
Gui.mainFrame = new MainFrame();
Gui.selFrame = new SelectFrame();
......@@ -114,18 +117,19 @@ public class App {
System.out.println(App.getConfigString());
Gui.mainFrame.refreshConfig();
Gui.mainFrame.setLocationRelativeTo(null);
Gui.mainFrame.setVisible(true);
Gui.progressBar = Gui.mainFrame.getProgressBar();
// configure the embedded DB in .jDiskMark
System.setProperty("derby.system.home", APP_CACHE_DIR);
loadSavedRuns();
Gui.mainFrame.setVisible(true);
// save configuration on exit...
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() { App.saveConfig(); }
});
// configure the embedded DB in .jDiskMark
System.setProperty("derby.system.home", APP_CACHE_DIR);
loadSavedRuns();
}
public static void loadConfig() {
......
package jdiskmark;
import java.io.File;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
......@@ -28,10 +31,11 @@ import javax.persistence.TemporalType;
})
public class DiskRun implements Serializable {
static DecimalFormat df = new DecimalFormat("###.###");
static final DecimalFormat DF = new DecimalFormat("###.##");
static final DateFormat DATE_FORMAT = new SimpleDateFormat("EEE, MMM d HH:mm:ss");
public enum Type { READ, WRITE, READ_WRITE; }
public enum BlockSequence {SEQUENTIAL, RANDOM; }
static public enum IOMode { READ, WRITE, READ_WRITE; }
static public enum BlockSequence {SEQUENTIAL, RANDOM; }
@Column
@Id
......@@ -40,7 +44,12 @@ public class DiskRun implements Serializable {
// configuration
@Column
Type runType;
String dataPath = null;
@Column
String driveType = null;
// TODO: add drive manufacturer / model number info
@Column
IOMode ioMode;
@Column
BlockSequence blockOrder;
@Column
......@@ -52,55 +61,63 @@ public class DiskRun implements Serializable {
@Column
long txSize = 0;
@Temporal(TemporalType.TIMESTAMP)
@Column
Date startTime;
@Temporal(TemporalType.TIMESTAMP)
@Column
Date endTime = null;
@Column
int totalMarks = 0;
@Column
double cumMin = 0;
double runMin = 0;
@Column
double cumMax = 0;
double runMax = 0;
@Column
double cumAvg = 0;
double runAvg = 0;
@Override
public String toString() {
return "Run("+runType+","+blockOrder+"): "+totalMarks+" cum avg: "+cumAvg;
return "Run("+ioMode+","+blockOrder+"): "+totalMarks+" run avg: "+runAvg;
}
public DiskRun() {
this.startTime = new Date();
}
DiskRun(Type type, BlockSequence order) {
DiskRun(IOMode type, BlockSequence order) {
this.startTime = new Date();
runType = type;
ioMode = type;
blockOrder = order;
}
// display friendly methods
public String getStartTimeString() {
return DATE_FORMAT.format(startTime);
}
public String getMin() {
return cumMin == -1 ? "- -" : df.format(cumMin);
return runMin == -1 ? "- -" : DF.format(runMin);
}
public void setMin(double min) {
cumMin = min;
runMin = min;
}
public String getMax() {
return cumMax == -1 ? "- -" : df.format(cumMax);
return runMax == -1 ? "- -" : DF.format(runMax);
}
public void setMax(double max) {
cumMax = max;
runMax = max;
}
public String getAvg() {
return cumAvg == -1 ? "- -" : df.format(cumAvg);
return runAvg == -1 ? "- -" : DF.format(runAvg);
}
public void SetAvg(double avg) {
cumAvg = avg;
runAvg = avg;
}
public String getDuration() {
......@@ -112,13 +129,29 @@ public class DiskRun implements Serializable {
return String.valueOf(diffSeconds) + "s";
}
// basic getters and setters
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDriveType(String type) {
return this.driveType;
}
public void setDriveType(String type) {
driveType = type;
}
public String getDataPath() {
return this.dataPath;
}
public void setDataPath(String path) {
dataPath = path;
}
// utility methods for collection
static List<DiskRun> findAll() {
EntityManager em = EM.getEntityManager();
......
......@@ -15,6 +15,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
......@@ -66,7 +68,7 @@ public class DiskWorker extends SwingWorker <Boolean, DiskMark> {
int startFileNum = App.nextMarkNumber;
if(App.writeTest) {
DiskRun run = new DiskRun(DiskRun.Type.WRITE, App.blockSequence);
DiskRun run = new DiskRun(DiskRun.IOMode.WRITE, App.blockSequence);
run.numMarks = App.numOfMarks;
run.numBlocks = App.numOfBlocks;
run.blockSize = App.blockSizeKb;
......@@ -122,12 +124,16 @@ public class DiskWorker extends SwingWorker <Boolean, DiskMark> {
App.updateMetrics(wMark);
publish(wMark);
run.cumMax = wMark.cumMax;
run.cumMin = wMark.cumMin;
run.cumAvg = wMark.cumAvg;
run.runMax = wMark.cumMax;
run.runMin = wMark.cumMin;
run.runAvg = wMark.cumAvg;
run.endTime = new Date();
}
run.setDataPath(dataDir.getAbsolutePath());
Path dataDirPath = Paths.get(dataDir.getAbsolutePath());
run.setDriveType(Util.getDriveType(dataDirPath.getRoot().toFile()));
EntityManager em = EM.getEntityManager();
em.getTransaction().begin();
em.persist(run);
......@@ -149,7 +155,7 @@ public class DiskWorker extends SwingWorker <Boolean, DiskMark> {
}
if (App.readTest) {
DiskRun run = new DiskRun(DiskRun.Type.READ, App.blockSequence);
DiskRun run = new DiskRun(DiskRun.IOMode.READ, App.blockSequence);
run.numMarks = App.numOfMarks;
run.numBlocks = App.numOfBlocks;
run.blockSize = App.blockSizeKb;
......@@ -197,9 +203,9 @@ public class DiskWorker extends SwingWorker <Boolean, DiskMark> {
App.updateMetrics(rMark);
publish(rMark);
run.cumMax = rMark.cumMax;
run.cumMin = rMark.cumMin;
run.cumAvg = rMark.cumAvg;
run.runMax = rMark.cumMax;
run.runMin = rMark.cumMin;
run.runAvg = rMark.cumAvg;
run.endTime = new Date();
}
Gui.runPanel.addRun(run);
......
......@@ -472,7 +472,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Mode"/>
<Property name="text" type="java.lang.String" value="IO Mode"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="modeCombo">
......
......@@ -212,7 +212,7 @@ public final class MainFrame extends javax.swing.JFrame {
}
});
jLabel4.setText("Mode");
jLabel4.setText("IO Mode");
modeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "write", "read", "write&read" }));
modeCombo.addActionListener(new java.awt.event.ActionListener() {
......
......@@ -44,9 +44,10 @@
<Component class="javax.swing.JTable" name="runTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="11" rowCount="0">
<Column editable="false" title="Type" type="java.lang.Object"/>
<Column editable="false" title="Sequence" type="java.lang.Object"/>
<Table columnCount="12" rowCount="0">
<Column editable="false" title="Drive Type" type="java.lang.Object"/>
<Column editable="false" title="IO Mode" type="java.lang.Object"/>
<Column editable="false" title="Block Order" type="java.lang.Object"/>
<Column editable="false" title="Marks" type="java.lang.Object"/>
<Column editable="false" title="Blocks" type="java.lang.Object"/>
<Column editable="false" title="B. Size" type="java.lang.Object"/>
......@@ -60,17 +61,22 @@
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="35" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="25" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="40" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="50" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="10" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="7" resizable="true">
<Title/>
<Editor/>
<Renderer/>
......@@ -90,27 +96,27 @@
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="150" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="95" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="15" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="20" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="40" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="32" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="40" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="32" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="40" resizable="true">
<Column maxWidth="-1" minWidth="-1" prefWidth="32" resizable="true">
<Title/>
<Editor/>
<Renderer/>
......
......@@ -48,11 +48,11 @@ public class RunPanel extends javax.swing.JPanel {
},
new String [] {
"Type", "Sequence", "Marks", "Blocks", "B. Size", "Tx Size", "Start Time", "Duration", "Max (MB/s)", "Min (MB/s)", "Avg (MB/s)"
"Drive Type", "IO Mode", "Block Order", "Marks", "Blocks", "B. Size", "Tx Size", "Start Time", "Duration", "Max (MB/s)", "Min (MB/s)", "Avg (MB/s)"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false, false, false, false
false, false, false, false, false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
......@@ -61,17 +61,18 @@ public class RunPanel extends javax.swing.JPanel {
});
jScrollPane1.setViewportView(runTable);
if (runTable.getColumnModel().getColumnCount() > 0) {
runTable.getColumnModel().getColumn(0).setPreferredWidth(25);
runTable.getColumnModel().getColumn(1).setPreferredWidth(40);
runTable.getColumnModel().getColumn(2).setPreferredWidth(10);
runTable.getColumnModel().getColumn(3).setPreferredWidth(10);
runTable.getColumnModel().getColumn(0).setPreferredWidth(35);
runTable.getColumnModel().getColumn(1).setPreferredWidth(25);
runTable.getColumnModel().getColumn(2).setPreferredWidth(50);
runTable.getColumnModel().getColumn(3).setPreferredWidth(7);
runTable.getColumnModel().getColumn(4).setPreferredWidth(10);
runTable.getColumnModel().getColumn(5).setPreferredWidth(10);
runTable.getColumnModel().getColumn(6).setPreferredWidth(150);
runTable.getColumnModel().getColumn(7).setPreferredWidth(15);
runTable.getColumnModel().getColumn(8).setPreferredWidth(40);
runTable.getColumnModel().getColumn(9).setPreferredWidth(40);
runTable.getColumnModel().getColumn(10).setPreferredWidth(40);
runTable.getColumnModel().getColumn(6).setPreferredWidth(10);
runTable.getColumnModel().getColumn(7).setPreferredWidth(95);
runTable.getColumnModel().getColumn(8).setPreferredWidth(20);
runTable.getColumnModel().getColumn(9).setPreferredWidth(32);
runTable.getColumnModel().getColumn(10).setPreferredWidth(32);
runTable.getColumnModel().getColumn(11).setPreferredWidth(32);
}
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
......@@ -102,13 +103,14 @@ public class RunPanel extends javax.swing.JPanel {
DefaultTableModel model = (DefaultTableModel) this.runTable.getModel();
model.addRow(
new Object[] {
run.runType,
run.driveType,
run.ioMode,
run.blockOrder,
run.numMarks,
run.numBlocks,
run.blockSize,
run.txSize,
run.startTime.toString(),
run.getStartTimeString(),
run.getDuration(),
run.getMax(),
run.getMin(),
......
......@@ -8,13 +8,14 @@ import java.io.RandomAccessFile;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Random;
import javax.swing.filechooser.FileSystemView;
/**
* Utility methods for jDiskMark
*/
public class Util {
static DecimalFormat df = new DecimalFormat("###.###");
static final DecimalFormat DF = new DecimalFormat("###.##");
/**
* Deletes the Directory and all files within
......@@ -100,10 +101,22 @@ public class Util {
System.out.println("Total space (bytes): " + root.getTotalSpace());
System.out.println("Free space (bytes): " + root.getFreeSpace());
System.out.println("Usable space (bytes): " + root.getUsableSpace());
System.out.println("Drive Type: "+getDriveType(root));
}
}
public static String displayString(double num) {
return df.format(num);
return DF.format(num);
}
/**
* Gets the drive type string for a root file such as C:\
*
* @param file
* @return
*/
public static String getDriveType(File file) {
FileSystemView fsv = FileSystemView.getFileSystemView();
return fsv.getSystemTypeDescription(file);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment