From 4b42030d5b546d826c174e7174044011da10aaa7 Mon Sep 17 00:00:00 2001 From: PubuduS Date: Sun, 21 Aug 2022 23:53:44 -0500 Subject: [PATCH] Initial Commit --- .gitignore | 10 + build.xml | 73 ++ manifest.mf | 3 + nbproject/build-impl.xml | 1420 +++++++++++++++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/project.properties | 74 ++ nbproject/project.xml | 15 + src/etl_to_csv/ETL_TO_CSV.java | 21 + src/etl_to_csv/ExportCSV.form | 239 +++++ src/etl_to_csv/ExportCSV.java | 391 ++++++++ wprProfiles/CPUProfile.wpaProfile | 559 ++++++++++++ 11 files changed, 2813 insertions(+) create mode 100644 .gitignore create mode 100644 build.xml create mode 100644 manifest.mf create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/etl_to_csv/ETL_TO_CSV.java create mode 100644 src/etl_to_csv/ExportCSV.form create mode 100644 src/etl_to_csv/ExportCSV.java create mode 100644 wprProfiles/CPUProfile.wpaProfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66e92d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +**/nbproject/private/ +**/nbproject/Makefile-*.mk +**/nbproject/Package-*.bash +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ +# Ignore the text file that use to push a commit message +message.txt \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..9b0bcae --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project ETL_TO_CSV. + + + diff --git a/manifest.mf b/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..36d64a4 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..7585796 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=34d8f511 +build.xml.script.CRC32=8a40674a +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=34d8f511 +nbproject/build-impl.xml.script.CRC32=21adafec +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..0c51097 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/ETL_TO_CSV.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=etl_to_csv.ETL_TO_CSV +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..db43b13 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + ETL_TO_CSV + + + + + + + + + diff --git a/src/etl_to_csv/ETL_TO_CSV.java b/src/etl_to_csv/ETL_TO_CSV.java new file mode 100644 index 0000000..8c7a2a1 --- /dev/null +++ b/src/etl_to_csv/ETL_TO_CSV.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package etl_to_csv; + +/** + * + * @author Pubudu + */ +public class ETL_TO_CSV { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + } + +} diff --git a/src/etl_to_csv/ExportCSV.form b/src/etl_to_csv/ExportCSV.form new file mode 100644 index 0000000..05e6c67 --- /dev/null +++ b/src/etl_to_csv/ExportCSV.form @@ -0,0 +1,239 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + +
+ diff --git a/src/etl_to_csv/ExportCSV.java b/src/etl_to_csv/ExportCSV.java new file mode 100644 index 0000000..bca9b16 --- /dev/null +++ b/src/etl_to_csv/ExportCSV.java @@ -0,0 +1,391 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package etl_to_csv; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.table.DefaultTableModel; + +/** + * + * @author Pubudu + */ +public class ExportCSV extends javax.swing.JFrame { + + private String m_RootFolderPath = null; + private final String m_ProfilePath = System.getProperty("user.dir")+"\\wprProfiles\\"; + private String m_ProfileDirectory = null; + private String m_WPRProfile = null; + + private File[] m_ListOfFiles; + + public ExportCSV() { + initComponents(); + jLabelProcessing.setVisible(false); + } + + private void Show_Results(Process p) throws IOException + { + BufferedReader output_reader = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); + String output = ""; + while ((output = output_reader.readLine()) != null) { + System.out.println(output); + } + } + + private void RemoveTableRows( DefaultTableModel myTableModel ) + { + if( myTableModel.getRowCount() > 0 ) + { + for( int i = myTableModel.getRowCount() - 1; i > -1; i-- ) { + myTableModel.removeRow(i); + } + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + jLabel1 = new javax.swing.JLabel(); + jPanel1 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + txtETLPath = new javax.swing.JTextField(); + btnBrowse = new javax.swing.JButton(); + btnReadFileNames = new javax.swing.JButton(); + jRadioButtonCPU = new javax.swing.JRadioButton(); + jRadioButtonGPU = new javax.swing.JRadioButton(); + jRadioButtonMemory = new javax.swing.JRadioButton(); + jRadioButtonStorage = new javax.swing.JRadioButton(); + btnExtractCSV = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jLabelProcessing = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jLabel1.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N + jLabel1.setText("Export ETL Traces as CSV"); + + jLabel2.setText("Path to ETL files:"); + + btnBrowse.setText("Browse"); + btnBrowse.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnBrowseActionPerformed(evt); + } + }); + + btnReadFileNames.setText("Get Files"); + btnReadFileNames.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnReadFileNamesActionPerformed(evt); + } + }); + + buttonGroup1.add(jRadioButtonCPU); + jRadioButtonCPU.setText("CPU"); + jRadioButtonCPU.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButtonCPUActionPerformed(evt); + } + }); + + buttonGroup1.add(jRadioButtonGPU); + jRadioButtonGPU.setText("GPU"); + jRadioButtonGPU.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButtonGPUActionPerformed(evt); + } + }); + + buttonGroup1.add(jRadioButtonMemory); + jRadioButtonMemory.setText("Memory"); + jRadioButtonMemory.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButtonMemoryActionPerformed(evt); + } + }); + + buttonGroup1.add(jRadioButtonStorage); + jRadioButtonStorage.setText("Storage"); + jRadioButtonStorage.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButtonStorageActionPerformed(evt); + } + }); + + btnExtractCSV.setText("Extract CSV"); + btnExtractCSV.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExtractCSVActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(29, 29, 29) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2) + .addGap(18, 18, 18) + .addComponent(txtETLPath, javax.swing.GroupLayout.PREFERRED_SIZE, 386, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jRadioButtonCPU) + .addGap(28, 28, 28) + .addComponent(jRadioButtonGPU) + .addGap(27, 27, 27) + .addComponent(jRadioButtonMemory) + .addGap(27, 27, 27) + .addComponent(jRadioButtonStorage))) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(btnBrowse, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnExtractCSV, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)) + .addGap(34, 34, 34) + .addComponent(btnReadFileNames, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(78, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(txtETLPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnBrowse) + .addComponent(btnReadFileNames)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jRadioButtonCPU) + .addComponent(jRadioButtonGPU) + .addComponent(jRadioButtonMemory) + .addComponent(jRadioButtonStorage) + .addComponent(btnExtractCSV)) + .addContainerGap()) + ); + + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "File Name" + } + )); + jScrollPane1.setViewportView(jTable1); + + jLabelProcessing.setText("Processing:"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(320, 320, 320) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(50, 50, 50) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(66, 66, 66) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 716, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(223, 223, 223) + .addComponent(jLabelProcessing, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE) + .addComponent(jLabelProcessing) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + setSize(new java.awt.Dimension(895, 561)); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void btnBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseActionPerformed + final JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); + int returnVal = fileChooser.showOpenDialog(this); + + if( returnVal == JFileChooser.APPROVE_OPTION ) + { + m_RootFolderPath = fileChooser.getSelectedFile().toString()+"\\"; + txtETLPath.setText( m_RootFolderPath ); + } + else + { + txtETLPath.setText("Error Code " + returnVal); + } + }//GEN-LAST:event_btnBrowseActionPerformed + + private void btnReadFileNamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReadFileNamesActionPerformed + File folder = new File( m_RootFolderPath ); + + FileFilter fileFilter = file -> !file.isDirectory() && file.getName().endsWith(".etl"); + + m_ListOfFiles = folder.listFiles( fileFilter ); + + DefaultTableModel dtm = (DefaultTableModel)jTable1.getModel(); + RemoveTableRows( dtm ); + + for( int i = 0; i < m_ListOfFiles.length; i++ ) + { + if( m_ListOfFiles[i].isFile() ) + { + dtm.addRow( new Object[]{ m_ListOfFiles[i].getName() } ); + } + else + { + JOptionPane.showMessageDialog( null, "Something Went Wrong!" ); + } + } + + if( m_ListOfFiles.length == 0 ) + { + JOptionPane.showMessageDialog( null, "No ETL file detected" ); + } + }//GEN-LAST:event_btnReadFileNamesActionPerformed + + private void jRadioButtonCPUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonCPUActionPerformed + m_ProfileDirectory = "CPU_Profile"; + m_WPRProfile = System.getProperty("user.dir") + "\\wprProfiles\\CPUProfile.wpaProfile"; + System.out.println(m_WPRProfile); + }//GEN-LAST:event_jRadioButtonCPUActionPerformed + + private void jRadioButtonGPUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonGPUActionPerformed + m_ProfileDirectory = "GPU_Profile"; + }//GEN-LAST:event_jRadioButtonGPUActionPerformed + + private void jRadioButtonMemoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMemoryActionPerformed + m_ProfileDirectory = "Memory_Profile"; + }//GEN-LAST:event_jRadioButtonMemoryActionPerformed + + private void jRadioButtonStorageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonStorageActionPerformed + m_ProfileDirectory = "Storage_Profile"; + }//GEN-LAST:event_jRadioButtonStorageActionPerformed + + private void btnExtractCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExtractCSVActionPerformed + + File profileDirectory = new File( m_RootFolderPath + m_ProfileDirectory ); + + String outputFolder = m_RootFolderPath + m_ProfileDirectory + "\\"; + + if( profileDirectory.exists() == false ) + { + profileDirectory.mkdirs(); + } + + for( int i = 0; i < m_ListOfFiles.length; i++ ) + { + String fileName = m_ListOfFiles[i].getName(); + String command = "wpaexporter " + fileName + " -profile " + m_WPRProfile + " -outputfolder " + outputFolder + " -prefix " + fileName; + System.out.println(command); + ProcessBuilder builder = new ProcessBuilder( "cmd.exe", "/c", command ); + builder = builder.directory( new File( m_RootFolderPath ) ); + + try { + builder.redirectErrorStream(true); + Process process = builder.start(); + jLabelProcessing.setText("Processing " + fileName ); + jLabelProcessing.setVisible(true); + //Show_Results(p); + process.waitFor(300, TimeUnit.SECONDS); + process.destroyForcibly(); + process.waitFor(); + } catch (IOException ex) { + JOptionPane.showMessageDialog(null, "Failed to run cmd command "+ex); + } catch (InterruptedException ex) { + JOptionPane.showMessageDialog(null, "Command Line Thread "+ex); + } + } + + + + }//GEN-LAST:event_btnExtractCSVActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(ExportCSV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(ExportCSV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(ExportCSV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(ExportCSV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new ExportCSV().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnBrowse; + private javax.swing.JButton btnExtractCSV; + private javax.swing.JButton btnReadFileNames; + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabelProcessing; + private javax.swing.JPanel jPanel1; + private javax.swing.JRadioButton jRadioButtonCPU; + private javax.swing.JRadioButton jRadioButtonGPU; + private javax.swing.JRadioButton jRadioButtonMemory; + private javax.swing.JRadioButton jRadioButtonStorage; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + private javax.swing.JTextField txtETLPath; + // End of variables declaration//GEN-END:variables +} diff --git a/wprProfiles/CPUProfile.wpaProfile b/wprProfiles/CPUProfile.wpaProfile new file mode 100644 index 0000000..5876d8a --- /dev/null +++ b/wprProfiles/CPUProfile.wpaProfile @@ -0,0 +1,559 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file