Skip to content

Commit

Permalink
execution times are now displayed in a pretty format
Browse files Browse the repository at this point in the history
  • Loading branch information
pstadler committed Mar 13, 2014
1 parent 3e542bc commit ac4f368
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions lib/flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Flight.prototype = {
}
transport.close();

t = process.hrtime(t);
this.status.executionTime = Math.round(t[0]*1e3 + t[1]/1e6);
this.status.executionTime = process.hrtime(t);

return future.return();
}.bind(this)).run();
Expand Down
10 changes: 5 additions & 5 deletions lib/flightplan.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var Fiber = require('fibers')
, prettyTime = require('pretty-hrtime')
, Logger = require('./logger')
, Briefing = require('./briefing')
, LocalFlight = require('./local')
Expand Down Expand Up @@ -291,7 +292,7 @@ Flightplan.prototype = {

var status = flight.getStatus()
, flightNumber = this.logger.format('%s/%s', i+1, len).magenta
, executionTime = this.logger.format('%s%s', status.executionTime, 'ms').magenta
, executionTime = prettyTime(status.executionTime).magenta
, crashReason = !status.crashRecordings ? '' : this.logger.format('when %s', status.crashRecordings);

if(flight.isAborted()) {
Expand All @@ -303,18 +304,17 @@ Flightplan.prototype = {
this.logger.space();
}

t = process.hrtime(t);
this.status.executionTime = Math.round(t[0]*1e3 + t[1]/1e6);
this.status.executionTime = process.hrtime(t);

if(this.isAborted()) {
this.logger.error('Flightplan aborted after'.error
, this.logger.format('%s%s', this.status.executionTime, 'ms').magenta);
, prettyTime(this.status.executionTime).magenta);
this.disasterCallback();
this.debriefingCallback();
process.exit(1);
} else {
this.logger.success('Flightplan finished after'.success
, this.logger.format('%s%s', this.status.executionTime, 'ms').magenta);
, prettyTime(this.status.executionTime).magenta);
this.successCallback();
this.debriefingCallback();
process.exit(0);
Expand Down
8 changes: 3 additions & 5 deletions lib/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ RemoteFlight.prototype.__start = function() {
}
transport.close();

t = process.hrtime(t);
flight.status.executionTime = Math.round(t[0]*1e3 + t[1]/1e6);
if(flight.status.executionTime > this.status.executionTime) {
this.status.executionTime = flight.status.executionTime;
}
flight.status.executionTime = process.hrtime(t);
this.status.executionTime = flight.status.executionTime;

return future.return();
}.bind(this)).run();

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"ssh2": "~0.2.17",
"colors": "~0.6.2",
"commander": "~2.1.0",
"prompt": "~0.2.12"
"prompt": "~0.2.12",
"pretty-hrtime": "^0.2.1"
},
"devDependencies": {
"gulp": "~3.5.2",
Expand Down

0 comments on commit ac4f368

Please sign in to comment.