-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcreate-profile.min.js
4 lines (4 loc) · 1.12 KB
/
create-profile.min.js
1
2
3
4
'use strict';module.exports=l;
function l(b){function g(b,a,e,c){a=/^(.+)_(\d+)_(\d+)$/.exec(a);return{functionName:a[1],scriptId:"0",url:b,lineNumber:parseInt(a[2],10),columnNumber:parseInt(a[3],10),hitCount:0,callUID:e,children:[],deoptReason:"",id:c,positionTicks:[]}}function h(b,a){for(;!(1===b.id&&a.a>=a.e.length)&&a.e[a.a]!==-b.callUID;){if(a.a>=a.e.length)throw Error("trace ended before exiting all entered functions");var e=a.e[a.a];if(0>e)throw Error("invalid trace: exit of function not currently inside.");for(var c=null,
d=0;d<b.children.length;d++)if(b.children[d].callUID===e){c=b.children[d];break}c||(c=g(a.fileName,a.i[e],e,a.h++),b.children.push(c));c.hitCount++;a.b.push(c.id);e=a.f?1E3*a.f[a.a]:1E3*a.g++;a.c.push(Math.floor(e));a.a++;h(c,a);a.f?(c.hitCount++,a.b.push(c.id),c=1E3*a.f[a.a],a.c.push(Math.floor(c)),a.a++,b.hitCount++,a.b.push(b.id),a.c.push(Math.floor(c+1))):a.a++}}var k=g("","(root)_0_0",b.fns.length,1),d={a:0,fileName:b.file,e:b.t,i:b.fns,h:2,f:b.d?b.d:null,g:0,b:[],c:[]};h(k,d);var f;b.d?(f=b.d[0],
b=b.d[b.d.length-1]):(f=0,b=d.g);return{head:k,startTime:f/1E3,endTime:b/1E3,samples:d.b,timestamps:d.c}};