|
1 |
- var marky=function(r){"use strict";function e(r){if(!r)throw new Error("name must be non-empty")}function n(r,e){for(var n,t=0,a=r.length;t<a;)n=t+a>>>1,r[n].startTime<e.startTime?t=n+1:a=n;r.splice(t,0,e)}var t="undefined"!=typeof performance&&performance,a=t&&t.now?function(){return t.now()}:function(){return Date.now()};if(r.mark=void 0,r.stop=void 0,r.getEntries=void 0,r.clear=void 0,t&&t.mark&&t.getEntriesByName&&t.getEntriesByType&&t.clearMeasures)r.mark=function(r){e(r),t.mark("start "+r)},r.stop=function(r){e(r),t.mark("end "+r),t.measure(r,"start "+r,"end "+r);var n=t.getEntriesByName(r);return n[n.length-1]},r.getEntries=function(){return t.getEntriesByType("measure")},r.clear=function(){t.clearMarks(),t.clearMeasures()};else{var o={},i=[];r.mark=function(r){e(r);var n=a();o["$"+r]=n},r.stop=function(r){e(r);var t=a(),u=o["$"+r];if(!u)throw new Error("no known mark: "+r);var s={startTime:u,name:r,duration:t-u,entryType:"measure"};return n(i,s),s},r.getEntries=function(){return i},r.clear=function(){o={},i=[]}}return r}({});
|