From 129d1a6127b0ec0bfd20dd7a000e00f9b664771e Mon Sep 17 00:00:00 2001 From: Alexander Tornoreanu Date: Sun, 29 Mar 2020 15:05:21 +0200 Subject: [PATCH] add parsing time measurement and reparse button --- app/components/ParseXML.js | 47 +++++++++++++++++++++++++++++--------- app/utils/parser.js | 3 +++ package.json | 2 +- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/app/components/ParseXML.js b/app/components/ParseXML.js index c405c5d..197f618 100644 --- a/app/components/ParseXML.js +++ b/app/components/ParseXML.js @@ -68,6 +68,16 @@ export default class ParseXML extends Component { Save Parsed Data )} + {data && ( + + )}
{this.state.selectedFile && (

Selected File: {this.state.selectedFile}

@@ -78,6 +88,9 @@ export default class ParseXML extends Component {
{data && (
+
+ Parsing Time: {JSON.parse(data).parseTimeMs.toFixed(2)} ms +
View Parsed Data:
{ + this.setState({ parseLog: data, parsing: false }); + }); + } + } else { this.setState({}); - this.setState({ parsing: true, selectedFile: file, parseLog: '' }); - parseData(file[0], data => { + this.setState({ + parsing: true, + selectedFile: selectedFile, + parseLog: '' + }); + parseData(selectedFile[0], data => { this.setState({ parseLog: data, parsing: false }); }); } diff --git a/app/utils/parser.js b/app/utils/parser.js index 2a3cfff..aeea805 100644 --- a/app/utils/parser.js +++ b/app/utils/parser.js @@ -29,6 +29,7 @@ let applicationColor; export const parseData = (filename, callback) => { parseXml(filename, result => { + const startTime = performance.now(); let colorsIndex = 0; //console.log(`${filename}:`); let taskdata = result[ROOT_ITEM].task; @@ -56,6 +57,8 @@ export const parseData = (filename, callback) => { // process.exit(1); // } // }); + const endTime = performance.now(); + data.parseTimeMs = endTime - startTime; callback(JSON.stringify(data, null, 2)); }); }; diff --git a/package.json b/package.json index 0947219..5af1ccf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ipm-hpc-v2", "productName": "IPM-HPC-v2", - "version": "0.8.1", + "version": "0.8.2", "description": "Interactive Visualization of MPI Performance Data (Bachelor Thesis)", "scripts": { "build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",