lib/utils/timing.js
function measure(type, p) {
    timers[type] = timers[type] || {
        type: type,
        count: 0,
        total: 0,
        min: undefined,
        max: 0
    };

    var start = Date.now();

    return p
    .fin(function() {
        var end = Date.now();
        var duration = (end - start);

        timers[type].count ++;
        timers[type].total += duration;

        if (is.undefined(timers[type].min)) {
            timers[type].min = duration;
        } else {
            timers[type].min = Math.min(timers[type].min, duration);
        }

        timers[type].max = Math.max(timers[type].max, duration);
    });
}
function measure(type, p) {
    timers[type] = timers[type] || {
        type: type,
        count: 0,
        total: 0,
        min: undefined,
        max: 0
    };

    var start = Date.now();

    return p
    .fin(function() {
        var end = Date.now();
        var duration = (end - start);

        timers[type].count ++;
        timers[type].total += duration;

        if (is.undefined(timers[type].min)) {
            timers[type].min = duration;
        } else {
            timers[type].min = Math.min(timers[type].min, duration);
        }

        timers[type].max = Math.max(timers[type].max, duration);
    });
}
function measure ( type , p ) { timers [ type ] = timers [ type ] || { type : type , count : 0 , total : 0 , min : undefined , max : 0 } ; var start = Date . now ( ) ; return p . fin ( function ( ) { var end = Date . now ( ) ; var duration = ( end - start ) ; timers [ type ] . count ++ ; timers [ type ] . total += duration ; if ( is . undefined ( timers [ type ] . min ) ) { timers [ type ] . min = duration ; } else { timers [ type ] . min = Math . min ( timers [ type ] . min , duration ) ; } timers [ type ] . max = Math . max ( timers [ type ] . max , duration ) ; } ) ; }
Mesure an operation

@parqm {String} type
@param {Promise} p
@return {Promise}
Mesure an operation