Skip to content

Commit 53e0a24

Browse files
committed
Add execution time class
1 parent 4c7adc9 commit 53e0a24

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/explode_shape_layer.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ function explode() {
7777
return;
7878
}
7979

80+
var execTime = new ExecutionTime();
81+
execTime.start();
8082

8183
var hideShyLayers_originalState = selectedLayer.containingComp.hideShyLayers;
8284
selectedLayer.containingComp.hideShyLayers = true;
@@ -86,6 +88,9 @@ function explode() {
8688
selectedLayer.moveToBeginning()
8789
selectedLayer.containingComp.hideShyLayers = hideShyLayers_originalState;
8890

91+
execTime.stop();
92+
cLog(execTime.time());
93+
8994
}
9095

9196
function emptyDuplicateLayer(layer) {

src/utils.jsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,26 @@ function listMatchNames(object) {
1818
}
1919

2020
}
21+
22+
function ExecutionTime() {
23+
24+
var startTime;
25+
var endTime;
26+
var execTime;
27+
28+
this.constructor = function () {}
29+
30+
this.start = function () {
31+
startTime = new Date().getTime();
32+
}
33+
34+
this.stop = function () {
35+
endTime = new Date().getTime()
36+
execTime = endTime - startTime;
37+
}
38+
39+
this.time = function () {
40+
return 'Execution time : ' + Math.floor(execTime / 1000) + 's ' + (execTime % 1000) + 'ms';
41+
}
42+
43+
}

0 commit comments

Comments
 (0)