From 1102feaac3e21a67ba8954997afdcfb037f45136 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 27 Jul 2023 00:42:51 +0000 Subject: [PATCH] speedscope 1.16.0. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4367 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- .../{import.f56540a0.js => import.8ae8aa3d.js} | 16 +++++++++------- ...dscope.0d51a4b1.js => speedscope.f27db165.js} | 10 +++++----- src/version.h | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) rename deps/speedscope/{import.f56540a0.js => import.8ae8aa3d.js} (86%) rename deps/speedscope/{speedscope.0d51a4b1.js => speedscope.f27db165.js} (97%) diff --git a/deps/speedscope/import.f56540a0.js b/deps/speedscope/import.8ae8aa3d.js similarity index 86% rename from deps/speedscope/import.f56540a0.js rename to deps/speedscope/import.8ae8aa3d.js index 38e81cee..a9503cc2 100644 --- a/deps/speedscope/import.f56540a0.js +++ b/deps/speedscope/import.8ae8aa3d.js @@ -39,9 +39,9 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"./lib/utils/common":"tbG5","./lib/deflate":"nFS2","./lib/inflate":"faQk","./lib/zlib/constants":"xUUw"}],"DstG":[function(require,module,exports) { !function(e){var a=String.fromCharCode;function s(e,s,c){for(var n=e[s],r=1,i=0,t=0;t=32&&n<=126?"Unexpected character "+a(n)+" in JSON at position "+s+" (line "+r+", column "+i+")":"Unexpected byte 0x"+n.toString(16)+" in JSON at position "+s+" (line "+r+", column "+i+")"))}e.JSON_parse=function(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");for(var c,n=[],r=[],i=[],t=e.length,o=null,u=0,f=0;f=t&&s(e,t),34!==(p=e[f++]);)if(92===p)switch(e[f++]){case 34:l+='"';break;case 47:l+="/";break;case 92:l+="\\";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+="\n";break;case 114:l+="\r";break;case 116:l+="\t";break;case 117:for(var k=0,h=0;h<4;h++)k<<=4,(p=e[f++])>=48&&p<=57?k|=p-48:p>=97&&p<=102?k|=p+-87:p>=65&&p<=70?k|=p+-55:s(e,--f);l+=a(k);break;default:s(e,--f)}else if(p<=127)l+=a(p);else if(192==(224&p))l+=a((31&p)<<6|63&e[f++]);else if(224==(240&p))l+=a((15&p)<<12|(63&e[f++])<<6|63&e[f++]);else if(240==(248&p)){var d=(7&p)<<18|(63&e[f++])<<12|(63&e[f++])<<6|63&e[f++];d>65535&&(l+=a((d-=65536)>>10&1023|55296),d=56320|1023&d),l+=a(d)}l[0];break;case 91:l=[],n.push(o),r.push(c),i.push(u),o=null,c=l,u=1;continue;case 123:l={},n.push(o),r.push(c),i.push(u),o=null,c=l,u=2;continue;case 93:1!==u&&s(e,--f),l=c,o=n.pop(),c=r.pop(),u=i.pop();break;case 125:2!==u&&s(e,--f),l=c,o=n.pop(),c=r.pop(),u=i.pop();break;default:s(e,--f)}for(p=e[f];p<=32;)p=e[++f];switch(u){case 0:if(f===t)return l;break;case 1:if(c.push(l),44===p){f++;continue}if(93===p)continue;break;case 2:if(null===o){if(o=l,58===p){f++;continue}}else{if(c[o]=l,o=null,44===p){f++;continue}if(125===p)continue}}break}}s(e,f)}}("undefined"!=typeof exports?exports:this); },{}],"QTYz":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.withMockedFileChunkSizeForTests=o,exports.MaybeCompressedDataReader=exports.TextProfileDataSource=exports.StringBackedTextFileContent=exports.BufferBackedTextFileContent=void 0;var e=n(require("pako")),t=require("uint8array-json-parser");function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}function n(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}var s=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{a(n.next(e))}catch(t){i(t)}}function u(e){try{a(n.throw(e))}catch(t){i(t)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,u)}a((n=n.apply(e,t||[])).next())})};let i=1<<27;function o(e,t){return s(this,void 0,void 0,function*(){const r=i;i=e;try{yield t()}finally{i=r}})}function u(e){return"["===(e=e.trim())[0]&&"]"!==(e=e.replace(/,\s*$/,""))[e.length-1]&&(e+="]"),JSON.parse(e)}function a(e){let r=0;for(let t=0;t0&&/\s/.exec(String.fromCharCode(e[t-1]));)t--;if(","===String.fromCharCode(e[t-1])&&t--,"]"!==String.fromCharCode(e[t-1])){const r=new Uint8Array(t+1);r.set(e.subarray(0,t)),r[t]="]".charCodeAt(0),e=r}}return(0,t.JSON_parse)(e)}class c{constructor(e){this.chunks=[];const t=this.byteArray=new Uint8Array(e);let r="utf-8";if(t.length>2&&(255===t[0]&&254===t[1]?r="utf-16le":254===t[0]&&255===t[1]&&(r="utf-16be")),"undefined"!=typeof TextDecoder){const t=new TextDecoder(r);for(let r=0;r=i&&this.chunks.push("")}}splitLines(){let e=this.chunks[0].split("\n");for(let t=1;t0&&(e[e.length-1]+=r.shift()),e=e.concat(r))}return e}firstChunk(){return this.chunks[0]||""}parseAsJSON(){return 1===this.chunks.length?u(this.chunks[0]):a(this.byteArray)}}exports.BufferBackedTextFileContent=c;class h{constructor(e){this.s=e}splitLines(){return this.s.split("\n")}firstChunk(){return this.s}parseAsJSON(){return u(this.s)}}exports.StringBackedTextFileContent=h;class f{constructor(e,t){this.fileName=e,this.contents=t}name(){return s(this,void 0,void 0,function*(){return this.fileName})}readAsArrayBuffer(){return s(this,void 0,void 0,function*(){return new ArrayBuffer(0)})}readAsText(){return s(this,void 0,void 0,function*(){return new h(this.contents)})}}exports.TextProfileDataSource=f;class l{constructor(t,r){this.namePromise=t,this.uncompressedData=r.then(t=>s(this,void 0,void 0,function*(){try{return e.inflate(new Uint8Array(t)).buffer}catch(r){return t}}))}name(){return s(this,void 0,void 0,function*(){return yield this.namePromise})}readAsArrayBuffer(){return s(this,void 0,void 0,function*(){return yield this.uncompressedData})}readAsText(){return s(this,void 0,void 0,function*(){const e=yield this.readAsArrayBuffer();return new c(e)})}static fromFile(e){const t=new Promise(t=>{const r=new FileReader;r.addEventListener("loadend",()=>{if(!(r.result instanceof ArrayBuffer))throw new Error("Expected reader.result to be an instance of ArrayBuffer");t(r.result)}),r.readAsArrayBuffer(e)});return new l(Promise.resolve(e.name),t)}static fromArrayBuffer(e,t){return new l(Promise.resolve(e),Promise.resolve(t))}}exports.MaybeCompressedDataReader=l; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.withMockedFileChunkSizeForTests=o,exports.MaybeCompressedDataReader=exports.TextProfileDataSource=exports.StringBackedTextFileContent=exports.BufferBackedTextFileContent=void 0;var e=n(require("pako")),t=require("uint8array-json-parser");function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}function n(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}var s=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{a(n.next(e))}catch(t){i(t)}}function u(e){try{a(n.throw(e))}catch(t){i(t)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,u)}a((n=n.apply(e,t||[])).next())})};let i=1<<27;function o(e,t){return s(this,void 0,void 0,function*(){const r=i;i=e;try{yield t()}finally{i=r}})}function u(e){return"["===(e=e.trim())[0]&&"]"!==(e=e.replace(/,\s*$/,""))[e.length-1]&&(e+="]"),JSON.parse(e)}function a(e){let r=0;for(let t=0;t0&&/\s/.exec(String.fromCharCode(e[t-1]));)t--;if(","===String.fromCharCode(e[t-1])&&t--,"]"!==String.fromCharCode(e[t-1])){const r=new Uint8Array(t+1);r.set(e.subarray(0,t)),r[t]="]".charCodeAt(0),e=r}}return(0,t.JSON_parse)(e)}class c{constructor(e){this.chunks=[];const t=this.byteArray=new Uint8Array(e);let r="utf-8";if(t.length>2&&(255===t[0]&&254===t[1]?r="utf-16le":254===t[0]&&255===t[1]&&(r="utf-16be")),"undefined"!=typeof TextDecoder){const t=new TextDecoder(r);for(let r=0;r=i&&this.chunks.push("")}}splitLines(){return{[Symbol.iterator]:function*(){let e="";for(let t of this.chunks){const r=t.split("\n");for(let t=0;ts(this,void 0,void 0,function*(){try{return e.inflate(new Uint8Array(t)).buffer}catch(r){return t}}))}name(){return s(this,void 0,void 0,function*(){return yield this.namePromise})}readAsArrayBuffer(){return s(this,void 0,void 0,function*(){return yield this.uncompressedData})}readAsText(){return s(this,void 0,void 0,function*(){const e=yield this.readAsArrayBuffer();return new c(e)})}static fromFile(e){const t=new Promise(t=>{const r=new FileReader;r.addEventListener("loadend",()=>{if(!(r.result instanceof ArrayBuffer))throw new Error("Expected reader.result to be an instance of ArrayBuffer");t(r.result)}),r.readAsArrayBuffer(e)});return new l(Promise.resolve(e.name),t)}static fromArrayBuffer(e,t){return new l(Promise.resolve(e),Promise.resolve(t))}}exports.MaybeCompressedDataReader=l; },{"pako":"f4vO","uint8array-json-parser":"DstG"}],"G28U":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromInstrumentsDeepCopy=a,exports.importFromInstrumentsTrace=w,exports.importRunFromInstrumentsTrace=g,exports.importThreadFromInstrumentsTrace=b,exports.readInstrumentsKeyedArchive=y,exports.decodeUTF8=v,exports.UID=void 0;var e=require("../lib/profile"),t=require("../lib/utils"),r=require("../lib/value-formatters"),n=require("./utils"),s=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{c(n.next(e))}catch(t){i(t)}}function a(e){try{c(n.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};function i(e){const t=e.splitLines().map(e=>e.split("\t")),r=t.shift();if(!r)return[];const n=new Map;for(let i=0;i0;){const e=a.pop();c=Math.max(c,e.endValue),n.leaveFrame(e,c)}return"Bytes Used"in s[0]?n.setValueFormatter(new r.ByteFormatter):("Weight"in s[0]||"Running Time"in s[0])&&n.setValueFormatter(new r.TimeFormatter("milliseconds")),n.build()}function c(e){return s(this,void 0,void 0,function*(){const t={name:e.name,files:new Map,subdirectories:new Map},r=yield new Promise((t,r)=>{e.createReader().readEntries(e=>{t(e)},r)});for(let e of r)if(e.isDirectory){const r=yield c(e);t.subdirectories.set(r.name,r)}else{const r=yield new Promise((t,r)=>{e.file(t,r)});t.files.set(r.name,r)}return t})}function l(e){return n.MaybeCompressedDataReader.fromFile(e).readAsArrayBuffer()}function u(e){return n.MaybeCompressedDataReader.fromFile(e).readAsText()}function f(e,r){const n=(0,t.getOrThrow)(e.subdirectories,"corespace"),s=(0,t.getOrThrow)(n.subdirectories,`run${r}`);return(0,t.getOrThrow)(s.subdirectories,"core")}class h{constructor(e){this.bytePos=0,this.view=new DataView(e)}seek(e){this.bytePos=e}skip(e){this.bytePos+=e}hasMore(){return this.bytePosthis.view.byteLength?0:this.view.getUint8(this.bytePos-1)}readUint32(){return this.bytePos+=4,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-4,!0)}readUint48(){return this.bytePos+=6,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-6,!0)+this.view.getUint16(this.bytePos-2,!0)*Math.pow(2,32)}readUint64(){return this.bytePos+=8,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-8,!0)+this.view.getUint32(this.bytePos-4,!0)*Math.pow(2,32)}}function p(e){return s(this,void 0,void 0,function*(){const r=(0,t.getOrThrow)(e.subdirectories,"stores");for(let e of r.subdirectories.values()){const r=e.files.get("schema.xml");if(!r)continue;const n=yield u(r);if(!/name="time-profile"/.exec(n.firstChunk()))continue;const s=new h(yield l((0,t.getOrThrow)(e.files,"bulkstore")));s.readUint32(),s.readUint32(),s.readUint32();const i=s.readUint32(),o=s.readUint32();s.seek(i);const a=[];for(;;){const e=s.readUint48();if(0===e)break;const t=s.readUint32();s.skip(o-6-4-4);const r=s.readUint32();a.push({timestamp:e,threadID:t,backtraceID:r})}return a}throw new Error("Could not find sample list")})}function d(e,r){return s(this,void 0,void 0,function*(){const e=(0,t.getOrThrow)(r.subdirectories,"uniquing"),n=(0,t.getOrThrow)(e.subdirectories,"arrayUniquer"),s=(0,t.getOrThrow)(n.files,"integeruniquer.index"),i=(0,t.getOrThrow)(n.files,"integeruniquer.data"),o=new h(yield l(s)),a=new h(yield l(i));o.seek(32);let c=[];for(;o.hasMore();){const e=o.readUint32()+1048576*o.readUint32();if(0===e)continue;a.seek(e);let t=a.readUint32(),r=[];for(;t--;)r.push(a.readUint64());c.push(r)}return c})}function m(e){return s(this,void 0,void 0,function*(){const r=(0,t.getOrThrow)(e.files,"form.template"),n=y(yield l(r)),s=n["com.apple.xray.owner.template.version"];let i=1;"com.apple.xray.owner.template"in n&&(i=n["com.apple.xray.owner.template"].get("_selectedRunNumber"));let o=n.$1;"stubInfoByUUID"in n&&(o=Array.from(n.stubInfoByUUID.keys())[0]);const a=n["com.apple.xray.run.data"],c=[];for(let e of a.runNumbers){const r=(0,t.getOrThrow)(a.runData,e),n=(0,t.getOrThrow)(r,"symbolsByPid"),s=new Map;for(let i of n.values()){for(let e of i.symbols){if(!e)continue;const{sourcePath:r,symbolName:n,addressToLine:i}=e;for(let e of i.keys())(0,t.getOrInsert)(s,e,()=>{const s=n||`0x${(0,t.zeroPad)(e.toString(16),16)}`,i={key:`${r}:${s}`,name:s};return r&&(i.file=r),i})}c.push({number:e,addressToFrameMap:s})}}return{version:s,instrument:o,selectedRunNumber:i,runs:c}})}function w(e){return s(this,void 0,void 0,function*(){const t=yield c(e),{version:r,runs:n,instrument:s,selectedRunNumber:i}=yield m(t);if("com.apple.xray.instrument-type.coresampler2"!==s)throw new Error(`The only supported instrument from .trace import is "com.apple.xray.instrument-type.coresampler2". Got ${s}`);console.log("version: ",r),console.log("Importing time profile");const o=[];let a=0;for(let c of n){const{addressToFrameMap:r,number:n}=c,s=yield g({fileName:e.name,tree:t,addressToFrameMap:r,runNumber:n});c.number===i&&(a=o.length+s.indexToView),o.push(...s.profiles)}return{name:e.name,indexToView:a,profiles:o}})}function g(e){return s(this,void 0,void 0,function*(){const{fileName:r,tree:n,addressToFrameMap:s,runNumber:i}=e,o=f(n,i);let a=yield p(o);const c=yield d(a,o),l=new Map;for(let e of a)l.set(e.threadID,(0,t.getOrElse)(l,e.threadID,()=>0)+1);const u=Array.from(l.entries());(0,t.sortBy)(u,e=>-e[1]);const h=u.map(e=>e[0]);return{name:r,indexToView:0,profiles:h.map(e=>b({threadID:e,fileName:r,arrays:c,addressToFrameMap:s,samples:a}))}})}function b(n){let{fileName:s,addressToFrameMap:i,arrays:o,threadID:a,samples:c}=n;const l=new Map;c=c.filter(e=>e.threadID===a);const u=new e.StackListProfileBuilder((0,t.lastOf)(c).timestamp);function f(e,r){const n=i.get(e);if(n)r.push(n);else if(e in o)for(let t of o[e])f(t,r);else{const n={key:e,name:`0x${(0,t.zeroPad)(e.toString(16),16)}`};i.set(e,n),r.push(n)}}u.setName(`${s} - thread ${a}`);let h=null;for(let e of c){const r=(0,t.getOrInsert)(l,e.backtraceID,e=>{const t=[];return f(e,t),t.reverse(),t});if(null===h&&(u.appendSampleWithWeight([],e.timestamp),h=e.timestamp),e.timestamp{switch(e){case"NSTextStorage":case"NSParagraphStyle":case"NSFont":return null;case"PFTSymbolData":{const e=Object.create(null);e.symbolName=t.$0,e.sourcePath=t.$1,e.addressToLine=new Map;for(let r=3;;r+=2){const n=t["$"+r],s=t["$"+(r+1)];if(null==n||null==s)break;e.addressToLine.set(n,s)}return e}case"PFTOwnerData":{const e=Object.create(null);return e.ownerName=t.$0,e.ownerPath=t.$1,e}case"PFTPersistentSymbols":{const e=Object.create(null),r=t.$4;e.threadNames=t.$3,e.symbols=[];for(let n=1;ne)){if(1e5!==e.$version||"NSKeyedArchiver"!==e.$archiver||!S(e.$top)||!U(e.$objects))throw new Error("Invalid keyed archive");"$null"===e.$objects[0]&&(e.$objects[0]=null);for(let n=0;n{if(t instanceof x)return e.$objects[t.index];if(U(t))for(let e=0;ee)){if(S(t)&&t.$class){let n=N(e,t.$class).$classname;switch(n){case"NSDecimalNumberPlaceholder":{let e=t["NS.length"],r=t["NS.exponent"],n=t["NS.mantissa.bo"],s=t["NS.negative"],i=new Uint16Array(new Uint8Array(t["NS.mantissa"]).buffer),o=0;for(let t=0;t>8|(255&e)<<8),o+=e*Math.pow(65536,t)}return o*=Math.pow(10,r),s?-o:o}case"NSData":case"NSMutableData":return t["NS.bytes"]||t["NS.data"];case"NSString":case"NSMutableString":return t["NS.string"]?t["NS.string"]:t["NS.bytes"]?v(t["NS.bytes"]):(console.warn(`Unexpected ${n} format: `,t),null);case"NSArray":case"NSMutableArray":if("NS.objects"in t)return t["NS.objects"];let e=[];for(;;){let r="NS.object."+e.length;if(!(r in t))break;e.push(t[r])}return e;case"_NSKeyedCoderOldStyleArray":{const e=t["NS.count"];let r=[];for(let n=0;n>4){case 0:return this.parseSingleton(e,r);case 1:return this.parseInteger(e,1<e.split("\t")),r=t.shift();if(!r)return[];const n=new Map;for(let i=0;i0;){const e=a.pop();c=Math.max(c,e.endValue),n.leaveFrame(e,c)}return"Bytes Used"in s[0]?n.setValueFormatter(new r.ByteFormatter):("Weight"in s[0]||"Running Time"in s[0])&&n.setValueFormatter(new r.TimeFormatter("milliseconds")),n.build()}function c(e){return s(this,void 0,void 0,function*(){const t={name:e.name,files:new Map,subdirectories:new Map},r=yield new Promise((t,r)=>{e.createReader().readEntries(e=>{t(e)},r)});for(let e of r)if(e.isDirectory){const r=yield c(e);t.subdirectories.set(r.name,r)}else{const r=yield new Promise((t,r)=>{e.file(t,r)});t.files.set(r.name,r)}return t})}function l(e){return n.MaybeCompressedDataReader.fromFile(e).readAsArrayBuffer()}function u(e){return n.MaybeCompressedDataReader.fromFile(e).readAsText()}function f(e,r){const n=(0,t.getOrThrow)(e.subdirectories,"corespace"),s=(0,t.getOrThrow)(n.subdirectories,`run${r}`);return(0,t.getOrThrow)(s.subdirectories,"core")}class h{constructor(e){this.bytePos=0,this.view=new DataView(e)}seek(e){this.bytePos=e}skip(e){this.bytePos+=e}hasMore(){return this.bytePosthis.view.byteLength?0:this.view.getUint8(this.bytePos-1)}readUint32(){return this.bytePos+=4,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-4,!0)}readUint48(){return this.bytePos+=6,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-6,!0)+this.view.getUint16(this.bytePos-2,!0)*Math.pow(2,32)}readUint64(){return this.bytePos+=8,this.bytePos>this.view.byteLength?0:this.view.getUint32(this.bytePos-8,!0)+this.view.getUint32(this.bytePos-4,!0)*Math.pow(2,32)}}function p(e){return s(this,void 0,void 0,function*(){const r=(0,t.getOrThrow)(e.subdirectories,"stores");for(let e of r.subdirectories.values()){const r=e.files.get("schema.xml");if(!r)continue;const n=yield u(r);if(!/name="time-profile"/.exec(n.firstChunk()))continue;const s=new h(yield l((0,t.getOrThrow)(e.files,"bulkstore")));s.readUint32(),s.readUint32(),s.readUint32();const i=s.readUint32(),o=s.readUint32();s.seek(i);const a=[];for(;;){const e=s.readUint48();if(0===e)break;const t=s.readUint32();s.skip(o-6-4-4);const r=s.readUint32();a.push({timestamp:e,threadID:t,backtraceID:r})}return a}throw new Error("Could not find sample list")})}function d(e,r){return s(this,void 0,void 0,function*(){const e=(0,t.getOrThrow)(r.subdirectories,"uniquing"),n=(0,t.getOrThrow)(e.subdirectories,"arrayUniquer"),s=(0,t.getOrThrow)(n.files,"integeruniquer.index"),i=(0,t.getOrThrow)(n.files,"integeruniquer.data"),o=new h(yield l(s)),a=new h(yield l(i));o.seek(32);let c=[];for(;o.hasMore();){const e=o.readUint32()+1048576*o.readUint32();if(0===e)continue;a.seek(e);let t=a.readUint32(),r=[];for(;t--;)r.push(a.readUint64());c.push(r)}return c})}function m(e){return s(this,void 0,void 0,function*(){const r=(0,t.getOrThrow)(e.files,"form.template"),n=y(yield l(r)),s=n["com.apple.xray.owner.template.version"];let i=1;"com.apple.xray.owner.template"in n&&(i=n["com.apple.xray.owner.template"].get("_selectedRunNumber"));let o=n.$1;"stubInfoByUUID"in n&&(o=Array.from(n.stubInfoByUUID.keys())[0]);const a=n["com.apple.xray.run.data"],c=[];for(let e of a.runNumbers){const r=(0,t.getOrThrow)(a.runData,e),n=(0,t.getOrThrow)(r,"symbolsByPid"),s=new Map;for(let i of n.values()){for(let e of i.symbols){if(!e)continue;const{sourcePath:r,symbolName:n,addressToLine:i}=e;for(let e of i.keys())(0,t.getOrInsert)(s,e,()=>{const s=n||`0x${(0,t.zeroPad)(e.toString(16),16)}`,i={key:`${r}:${s}`,name:s};return r&&(i.file=r),i})}c.push({number:e,addressToFrameMap:s})}}return{version:s,instrument:o,selectedRunNumber:i,runs:c}})}function w(e){return s(this,void 0,void 0,function*(){const t=yield c(e),{version:r,runs:n,instrument:s,selectedRunNumber:i}=yield m(t);if("com.apple.xray.instrument-type.coresampler2"!==s)throw new Error(`The only supported instrument from .trace import is "com.apple.xray.instrument-type.coresampler2". Got ${s}`);console.log("version: ",r),console.log("Importing time profile");const o=[];let a=0;for(let c of n){const{addressToFrameMap:r,number:n}=c,s=yield g({fileName:e.name,tree:t,addressToFrameMap:r,runNumber:n});c.number===i&&(a=o.length+s.indexToView),o.push(...s.profiles)}return{name:e.name,indexToView:a,profiles:o}})}function g(e){return s(this,void 0,void 0,function*(){const{fileName:r,tree:n,addressToFrameMap:s,runNumber:i}=e,o=f(n,i);let a=yield p(o);const c=yield d(a,o),l=new Map;for(let e of a)l.set(e.threadID,(0,t.getOrElse)(l,e.threadID,()=>0)+1);const u=Array.from(l.entries());(0,t.sortBy)(u,e=>-e[1]);const h=u.map(e=>e[0]);return{name:r,indexToView:0,profiles:h.map(e=>b({threadID:e,fileName:r,arrays:c,addressToFrameMap:s,samples:a}))}})}function b(n){let{fileName:s,addressToFrameMap:i,arrays:o,threadID:a,samples:c}=n;const l=new Map;c=c.filter(e=>e.threadID===a);const u=new e.StackListProfileBuilder((0,t.lastOf)(c).timestamp);function f(e,r){const n=i.get(e);if(n)r.push(n);else if(e in o)for(let t of o[e])f(t,r);else{const n={key:e,name:`0x${(0,t.zeroPad)(e.toString(16),16)}`};i.set(e,n),r.push(n)}}u.setName(`${s} - thread ${a}`);let h=null;for(let e of c){const r=(0,t.getOrInsert)(l,e.backtraceID,e=>{const t=[];return f(e,t),t.reverse(),t});if(null===h&&(u.appendSampleWithWeight([],e.timestamp),h=e.timestamp),e.timestamp{switch(e){case"NSTextStorage":case"NSParagraphStyle":case"NSFont":return null;case"PFTSymbolData":{const e=Object.create(null);e.symbolName=t.$0,e.sourcePath=t.$1,e.addressToLine=new Map;for(let r=3;;r+=2){const n=t["$"+r],s=t["$"+(r+1)];if(null==n||null==s)break;e.addressToLine.set(n,s)}return e}case"PFTOwnerData":{const e=Object.create(null);return e.ownerName=t.$0,e.ownerPath=t.$1,e}case"PFTPersistentSymbols":{const e=Object.create(null),r=t.$4;e.threadNames=t.$3,e.symbols=[];for(let n=1;ne)){if(1e5!==e.$version||"NSKeyedArchiver"!==e.$archiver||!S(e.$top)||!U(e.$objects))throw new Error("Invalid keyed archive");"$null"===e.$objects[0]&&(e.$objects[0]=null);for(let n=0;n{if(t instanceof x)return e.$objects[t.index];if(U(t))for(let e=0;ee)){if(S(t)&&t.$class){let n=N(e,t.$class).$classname;switch(n){case"NSDecimalNumberPlaceholder":{let e=t["NS.length"],r=t["NS.exponent"],n=t["NS.mantissa.bo"],s=t["NS.negative"],i=new Uint16Array(new Uint8Array(t["NS.mantissa"]).buffer),o=0;for(let t=0;t>8|(255&e)<<8),o+=e*Math.pow(65536,t)}return o*=Math.pow(10,r),s?-o:o}case"NSData":case"NSMutableData":return t["NS.bytes"]||t["NS.data"];case"NSString":case"NSMutableString":return t["NS.string"]?t["NS.string"]:t["NS.bytes"]?v(t["NS.bytes"]):(console.warn(`Unexpected ${n} format: `,t),null);case"NSArray":case"NSMutableArray":if("NS.objects"in t)return t["NS.objects"];let e=[];for(;;){let r="NS.object."+e.length;if(!(r in t))break;e.push(t[r])}return e;case"_NSKeyedCoderOldStyleArray":{const e=t["NS.count"];let r=[];for(let n=0;n>4){case 0:return this.parseSingleton(e,r);case 1:return this.parseInteger(e,1<({key:e,name:e})),duration:parseInt(i,10)})}return t}function r(r){const n=t(r),i=n.reduce((e,t)=>e+t.duration,0),o=new e.StackListProfileBuilder(i);if(0===n.length)return null;for(let e of n)o.appendSampleWithWeight(e.stack,e.duration);return o.build()} },{"../lib/profile":"YG8z"}],"uNW1":[function(require,module,exports) { @@ -49,7 +49,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"../lib/profile":"YG8z","../lib/utils":"ucYa","../lib/value-formatters":"LsM4"}],"QV03":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromV8ProfLog=n;var e=require("../lib/profile"),t=require("../lib/utils"),r=require("../lib/value-formatters");function a(e,t){if(!e||!e.type)return{key:"(unknown type)",name:"(unknown type)"};let r=e.name;switch(e.type){case"CPP":{const e=r.match(/[tT] ([^(<]*)/);e&&(r=`(c++) ${e[1]}`);break}case"SHARED_LIB":r="(LIB) "+r;break;case"JS":{const e=r.match(/([a-zA-Z0-9\._\-$]*) ([a-zA-Z0-9\.\-_\/$]*):(\d+):(\d+)/);if(e){const t=e[2],a=parseInt(e[3],10),n=parseInt(e[4],10);return{key:r,name:e[1].length>0?e[1]:t?`(anonymous ${t.split("/").pop()}:${a})`:"(anonymous)",file:t.length>0?t:"(unknown file)",line:a,col:n}}break}case"CODE":switch(e.kind){case"LoadIC":case"StoreIC":case"KeyedStoreIC":case"KeyedLoadIC":case"LoadGlobalIC":case"Handler":r="(IC) "+r;break;case"BytecodeHandler":r="(bytecode) ~"+r;break;case"Stub":r="(stub) "+r;break;case"Builtin":r="(builtin) "+r;break;case"RegExp":r="(regexp) "+r}break;default:r=`(${e.type}) ${r}`}return{key:r,name:r}}function n(n){const o=new e.StackListProfileBuilder,s=new Map;let c=0;(0,t.sortBy)(n.ticks,e=>e.tm);for(let e of n.ticks){const r=[];for(let o=e.s.length-2;o>=0;o-=2){const c=e.s[o];-1!==c&&(c>n.code.length?r.push({key:c,name:`0x${c.toString(16)}`}):r.push((i=c,(0,t.getOrInsert)(s,i,e=>a(n.code[e],n)))))}o.appendSampleWithWeight(r,e.tm-c),c=e.tm}var i;return o.setValueFormatter(new r.TimeFormatter("microseconds")),o.build()} },{"../lib/profile":"YG8z","../lib/utils":"ucYa","../lib/value-formatters":"LsM4"}],"f2sa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromLinuxPerf=l;var e=require("../lib/profile"),t=require("../lib/utils"),n=require("../lib/value-formatters");function s(e){const t=e.split("\n").filter(e=>!/^\s*#/.exec(e)),n={command:null,processID:null,threadID:null,time:null,eventType:"",stack:[]},s=t.shift();if(!s)return null;const r=/^(\S.+?)\s+(\d+)(?:\/?(\d+))?\s+/.exec(s);if(!r)return null;n.command=r[1],r[3]?(n.processID=parseInt(r[2],10),n.threadID=parseInt(r[3],10)):n.threadID=parseInt(r[2],10);const l=/\s+(\d+\.\d+):\s+/.exec(s);l&&(n.time=parseFloat(l[1]));const i=/(\S+):\s*$/.exec(s);i&&(n.eventType=i[1]);for(let o of t){const e=/^\s*(\w+)\s*(.+) \((\S*)\)/.exec(o);if(!e)continue;let[,t,s,r]=e;s=s.replace(/\+0x[\da-f]+$/,""),n.stack.push({address:`0x${t}`,symbolName:s,file:r})}return n.stack.reverse(),n}function r(e){const t=[];let n="";for(let s of e.splitLines())""===s?(n.length>0&&t.push(n),n=s):(n.length>0&&(n+="\n"),n+=s);return n.length>0&&t.push(n),t}function l(l){const i=new Map;let o=null;const a=r(l).map(s);for(let s of a){if(null==s)continue;if(null!=o&&o!=s.eventType)continue;if(null==s.time)continue;o=s.eventType;let r=[];s.command&&r.push(s.command),s.processID&&r.push(`pid: ${s.processID}`),s.threadID&&r.push(`tid: ${s.threadID}`);const l=r.join(" ");(0,t.getOrInsert)(i,l,()=>{const t=new e.StackListProfileBuilder;return t.setName(l),t.setValueFormatter(new n.TimeFormatter("seconds")),t}).appendSampleWithTimestamp(s.stack.map(({symbolName:e,file:t})=>({key:`${e} (${t})`,name:"[unknown]"===e?`??? (${t})`:e,file:t})),s.time)}return 0===i.size?null:{name:1===i.size?Array.from(i.keys())[0]:"",indexToView:0,profiles:Array.from((0,t.itMap)(i.values(),e=>e.build()))}} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromLinuxPerf=l;var e=require("../lib/profile"),t=require("../lib/utils"),n=require("../lib/value-formatters");function*r(e){let t=[];for(let n of e.splitLines())""===n?(yield s(t),t=[]):t.push(n);t.length>0&&(yield s(t))}function s(e){const t=e.filter(e=>!/^\s*#/.exec(e)),n={command:null,processID:null,threadID:null,time:null,eventType:"",stack:[]},r=t.shift();if(!r)return null;const s=/^(\S.+?)\s+(\d+)(?:\/?(\d+))?\s+/.exec(r);if(!s)return null;n.command=s[1],s[3]?(n.processID=parseInt(s[2],10),n.threadID=parseInt(s[3],10)):n.threadID=parseInt(s[2],10);const l=/\s+(\d+\.\d+):\s+/.exec(r);l&&(n.time=parseFloat(l[1]));const i=/(\S+):\s*$/.exec(r);i&&(n.eventType=i[1]);for(let o of t){const e=/^\s*(\w+)\s*(.+) \((\S*)\)/.exec(o);if(!e)continue;let[,t,r,s]=e;r=r.replace(/\+0x[\da-f]+$/,""),n.stack.push({address:`0x${t}`,symbolName:r,file:s})}return n.stack.reverse(),n}function l(s){const l=new Map;let i=null;for(let o of r(s)){if(null==o)continue;if(null!=i&&i!=o.eventType)continue;if(null==o.time)continue;i=o.eventType;let r=[];o.command&&r.push(o.command),o.processID&&r.push(`pid: ${o.processID}`),o.threadID&&r.push(`tid: ${o.threadID}`);const s=r.join(" ");(0,t.getOrInsert)(l,s,()=>{const t=new e.StackListProfileBuilder;return t.setName(s),t.setValueFormatter(new n.TimeFormatter("seconds")),t}).appendSampleWithTimestamp(o.stack.map(({symbolName:e,file:t})=>({key:`${e} (${t})`,name:"[unknown]"===e?`??? (${t})`:e,file:t})),o.time)}return 0===l.size?null:{name:1===l.size?Array.from(l.keys())[0]:"",indexToView:0,profiles:Array.from((0,t.itMap)(l.values(),e=>e.build()))}} },{"../lib/profile":"YG8z","../lib/utils":"ucYa","../lib/value-formatters":"LsM4"}],"jm73":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromHaskell=l;var e=require("../lib/profile"),r=require("../lib/value-formatters");function t(e,r,l,o,i){if(0===e.ticks&&0===e.entries&&0===e.alloc&&0===e.children.length)return r;let a=r,s=o.get(e.id);l.enterFrame(s,a);for(let n of e.children)a=t(n,a,l,o,i);return a+=i(e),l.leaveFrame(s,a),a}function l(l){const o=new Map;for(let e of l.cost_centres){const r={key:e.id,name:`${e.module}.${e.label}`};e.src_loc.startsWith("<")||(r.file=e.src_loc),o.set(e.id,r)}const i=new e.CallTreeProfileBuilder(l.total_ticks);t(l.profile,0,i,o,e=>e.ticks),i.setValueFormatter(new r.TimeFormatter("milliseconds")),i.setName(`${l.program} time`);const a=new e.CallTreeProfileBuilder(l.total_ticks);return t(l.profile,0,a,o,e=>e.alloc),a.setValueFormatter(new r.ByteFormatter),a.setName(`${l.program} allocation`),{name:l.program,indexToView:0,profiles:[i.build(),a.build()]}} },{"../lib/profile":"YG8z","../lib/value-formatters":"LsM4"}],"jP3w":[function(require,module,exports) { @@ -114,8 +114,10 @@ module.exports=t;var i=null;try{i=new WebAssembly.Instance(new WebAssembly.Modul },{"../lib/profile":"YG8z","../lib/utils":"ucYa","../lib/value-formatters":"LsM4"}],"KFvE":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isTraceEventFormatted=m,exports.importTraceEvents=g;var e=require("../lib/utils"),t=require("../lib/profile"),n=require("../lib/value-formatters");function r(t,n){return`${(0,e.zeroPad)(""+t,10)}:${(0,e.zeroPad)(""+n,10)}`}function s(t){const n=new Map;for(let s of t){(0,e.getOrInsert)(n,r(s.pid,s.tid),()=>[]).push(s)}return n}function o(e,t){if(0===e.length&&0===t.length)throw new Error("This method should not be given both queues empty");if(0===t.length)return"B";if(0===e.length)return"E";const n=e[0],r=t[0],s=n.ts,o=r.ts;return s0){let t=Number.MAX_SAFE_INTEGER;for(let n of e)t=Math.min(t,n.ts);for(let n of e)n.ts-=t}const r=[];for(let a of e)switch(a.ph){case"B":t.push(a);break;case"E":n.push(a);break;case"X":r.push(a);break;default:return a}function s(e){var t,n;return null!==(n=null!==(t=e.dur)&&void 0!==t?t:e.tdur)&&void 0!==n?n:0}r.sort((e,t)=>{if(e.tst.ts)return 1;const n=s(e),r=s(t);return n>r?-1:nt.ts?1:0}return t.sort(o),n.sort(o),[t,n]}function i(e){const t=[];for(let n of e)switch(n.ph){case"B":case"E":case"X":t.push(n)}return t}function u(e){const t=new Map;for(let n of e)"M"===n.ph&&"process_name"===n.name&&n.args&&n.args.name&&t.set(n.pid,n.args.name);return t}function c(e){const t=new Map;for(let n of e)"M"===n.ph&&"thread_name"===n.name&&n.args&&n.args.name&&t.set(r(n.pid,n.tid),n.args.name);return t}function f(e){let t=`${e.name||"(unnamed)"}`;return e.args&&(t+=` ${JSON.stringify(e.args)}`),t}function l(e){const t=f(e);return{name:t,key:t}}function h(f){const h=s(i(f)),d=u(f),p=c(f),m=[];return h.forEach(s=>{if(0===s.length)return;const{pid:i,tid:u}=s[0],c=new t.CallTreeProfileBuilder;c.setValueFormatter(new n.TimeFormatter("microseconds"));const f=d.get(i),h=p.get(r(i,u));null!=f&&null!=h?c.setName(`${f} (pid ${i}), ${h} (tid ${u})`):null!=f?c.setName(`${f} (pid ${i}, tid ${u})`):null!=h?c.setName(`${h} (pid ${i}, tid ${u})`):c.setName(`pid ${i}, tid ${u}`);const[g,$]=a(s),k=[],b=e=>{k.push(e),c.enterFrame(l(e),e.ts)},w=t=>{const n=(0,e.lastOf)(k);if(null==n)return void console.warn(`Tried to end frame "${l(t).key}", but the stack was empty. Doing nothing instead.`);const r=l(t),s=l(n);t.name===n.name?(r.key!==s.key&&console.warn(`ts=${t.ts}: Tried to end "${r.key}" when "${s.key}" was on the top of the stack. Ending ${s.key} instead.`),k.pop(),c.leaveFrame(s,t.ts)):console.warn(`ts=${t.ts}: Tried to end "${r.key}" when "${s.key}" was on the top of the stack. Doing nothing instead.`)};for(;g.length>0||$.length>0;){const t=o(g,$);switch(t){case"B":b(g.shift());break;case"E":{const t=(0,e.lastOf)(k);if(null!=t){const e=l(t);let n=!1;for(let t=1;t<$.length;t++){const r=$[t];if(r.ts>$[0].ts)break;const s=l(r);if(e.key===s.key){const e=$[0];$[0]=$[t],$[t]=e,n=!0;break}}if(!n)for(let r=1;r<$.length;r++){const e=$[r];if(e.ts>$[0].ts)break;if(e.name===t.name){const e=$[0];$[0]=$[r],$[r]=e,n=!0;break}}}w($.shift());break}default:return t}}for(let e=k.length-1;e>=0;e--){const t=l(k[e]);console.warn(`Frame "${t.key}" was still open at end of profile. Closing automatically.`),c.leaveFrame(t,c.getTotalWeight())}m.push([r(i,u),c.build()])}),(0,e.sortBy)(m,e=>e[0]),{name:"",indexToView:0,profiles:m.map(e=>e[1])}}function d(e){if(!Array.isArray(e))return!1;if(0===e.length)return!1;for(let t of e){if(!("ph"in t))return!1;switch(t.ph){case"B":case"E":case"X":if(!("ts"in t))return!1}}return!0}function p(e){return"traceEvents"in e&&d(e.traceEvents)}function m(e){return p(e)||d(e)}function g(e){if(p(e))return h(e.traceEvents);if(d(e))return h(e);return e} },{"../lib/utils":"ucYa","../lib/profile":"YG8z","../lib/value-formatters":"LsM4"}],"TZYa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromCallgrind=r;var e=require("../lib/profile"),t=require("../lib/utils"),i=require("../lib/value-formatters");class s{constructor(e,i){this.fileName=e,this.fieldName=i,this.frameSet=new t.KeyedSet,this.totalWeights=new Map,this.childrenTotalWeights=new Map}getOrInsertFrame(t){return e.Frame.getOrInsert(this.frameSet,t)}addToTotalWeight(e,t){this.totalWeights.has(e)?this.totalWeights.set(e,this.totalWeights.get(e)+t):this.totalWeights.set(e,t)}addSelfWeight(e,t){this.addToTotalWeight(this.getOrInsertFrame(e),t)}addChildWithTotalWeight(e,i,s){const n=this.getOrInsertFrame(e),r=this.getOrInsertFrame(i),a=(0,t.getOrInsert)(this.childrenTotalWeights,n,e=>new Map);a.has(r)?a.set(r,a.get(r)+s):a.set(r,s),this.addToTotalWeight(n,s)}toProfile(){const s=new e.CallTreeProfileBuilder;let n=1;"Time_(10ns)"===this.fieldName?(s.setName(`${this.fileName} -- Time`),n=10,s.setValueFormatter(new i.TimeFormatter("nanoseconds"))):"Memory_(bytes)"==this.fieldName?(s.setName(`${this.fileName} -- Memory`),s.setValueFormatter(new i.ByteFormatter)):s.setName(`${this.fileName} -- ${this.fieldName}`);let r=0;const a=new Set;let l=0;for(let[e,t]of this.totalWeights)l=Math.max(l,t);const o=(e,i)=>{if(a.has(e))return;if(i<1e-4*l)return;const h=(0,t.getOrElse)(this.totalWeights,e,()=>0);if(0===h)return;let m=i;s.enterFrame(e,Math.round(r*n)),a.add(e);for(let[t,s]of this.childrenTotalWeights.get(e)||[]){let e=r;o(t,i*(s/h)),m-=r-e}a.delete(e),r+=m,s.leaveFrame(e,Math.round(r*n))},h=new Set(this.frameSet);for(let[e,t]of this.childrenTotalWeights)for(let[i,s]of t)h.delete(i);for(let e of h)o(e,this.totalWeights.get(e));return s.build()}}class n{constructor(e,t){this.importedFileName=t,this.callGraphs=null,this.eventsLine=null,this.filename=null,this.functionName=null,this.calleeFilename=null,this.calleeFunctionName=null,this.savedFileNames={},this.savedFunctionNames={},this.prevCostLineNumbers=[],this.lines=e.splitLines(),this.lineNum=0}parse(){for(;this.lineNume.toProfile())}:null}frameInfo(){const e=this.filename||"(unknown)",t=this.functionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}calleeFrameInfo(){const e=this.calleeFilename||this.filename||"(unknown)",t=this.calleeFunctionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}parseHeaderLine(e){const t=/^\s*(\w+):\s*(.*)+$/.exec(e);if(!t)return!1;if("events"!==t[1])return!0;const i=t[2].split(" ");if(null!=this.callGraphs)throw new Error(`Duplicate "events: " lines specified. First was "${this.eventsLine}", now received "${e}" on ${this.lineNum}.`);return this.callGraphs=i.map(e=>new s(this.importedFileName,e)),!0}parseAssignmentLine(e){const t=/^(\w+)=\s*(.*)$/.exec(e);if(!t)return!1;const i=t[1],s=t[2];switch(i){case"fe":case"fi":this.parseNameWithCompression(s,this.savedFileNames);break;case"fl":this.filename=this.parseNameWithCompression(s,this.savedFileNames);break;case"fn":this.functionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"cfi":case"cfl":this.calleeFilename=this.parseNameWithCompression(s,this.savedFileNames);break;case"cfn":this.calleeFunctionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"calls":this.parseCostLine(this.lines[this.lineNum++],"child"),this.calleeFilename=null,this.calleeFunctionName=null;break;case"cob":case"ob":break;default:console.log(`Ignoring assignment to unrecognized key "${e}" on line ${this.lineNum}`)}return!0}parseNameWithCompression(e,t){{const i=/^\((\d+)\)\s*(.+)$/.exec(e);if(i){const e=i[1],s=i[2];if(e in t)throw new Error(`Redefinition of name with id: ${e}. Original value was "${t[e]}". Tried to redefine as "${s}" on line ${this.lineNum}.`);return t[e]=s,s}}{const i=/^\((\d+)\)$/.exec(e);if(i){const e=i[1];if(!(e in t))throw new Error(`Tried to use name with id ${e} on line ${this.lineNum} before it was defined.`);return t[e]}}return e}parseCostLine(e,t){const i=e.split(/\s+/),s=[];for(let n=0;nnew Map);a.has(r)?a.set(r,a.get(r)+s):a.set(r,s),this.addToTotalWeight(n,s)}toProfile(){const s=new e.CallTreeProfileBuilder;let n=1;"Time_(10ns)"===this.fieldName?(s.setName(`${this.fileName} -- Time`),n=10,s.setValueFormatter(new i.TimeFormatter("nanoseconds"))):"Memory_(bytes)"==this.fieldName?(s.setName(`${this.fileName} -- Memory`),s.setValueFormatter(new i.ByteFormatter)):s.setName(`${this.fileName} -- ${this.fieldName}`);let r=0;const a=new Set;let l=0;for(let[e,t]of this.totalWeights)l=Math.max(l,t);const o=(e,i)=>{if(a.has(e))return;if(i<1e-4*l)return;const h=(0,t.getOrElse)(this.totalWeights,e,()=>0);if(0===h)return;let m=i;s.enterFrame(e,Math.round(r*n)),a.add(e);for(let[t,s]of this.childrenTotalWeights.get(e)||[]){let e=r;o(t,i*(s/h)),m-=r-e}a.delete(e),r+=m,s.leaveFrame(e,Math.round(r*n))},h=new Set(this.frameSet);for(let[e,t]of this.childrenTotalWeights)for(let[i,s]of t)h.delete(i);for(let e of h)o(e,this.totalWeights.get(e));return s.build()}}class n{constructor(e,t){this.importedFileName=t,this.callGraphs=null,this.eventsLine=null,this.filename=null,this.functionName=null,this.calleeFilename=null,this.calleeFunctionName=null,this.savedFileNames={},this.savedFunctionNames={},this.prevCostLineNumbers=[],this.lines=[...e.splitLines()],this.lineNum=0}parse(){for(;this.lineNume.toProfile())}:null}frameInfo(){const e=this.filename||"(unknown)",t=this.functionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}calleeFrameInfo(){const e=this.calleeFilename||this.filename||"(unknown)",t=this.calleeFunctionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}parseHeaderLine(e){const t=/^\s*(\w+):\s*(.*)+$/.exec(e);if(!t)return!1;if("events"!==t[1])return!0;const i=t[2].split(" ");if(null!=this.callGraphs)throw new Error(`Duplicate "events: " lines specified. First was "${this.eventsLine}", now received "${e}" on ${this.lineNum}.`);return this.callGraphs=i.map(e=>new s(this.importedFileName,e)),!0}parseAssignmentLine(e){const t=/^(\w+)=\s*(.*)$/.exec(e);if(!t)return!1;const i=t[1],s=t[2];switch(i){case"fe":case"fi":this.parseNameWithCompression(s,this.savedFileNames);break;case"fl":this.filename=this.parseNameWithCompression(s,this.savedFileNames);break;case"fn":this.functionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"cfi":case"cfl":this.calleeFilename=this.parseNameWithCompression(s,this.savedFileNames);break;case"cfn":this.calleeFunctionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"calls":this.parseCostLine(this.lines[this.lineNum++],"child"),this.calleeFilename=null,this.calleeFunctionName=null;break;case"cob":case"ob":break;default:console.log(`Ignoring assignment to unrecognized key "${e}" on line ${this.lineNum}`)}return!0}parseNameWithCompression(e,t){{const i=/^\((\d+)\)\s*(.+)$/.exec(e);if(i){const e=i[1],s=i[2];if(e in t)throw new Error(`Redefinition of name with id: ${e}. Original value was "${t[e]}". Tried to redefine as "${s}" on line ${this.lineNum}.`);return t[e]=s,s}}{const i=/^\((\d+)\)$/.exec(e);if(i){const e=i[1];if(!(e in t))throw new Error(`Tried to use name with id ${e} on line ${this.lineNum} before it was defined.`);return t[e]}}return e}parseCostLine(e,t){const i=e.split(/\s+/),s=[];for(let n=0;n!/^$|^Log closed$|log opened/.exec(e));let s=-1;const o=I(l[0]);if(null===o)throw Error;s=o.at;const i=(0,t.lastOf)(l);if(null===i)throw Error;const c=I(i);if(null===c)throw Error;const u=c.at,f=new t.KeyedSet,h=[];let m,p=0,v=-1;function d(t,n,r){function l(t,n){h.push(n),a.enterFrame(e.Frame.getOrInsert(f,{name:n,key:n}),t),p=t}v>-1&&(v=-1,m===r&&v>=p&&d(t,v,`QUEUE ${r}`));const s=`STACK ${t}`;[...h].reverse().find(e=>e.startsWith("STACK "))!==s&&(1===h.length&&g(p),l(n,s)),l(n,r)}function g(n){const r=h.pop();if(void 0===r)throw Error("Tried to leave frame when nothing was on stack.");a.leaveFrame(e.Frame.getOrInsert(f,{name:r,key:r}),n);let l=(0,t.lastOf)(h);null!==l&&l.startsWith("QUEUE ")&&(g(n),l=(0,t.lastOf)(h)),h.length>1&&null!==l&&l.startsWith("STACK ")&&g(n),p=n}function w(e,n,r){(0,t.lastOf)(h)===r?g(n):0===p?(console.log(`Tried to leave frame "${r}" which was never entered. Assuming it has been running since the start.`),d(e,0,r),g(n)):console.log(`Tried to leave frame "${r}" which was never entered. Other events have happened since the start, ignoring line.`)}function I(e){if(void 0===e)throw Error("Probably tried to import empty file.");const t=e.split(":");return t.length<3?null:-1!==s?{at:parseInt(t[0])-s,event:t[1],stackInt:parseInt(t[2]),name:t[5]}:{at:parseInt(t[0]),event:t[1],stackInt:parseInt(t[2]),name:t[5]}}for(l.forEach((e,t,n)=>{const r=I(e);if(null!==r)if("PUSH"===r.event){d(r.stackInt,r.at,r.name);let e=I(n[t+=1]);for(;null!==e&&e.at===r.at;)e.name===r.name&&e.stackInt===r.stackInt&&"POP"===e.event?(w(e.stackInt,e.at,e.name),n.splice(t,1),e=null):(t+=1)0;)g(u);return a.build()} },{"../lib/profile":"YG8z","../lib/utils":"ucYa","../lib/value-formatters":"LsM4"}],"uRa7":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importProfileGroupFromText=F,exports.importProfileGroupFromBase64=C,exports.importProfilesFromFile=I,exports.importProfilesFromArrayBuffer=v,exports.importFromFileSystemDirectoryEntry=S;var e=require("./chrome"),r=require("./stackprof"),o=require("./instruments"),i=require("./bg-flamegraph"),t=require("./firefox"),n=require("../lib/file-format"),s=require("./v8proflog"),l=require("./linux-tools-perf"),m=require("./haskell"),p=require("./safari"),a=require("./utils"),f=require("./pprof"),c=require("../lib/utils"),u=require("./v8heapalloc"),d=require("./trace-event"),g=require("./callgrind"),h=function(e,r,o,i){return new(o||(o=Promise))(function(t,n){function s(e){try{m(i.next(e))}catch(r){n(r)}}function l(e){try{m(i.throw(e))}catch(r){n(r)}}function m(e){var r;e.done?t(e.value):(r=e.value,r instanceof o?r:new o(function(e){e(r)})).then(s,l)}m((i=i.apply(e,r||[])).next())})};function F(e,r){return h(this,void 0,void 0,function*(){return yield x(new a.TextProfileDataSource(e,r))})}function C(e,r){return h(this,void 0,void 0,function*(){return yield x(a.MaybeCompressedDataReader.fromArrayBuffer(e,(0,c.decodeBase64)(r).buffer))})}function I(e){return h(this,void 0,void 0,function*(){return x(a.MaybeCompressedDataReader.fromFile(e))})}function v(e,r){return h(this,void 0,void 0,function*(){return x(a.MaybeCompressedDataReader.fromArrayBuffer(e,r))})}function x(e){return h(this,void 0,void 0,function*(){const r=yield e.name(),o=yield P(e);if(o){o.name||(o.name=r);for(let e of o.profiles)e&&!e.getName()&&e.setName(r);return o}return null})}function y(e){return e?{name:e.getName(),indexToView:0,profiles:[e]}:null}function P(a){return h(this,void 0,void 0,function*(){const c=yield a.name(),h=yield a.readAsArrayBuffer();{const e=(0,f.importAsPprofProfile)(h);if(e)return console.log("Importing as protobuf encoded pprof file"),y(e)}const F=yield a.readAsText();if(c.endsWith(".speedscope.json"))return console.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(F.parseAsJSON());if(/Trace-\d{8}T\d{6}/.exec(c))return console.log("Importing as Chrome Timeline Object"),(0,e.importFromChromeTimeline)(F.parseAsJSON().traceEvents,c);if(c.endsWith(".chrome.json")||/Profile-\d{8}T\d{6}/.exec(c))return console.log("Importing as Chrome Timeline"),(0,e.importFromChromeTimeline)(F.parseAsJSON(),c);if(c.endsWith(".stackprof.json"))return console.log("Importing as stackprof profile"),y((0,r.importFromStackprof)(F.parseAsJSON()));if(c.endsWith(".instruments.txt"))return console.log("Importing as Instruments.app deep copy"),y((0,o.importFromInstrumentsDeepCopy)(F));if(c.endsWith(".linux-perf.txt"))return console.log("Importing as output of linux perf script"),(0,l.importFromLinuxPerf)(F);if(c.endsWith(".collapsedstack.txt"))return console.log("Importing as collapsed stack format"),y((0,i.importFromBGFlameGraph)(F));if(c.endsWith(".v8log.json"))return console.log("Importing as --prof-process v8 log"),y((0,s.importFromV8ProfLog)(F.parseAsJSON()));if(c.endsWith(".heapprofile"))return console.log("Importing as Chrome Heap Profile"),y((0,u.importFromChromeHeapProfile)(F.parseAsJSON()));if(c.endsWith("-recording.json"))return console.log("Importing as Safari profile"),y((0,p.importFromSafari)(F.parseAsJSON()));if(c.startsWith("callgrind."))return console.log("Importing as Callgrind profile"),(0,g.importFromCallgrind)(F,c);let C;try{C=F.parseAsJSON()}catch(I){}if(C){if("https://www.speedscope.app/file-format-schema.json"===C.$schema)return console.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(C);if(C.systemHost&&"Firefox"==C.systemHost.name)return console.log("Importing as Firefox profile"),y((0,t.importFromFirefox)(C));if((0,e.isChromeTimeline)(C))return console.log("Importing as Chrome Timeline"),(0,e.importFromChromeTimeline)(C,c);if((0,e.isChromeTimelineObject)(C))return console.log("Importing as Chrome Timeline Object"),(0,e.importFromChromeTimeline)(C.traceEvents,c);if("nodes"in C&&"samples"in C&&"timeDeltas"in C)return console.log("Importing as Chrome CPU Profile"),y((0,e.importFromChromeCPUProfile)(C));if((0,d.isTraceEventFormatted)(C))return console.log("Importing as Trace Event Format profile"),(0,d.importTraceEvents)(C);if("head"in C&&"samples"in C&&"timestamps"in C)return console.log("Importing as Chrome CPU Profile (old format)"),y((0,e.importFromOldV8CPUProfile)(C));if("mode"in C&&"frames"in C&&"raw_timestamp_deltas"in C)return console.log("Importing as stackprof profile"),y((0,r.importFromStackprof)(C));if("code"in C&&"functions"in C&&"ticks"in C)return console.log("Importing as --prof-process v8 log"),y((0,s.importFromV8ProfLog)(C));if("head"in C&&"selfSize"in C.head)return console.log("Importing as Chrome Heap Profile"),y((0,u.importFromChromeHeapProfile)(C));if("rts_arguments"in C&&"initial_capabilities"in C)return console.log("Importing as Haskell GHC JSON Profile"),(0,m.importFromHaskell)(C);if("recording"in C&&"sampleStackTraces"in C.recording)return console.log("Importing as Safari profile"),y((0,p.importFromSafari)(C))}else{if(/^# callgrind format/.exec(F.firstChunk())||/^events:/m.exec(F.firstChunk())&&/^fn=/m.exec(F.firstChunk()))return console.log("Importing as Callgrind profile"),(0,g.importFromCallgrind)(F,c);if(/^[\w \t\(\)]*\tSymbol Name/.exec(F.firstChunk()))return console.log("Importing as Instruments.app deep copy"),y((0,o.importFromInstrumentsDeepCopy)(F));const e=(0,l.importFromLinuxPerf)(F);if(e)return console.log("Importing from linux perf script output"),e;const r=(0,i.importFromBGFlameGraph)(F);if(r)return console.log("Importing as collapsed stack format"),y(r)}return null})}function S(e){return h(this,void 0,void 0,function*(){return(0,o.importFromInstrumentsTrace)(e)})} -},{"./chrome":"kWV1","./stackprof":"I37H","./instruments":"G28U","./bg-flamegraph":"flbo","./firefox":"uNW1","../lib/file-format":"Xzb6","./v8proflog":"QV03","./linux-tools-perf":"f2sa","./haskell":"jm73","./safari":"jP3w","./utils":"QTYz","./pprof":"VmHy","../lib/utils":"ucYa","./v8heapalloc":"bNW7","./trace-event":"KFvE","./callgrind":"TZYa"}]},{},[], null) -//# sourceMappingURL=import.f56540a0.js.map \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importProfileGroupFromText=C,exports.importProfileGroupFromBase64=I,exports.importProfilesFromFile=x,exports.importProfilesFromArrayBuffer=y,exports.importFromFileSystemDirectoryEntry=T;var r=require("./chrome"),e=require("./stackprof"),o=require("./instruments"),i=require("./bg-flamegraph"),t=require("./firefox"),n=require("../lib/file-format"),s=require("./v8proflog"),l=require("./linux-tools-perf"),m=require("./haskell"),p=require("./safari"),a=require("./utils"),f=require("./pprof"),c=require("../lib/utils"),u=require("./v8heapalloc"),d=require("./trace-event"),g=require("./callgrind"),h=require("./papyrus"),F=function(r,e,o,i){return new(o||(o=Promise))(function(t,n){function s(r){try{m(i.next(r))}catch(e){n(e)}}function l(r){try{m(i.throw(r))}catch(e){n(e)}}function m(r){var e;r.done?t(r.value):(e=r.value,e instanceof o?e:new o(function(r){r(e)})).then(s,l)}m((i=i.apply(r,e||[])).next())})};function C(r,e){return F(this,void 0,void 0,function*(){return yield P(new a.TextProfileDataSource(r,e))})}function I(r,e){return F(this,void 0,void 0,function*(){return yield P(a.MaybeCompressedDataReader.fromArrayBuffer(r,(0,c.decodeBase64)(e).buffer))})}function x(r){return F(this,void 0,void 0,function*(){return P(a.MaybeCompressedDataReader.fromFile(r))})}function y(r,e){return F(this,void 0,void 0,function*(){return P(a.MaybeCompressedDataReader.fromArrayBuffer(r,e))})}function P(r){return F(this,void 0,void 0,function*(){const e=yield r.name(),o=yield S(r);if(o){o.name||(o.name=e);for(let r of o.profiles)r&&!r.getName()&&r.setName(e);return o}return null})}function v(r){return r?{name:r.getName(),indexToView:0,profiles:[r]}:null}function S(a){return F(this,void 0,void 0,function*(){const c=yield a.name(),F=yield a.readAsArrayBuffer();{const r=(0,f.importAsPprofProfile)(F);if(r)return console.log("Importing as protobuf encoded pprof file"),v(r)}const C=yield a.readAsText();if(c.endsWith(".speedscope.json"))return console.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(C.parseAsJSON());if(/Trace-\d{8}T\d{6}/.exec(c))return console.log("Importing as Chrome Timeline Object"),(0,r.importFromChromeTimeline)(C.parseAsJSON().traceEvents,c);if(c.endsWith(".chrome.json")||/Profile-\d{8}T\d{6}/.exec(c))return console.log("Importing as Chrome Timeline"),(0,r.importFromChromeTimeline)(C.parseAsJSON(),c);if(c.endsWith(".stackprof.json"))return console.log("Importing as stackprof profile"),v((0,e.importFromStackprof)(C.parseAsJSON()));if(c.endsWith(".instruments.txt"))return console.log("Importing as Instruments.app deep copy"),v((0,o.importFromInstrumentsDeepCopy)(C));if(c.endsWith(".linux-perf.txt"))return console.log("Importing as output of linux perf script"),(0,l.importFromLinuxPerf)(C);if(c.endsWith(".collapsedstack.txt"))return console.log("Importing as collapsed stack format"),v((0,i.importFromBGFlameGraph)(C));if(c.endsWith(".v8log.json"))return console.log("Importing as --prof-process v8 log"),v((0,s.importFromV8ProfLog)(C.parseAsJSON()));if(c.endsWith(".heapprofile"))return console.log("Importing as Chrome Heap Profile"),v((0,u.importFromChromeHeapProfile)(C.parseAsJSON()));if(c.endsWith("-recording.json"))return console.log("Importing as Safari profile"),v((0,p.importFromSafari)(C.parseAsJSON()));if(c.startsWith("callgrind."))return console.log("Importing as Callgrind profile"),(0,g.importFromCallgrind)(C,c);let I;try{I=C.parseAsJSON()}catch(x){}if(I){if("https://www.speedscope.app/file-format-schema.json"===I.$schema)return console.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(I);if(I.systemHost&&"Firefox"==I.systemHost.name)return console.log("Importing as Firefox profile"),v((0,t.importFromFirefox)(I));if((0,r.isChromeTimeline)(I))return console.log("Importing as Chrome Timeline"),(0,r.importFromChromeTimeline)(I,c);if((0,r.isChromeTimelineObject)(I))return console.log("Importing as Chrome Timeline Object"),(0,r.importFromChromeTimeline)(I.traceEvents,c);if("nodes"in I&&"samples"in I&&"timeDeltas"in I)return console.log("Importing as Chrome CPU Profile"),v((0,r.importFromChromeCPUProfile)(I));if((0,d.isTraceEventFormatted)(I))return console.log("Importing as Trace Event Format profile"),(0,d.importTraceEvents)(I);if("head"in I&&"samples"in I&&"timestamps"in I)return console.log("Importing as Chrome CPU Profile (old format)"),v((0,r.importFromOldV8CPUProfile)(I));if("mode"in I&&"frames"in I&&"raw_timestamp_deltas"in I)return console.log("Importing as stackprof profile"),v((0,e.importFromStackprof)(I));if("code"in I&&"functions"in I&&"ticks"in I)return console.log("Importing as --prof-process v8 log"),v((0,s.importFromV8ProfLog)(I));if("head"in I&&"selfSize"in I.head)return console.log("Importing as Chrome Heap Profile"),v((0,u.importFromChromeHeapProfile)(I));if("rts_arguments"in I&&"initial_capabilities"in I)return console.log("Importing as Haskell GHC JSON Profile"),(0,m.importFromHaskell)(I);if("recording"in I&&"sampleStackTraces"in I.recording)return console.log("Importing as Safari profile"),v((0,p.importFromSafari)(I))}else{if(/^# callgrind format/.exec(C.firstChunk())||/^events:/m.exec(C.firstChunk())&&/^fn=/m.exec(C.firstChunk()))return console.log("Importing as Callgrind profile"),(0,g.importFromCallgrind)(C,c);if(/^[\w \t\(\)]*\tSymbol Name/.exec(C.firstChunk()))return console.log("Importing as Instruments.app deep copy"),v((0,o.importFromInstrumentsDeepCopy)(C));if(/^(Stack_|Script_|Obj_)\S+ log opened \(PC\)\n/.exec(C.firstChunk()))return console.log("Importing as Papyrus profile"),v((0,h.importFromPapyrus)(C));const r=(0,l.importFromLinuxPerf)(C);if(r)return console.log("Importing from linux perf script output"),r;const e=(0,i.importFromBGFlameGraph)(C);if(e)return console.log("Importing as collapsed stack format"),v(e)}return null})}function T(r){return F(this,void 0,void 0,function*(){return(0,o.importFromInstrumentsTrace)(r)})} +},{"./chrome":"kWV1","./stackprof":"I37H","./instruments":"G28U","./bg-flamegraph":"flbo","./firefox":"uNW1","../lib/file-format":"Xzb6","./v8proflog":"QV03","./linux-tools-perf":"f2sa","./haskell":"jm73","./safari":"jP3w","./utils":"QTYz","./pprof":"VmHy","../lib/utils":"ucYa","./v8heapalloc":"bNW7","./trace-event":"KFvE","./callgrind":"TZYa","./papyrus":"duFC"}]},{},[], null) +//# sourceMappingURL=import.8ae8aa3d.js.map \ No newline at end of file diff --git a/deps/speedscope/speedscope.0d51a4b1.js b/deps/speedscope/speedscope.f27db165.js similarity index 97% rename from deps/speedscope/speedscope.0d51a4b1.js rename to deps/speedscope/speedscope.f27db165.js index 530e8cb1..fbbf625e 100644 --- a/deps/speedscope/speedscope.0d51a4b1.js +++ b/deps/speedscope/speedscope.f27db165.js @@ -126,7 +126,7 @@ var e=arguments[3];function t(e){r.length||(n(),a=!0),r[r.length]=e}module.expor },{"./rectangle-batch-renderer":"UGJH","../lib/math":"tDuZ","../lib/color":"x77Y","../lib/utils":"ucYa","./graphics":"XGYN","./utils":"MMP6"}],"jZ6t":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFlamechartStyle=void 0;var e=require("aphrodite"),o=require("./style"),r=require("./themes/theme");const t=(0,r.withTheme)(r=>e.StyleSheet.create({hoverCount:{color:r.weightColor},fill:{width:"100%",height:"100%",position:"absolute",left:0,top:0},minimap:{height:o.Sizes.MINIMAP_HEIGHT,borderBottom:`${o.Sizes.SEPARATOR_HEIGHT}px solid ${r.fgSecondaryColor}`},panZoomView:{flex:1},detailView:{display:"grid",height:o.Sizes.DETAIL_VIEW_HEIGHT,overflow:"hidden",gridTemplateColumns:"120px 120px 1fr",gridTemplateRows:"repeat(4, 1fr)",borderTop:`${o.Sizes.SEPARATOR_HEIGHT}px solid ${r.fgSecondaryColor}`,fontSize:o.FontSize.LABEL,position:"absolute",background:r.bgPrimaryColor,width:"100vw",bottom:0},stackTraceViewPadding:{padding:5},stackTraceView:{height:o.Sizes.DETAIL_VIEW_HEIGHT,lineHeight:`${o.FontSize.LABEL+2}px`,overflow:"auto","::-webkit-scrollbar":{background:r.bgPrimaryColor},"::-webkit-scrollbar-thumb":{background:r.fgSecondaryColor,borderRadius:20,border:`3px solid ${r.bgPrimaryColor}`,":hover":{background:r.fgPrimaryColor}}},stackLine:{whiteSpace:"nowrap"},stackFileLine:{color:r.fgSecondaryColor},statsTable:{display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:`repeat(3, ${o.FontSize.LABEL+10}px)`,gridGap:"1px 1px",textAlign:"center",paddingRight:1},statsTableHeader:{gridColumn:"1 / 3"},statsTableCell:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center"},thisInstanceCell:{background:r.selectionPrimaryColor,color:r.altFgPrimaryColor},allInstancesCell:{background:r.selectionSecondaryColor,color:r.altFgPrimaryColor},barDisplay:{position:"absolute",top:0,left:0,background:"rgba(0, 0, 0, 0.2)",width:"100%"}}));exports.getFlamechartStyle=t; },{"aphrodite":"CxN7","./style":"hvr4","./themes/theme":"gzKG"}],"eeWS":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.cachedMeasureTextWidth=i,exports.buildTrimmedText=s,exports.trimTextMid=h,exports.remapRangesToTrimmedText=o,exports.ELLIPSIS=void 0;var e=require("./utils");const t="…";exports.ELLIPSIS=t;const n=new Map;let r=-1;function i(e,t){return window.devicePixelRatio!==r&&(n.clear(),r=window.devicePixelRatio),n.has(t)||n.set(t,e.measureText(t).width),n.get(t)}function s(e,n){if(e.length<=n)return{trimmedString:e,trimmedLength:e.length,prefixLength:e.length,suffixLength:0,originalString:e,originalLength:e.length};let r=Math.floor(n/2);const i=n-r-1,s=e.substr(0,r),h=e.substr(e.length-i,i),g=s+t+h;return{trimmedString:g,trimmedLength:g.length,prefixLength:s.length,suffixLength:h.length,originalString:e,originalLength:e.length}}function h(t,n,r){if(i(t,n)<=r)return s(n,n.length);const[h]=(0,e.findValueBisect)(0,n.length,e=>i(t,s(n,e).trimmedString),r);return s(n,h)}var g;function a(e,t){return ti(t,s(n,Math.floor(e)).trimmedString),r);return s(n,Math.floor(h))}var g;function a(e,t){return t{this.container=e||null}),this.overlayCanvas=null,this.overlayCtx=null,this.onWindowResize=(()=>{this.onBeforeFrame()}),this.onBeforeFrame=(()=>{this.maybeClearInteractionLock(),this.resizeOverlayCanvasIfNeeded(),this.renderRects(),this.renderOverlays()}),this.renderCanvas=(()=>{this.props.canvasContext.requestFrame()}),this.frameHadWheelEvent=!1,this.framesWithoutWheelEvents=0,this.interactionLock=null,this.maybeClearInteractionLock=(()=>{this.interactionLock&&(this.frameHadWheelEvent||(this.framesWithoutWheelEvents++,this.framesWithoutWheelEvents>=2&&(this.interactionLock=null,this.framesWithoutWheelEvents=0)),this.props.canvasContext.requestFrame()),this.frameHadWheelEvent=!1}),this.onWheel=(e=>{if(e.preventDefault(),this.frameHadWheelEvent=!0,(e.metaKey||e.ctrlKey)&&"pan"!==this.interactionLock){let t=1+e.deltaY/100;e.ctrlKey&&(t=1+e.deltaY/40),t=(0,o.clamp)(t,.1,10),this.zoom(t)}else"zoom"!==this.interactionLock&&this.pan(new o.Vec2(e.deltaX,e.deltaY));this.renderCanvas()}),this.dragStartConfigSpaceMouse=null,this.dragConfigSpaceViewportOffset=null,this.draggingMode=null,this.onMouseDown=(t=>{const i=this.configSpaceMouse(t);i&&(this.props.configSpaceViewportRect.contains(i)?(this.draggingMode=e.TRANSLATE_VIEWPORT,this.dragConfigSpaceViewportOffset=i.minus(this.props.configSpaceViewportRect.origin)):this.draggingMode=e.DRAW_NEW_VIEWPORT,this.dragStartConfigSpaceMouse=i,window.addEventListener("mousemove",this.onWindowMouseMove),window.addEventListener("mouseup",this.onWindowMouseUp),this.updateCursor(i))}),this.onWindowMouseMove=(t=>{if(!this.dragStartConfigSpaceMouse)return;let i=this.configSpaceMouse(t);if(i)if(this.updateCursor(i),i=new o.Rect(new o.Vec2(0,0),this.configSpaceSize()).closestPointTo(i),this.draggingMode===e.DRAW_NEW_VIEWPORT){const e=this.dragStartConfigSpaceMouse;let t=i;if(!e||!t)return;const s=Math.min(e.x,t.x),n=Math.max(e.x,t.x)-s,r=this.props.configSpaceViewportRect.height();this.props.setConfigSpaceViewportRect(new o.Rect(new o.Vec2(s,t.y-r/2),new o.Vec2(n,r)))}else if(this.draggingMode===e.TRANSLATE_VIEWPORT){if(!this.dragConfigSpaceViewportOffset)return;const e=i.minus(this.dragConfigSpaceViewportOffset);this.props.setConfigSpaceViewportRect(this.props.configSpaceViewportRect.withOrigin(e))}}),this.updateCursor=(t=>{this.draggingMode===e.TRANSLATE_VIEWPORT?(document.body.style.cursor="grabbing",document.body.style.cursor="-webkit-grabbing"):this.draggingMode===e.DRAW_NEW_VIEWPORT?document.body.style.cursor="col-resize":this.props.configSpaceViewportRect.contains(t)?(document.body.style.cursor="grab",document.body.style.cursor="-webkit-grab"):document.body.style.cursor="col-resize"}),this.onMouseLeave=(()=>{null==this.draggingMode&&(document.body.style.cursor="default")}),this.onMouseMove=(e=>{const t=this.configSpaceMouse(e);t&&this.updateCursor(t)}),this.onWindowMouseUp=(e=>{this.draggingMode=null,window.removeEventListener("mousemove",this.onWindowMouseMove),window.removeEventListener("mouseup",this.onWindowMouseUp);const t=this.configSpaceMouse(e);t&&this.updateCursor(t)}),this.overlayCanvasRef=(e=>{e?(this.overlayCanvas=e,this.overlayCtx=this.overlayCanvas.getContext("2d"),this.renderCanvas()):(this.overlayCanvas=null,this.overlayCtx=null)})}physicalViewSize(){return new o.Vec2(this.overlayCanvas?this.overlayCanvas.width:0,this.overlayCanvas?this.overlayCanvas.height:0)}getStyle(){return(0,s.getFlamechartStyle)(this.props.theme)}minimapOrigin(){return new o.Vec2(0,n.Sizes.FRAME_HEIGHT*window.devicePixelRatio)}configSpaceSize(){return new o.Vec2(this.props.flamechart.getTotalWeight(),this.props.flamechart.getLayers().length)}configSpaceToPhysicalViewSpace(){const e=this.minimapOrigin();return o.AffineTransform.betweenRects(new o.Rect(new o.Vec2(0,0),this.configSpaceSize()),new o.Rect(e,this.physicalViewSize().minus(e)))}logicalToPhysicalViewSpace(){return o.AffineTransform.withScale(new o.Vec2(window.devicePixelRatio,window.devicePixelRatio))}windowToLogicalViewSpace(){if(!this.container)return new o.AffineTransform;const e=this.container.getBoundingClientRect();return o.AffineTransform.withTranslation(new o.Vec2(-e.left,-e.top))}renderRects(){this.container&&(this.physicalViewSize().x<2||this.props.canvasContext.renderBehind(this.container,()=>{this.props.flamechartRenderer.render({configSpaceSrcRect:new o.Rect(new o.Vec2(0,0),this.configSpaceSize()),physicalSpaceDstRect:new o.Rect(this.minimapOrigin(),this.physicalViewSize().minus(this.minimapOrigin())),renderOutlines:!1}),this.props.canvasContext.viewportRectangleRenderer.render({configSpaceViewportRect:this.props.configSpaceViewportRect,configSpaceToPhysicalViewSpace:this.configSpaceToPhysicalViewSpace()})}))}renderOverlays(){const e=this.overlayCtx;if(!e)return;const t=this.physicalViewSize();e.clearRect(0,0,t.x,t.y);const i=this.configSpaceToPhysicalViewSpace(),s=this.configSpaceSize().x,c=(this.configSpaceToPhysicalViewSpace().inverted()||new o.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new o.Vec2(200,1)).x,h=n.Sizes.FRAME_HEIGHT*window.devicePixelRatio,l=n.FontSize.LABEL*window.devicePixelRatio,p=(h-l)/2;e.font=`${l}px/${h}px ${n.FontFamily.MONOSPACE}`,e.textBaseline="top";let d=Math.pow(10,Math.floor(Math.log10(c)));c/d>5?d*=5:c/d>2&&(d*=2);const f=this.props.theme;e.fillStyle=a.Color.fromCSSHex(f.bgPrimaryColor).withAlpha(.8).toCSS(),e.fillRect(0,0,t.x,h),e.textBaseline="top";for(let n=Math.ceil(0/d)*d;ne+t.getTotalWeight(),0)),this.totalNonIdleWeight}sortGroupedCallTree(){!function e(t){t.children.sort((e,t)=>-(e.getTotalWeight()-t.getTotalWeight())),t.children.forEach(e)}(this.groupedCalltreeRoot)}forEachCallGrouped(e,t){!function r(s,a){s.frame!==i.root&&e(s,a);let l=0;s.children.forEach(function(e){r(e,a+l),l+=e.getTotalWeight()}),s.frame!==i.root&&t(s,a+s.getTotalWeight())}(this.groupedCalltreeRoot,0)}forEachCall(t,r){let s=[],a=0,l=0;for(let o of this.samples){let n=null;for(n=o;n&&n.frame!=i.root&&-1===s.indexOf(n);n=n.parent);for(;s.length>0&&(0,e.lastOf)(s)!=n;){r(s.pop(),a)}const h=[];for(let e=o;e&&e.frame!=i.root&&e!=n;e=e.parent)h.push(e);h.reverse();for(let e of h)t(e,a);s=s.concat(h),a+=this.weights[l++]}for(let e=s.length-1;e>=0;e--)r(s[e],a)}forEachFrame(e){this.frames.forEach(e)}getProfileWithRecursionFlattened(){const e=new h,t=[],r=new Set;this.forEachCall(function(s,a){r.has(s.frame)?t.push(null):(r.add(s.frame),t.push(s),e.enterFrame(s.frame,a))},function(s,a){const i=t.pop();i&&(r.delete(i.frame),e.leaveFrame(i.frame,a))});const s=e.build();return s.name=this.name,s.valueFormatter=this.valueFormatter,this.forEachFrame(e=>{s.frames.getOrInsert(e).overwriteWeightWith(e)}),s}getInvertedProfileForCallersOf(e){const t=i.getOrInsert(this.frames,e),r=new n,s=[];!function e(r){if(r.frame===t)s.push(r);else for(let t of r.children)e(t)}(this.appendOrderCalltreeRoot);for(let l of s){const e=[];for(let t=l;null!=t&&t.frame!==i.root;t=t.parent)e.push(t.frame);r.appendSampleWithWeight(e,l.getTotalWeight())}const a=r.build();return a.name=this.name,a.valueFormatter=this.valueFormatter,a}getProfileForCalleesOf(e){const t=i.getOrInsert(this.frames,e),r=new n;!function e(s){if(s.frame===t)!function(e){const t=[];!function e(s){t.push(s.frame),r.appendSampleWithWeight(t,s.getSelfWeight());for(let t of s.children)e(t);t.pop()}(e)}(s);else for(let t of s.children)e(t)}(this.appendOrderCalltreeRoot);const s=r.build();return s.name=this.name,s.valueFormatter=this.valueFormatter,s}demangle(){return r(this,void 0,void 0,function*(){let e=null;for(let t of this.frames)t.name.startsWith("__Z")&&(e||(e=(yield s).demangleCpp),t.name=e(t.name))})}remapSymbols(e){for(let t of this.frames){const r=e(t);if(null==r)continue;const{name:s,file:a,line:i,col:l}=r;null!=s&&(t.name=s),null!=a&&(t.file=a),null!=i&&(t.line=i),null!=l&&(t.col=l)}}}exports.Profile=o;class n extends o{constructor(){super(...arguments),this.pendingSample=null}_appendSample(t,r,s){if(isNaN(r))throw new Error("invalid weight");let a=s?this.appendOrderCalltreeRoot:this.groupedCalltreeRoot,o=new Set;for(let n of t){const t=i.getOrInsert(this.frames,n),h=s?(0,e.lastOf)(a.children):a.children.find(e=>e.frame===t);if(h&&!h.isFrozen()&&h.frame==t)a=h;else{const e=a;a=new l(t,a),e.children.push(a)}a.addToTotalWeight(r),o.add(a.frame)}if(a.addToSelfWeight(r),s)for(let e of a.children)e.freeze();if(s){a.frame.addToSelfWeight(r);for(let e of o)e.addToTotalWeight(r);a===(0,e.lastOf)(this.samples)?this.weights[this.weights.length-1]+=r:(this.samples.push(a),this.weights.push(r))}}appendSampleWithWeight(e,t){if(0!==t){if(t<0)throw new Error("Samples must have positive weights");this._appendSample(e,t,!0),this._appendSample(e,t,!1)}}appendSampleWithTimestamp(e,t){if(this.pendingSample){if(t0?this.appendSampleWithWeight(this.pendingSample.stack,this.pendingSample.centralTimestamp-this.pendingSample.startTimestamp):(this.appendSampleWithWeight(this.pendingSample.stack,1),this.setValueFormatter(new t.RawValueFormatter))),this.totalWeight=Math.max(this.totalWeight,this.weights.reduce((e,t)=>e+t,0)),this.sortGroupedCallTree(),this}}exports.StackListProfileBuilder=n;class h extends o{constructor(){super(...arguments),this.appendOrderStack=[this.appendOrderCalltreeRoot],this.groupedOrderStack=[this.groupedCalltreeRoot],this.framesInStack=new Map,this.stack=[],this.lastValue=0}addWeightsToFrames(t){const r=t-this.lastValue;for(let e of this.framesInStack.keys())e.addToTotalWeight(r);const s=(0,e.lastOf)(this.stack);s&&s.addToSelfWeight(r)}addWeightsToNodes(t,r){const s=t-this.lastValue;for(let e of r)e.addToTotalWeight(s);const a=(0,e.lastOf)(r);a&&a.addToSelfWeight(s)}_enterFrame(t,r,s){let a=s?this.appendOrderStack:this.groupedOrderStack;this.addWeightsToNodes(r,a);let i=(0,e.lastOf)(a);if(i){if(s){const e=r-this.lastValue;if(e>0)this.samples.push(i),this.weights.push(r-this.lastValue);else if(e<0)throw new Error(`Samples must be provided in increasing order of cumulative value. Last sample was ${this.lastValue}, this sample was ${r}`)}const o=s?(0,e.lastOf)(i.children):i.children.find(e=>e.frame===t);let n;o&&!o.isFrozen()&&o.frame==t?n=o:(n=new l(t,i),i.children.push(n)),a.push(n)}}enterFrame(e,t){const r=i.getOrInsert(this.frames,e);this.addWeightsToFrames(t),this._enterFrame(r,t,!0),this._enterFrame(r,t,!1),this.stack.push(r);const s=this.framesInStack.get(r)||0;this.framesInStack.set(r,s+1),this.lastValue=t,this.totalWeight=Math.max(this.totalWeight,this.lastValue)}_leaveFrame(e,t,r){let s=r?this.appendOrderStack:this.groupedOrderStack;if(this.addWeightsToNodes(t,s),r){const r=this.appendOrderStack.pop();if(null==r)throw new Error(`Trying to leave ${e.key} when stack is empty`);if(null==this.lastValue)throw new Error(`Trying to leave a ${e.key} before any have been entered`);if(r.freeze(),r.frame.key!==e.key)throw new Error(`Tried to leave frame "${e.name}" while frame "${r.frame.name}" was at the top at ${t}`);const s=t-this.lastValue;if(s>0)this.samples.push(r),this.weights.push(t-this.lastValue);else if(s<0)throw new Error(`Samples must be provided in increasing order of cumulative value. Last sample was ${this.lastValue}, this sample was ${t}`)}else this.groupedOrderStack.pop()}leaveFrame(e,t){const r=i.getOrInsert(this.frames,e);this.addWeightsToFrames(t),this._leaveFrame(r,t,!0),this._leaveFrame(r,t,!1),this.stack.pop();const s=this.framesInStack.get(r);null!=s&&(1===s?this.framesInStack.delete(r):this.framesInStack.set(r,s-1),this.lastValue=t,this.totalWeight=Math.max(this.totalWeight,this.lastValue))}build(){if(this.appendOrderStack.length>1||this.groupedOrderStack.length>1)throw new Error("Tried to complete profile construction with a non-empty stack");return this.sortGroupedCallTree(),this}}exports.CallTreeProfileBuilder=h; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CallTreeProfileBuilder=exports.StackListProfileBuilder=exports.Profile=exports.CallTreeNode=exports.Frame=exports.HasWeights=void 0;var e=require("./utils"),t=require("./value-formatters"),r=function(e,t,r,s){return new(r||(r=Promise))(function(a,i){function l(e){try{n(s.next(e))}catch(t){i(t)}}function o(e){try{n(s.throw(e))}catch(t){i(t)}}function n(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,o)}n((s=s.apply(e,t||[])).next())})};const s=require("_bundle_loader")(require.resolve("./demangle-cpp"));class a{constructor(){this.selfWeight=0,this.totalWeight=0}getSelfWeight(){return this.selfWeight}getTotalWeight(){return this.totalWeight}addToTotalWeight(e){this.totalWeight+=e}addToSelfWeight(e){this.selfWeight+=e}overwriteWeightWith(e){this.selfWeight=e.selfWeight,this.totalWeight=e.totalWeight}}exports.HasWeights=a;class i extends a{constructor(e){super(),this.key=e.key,this.name=e.name,this.file=e.file,this.line=e.line,this.col=e.col}static getOrInsert(e,t){return e.getOrInsert(new i(t))}}exports.Frame=i,i.root=new i({key:"(speedscope root)",name:"(speedscope root)"});class l extends a{constructor(e,t){super(),this.frame=e,this.parent=t,this.children=[],this.frozen=!1}isRoot(){return this.frame===i.root}isFrozen(){return this.frozen}freeze(){this.frozen=!0}}exports.CallTreeNode=l;class o{constructor(r=0){this.name="",this.frames=new e.KeyedSet,this.appendOrderCalltreeRoot=new l(i.root,null),this.groupedCalltreeRoot=new l(i.root,null),this.samples=[],this.weights=[],this.valueFormatter=new t.RawValueFormatter,this.totalNonIdleWeight=null,this.totalWeight=r}getAppendOrderCalltreeRoot(){return this.appendOrderCalltreeRoot}getGroupedCalltreeRoot(){return this.groupedCalltreeRoot}shallowClone(){const e=new o(this.totalWeight);return Object.assign(e,this),e}formatValue(e){return this.valueFormatter.format(e)}setValueFormatter(e){this.valueFormatter=e}getWeightUnit(){return this.valueFormatter.unit}getName(){return this.name}setName(e){this.name=e}getTotalWeight(){return this.totalWeight}getTotalNonIdleWeight(){return null===this.totalNonIdleWeight&&(this.totalNonIdleWeight=this.groupedCalltreeRoot.children.reduce((e,t)=>e+t.getTotalWeight(),0)),this.totalNonIdleWeight}sortGroupedCallTree(){!function e(t){t.children.sort((e,t)=>-(e.getTotalWeight()-t.getTotalWeight())),t.children.forEach(e)}(this.groupedCalltreeRoot)}forEachCallGrouped(e,t){!function r(s,a){s.frame!==i.root&&e(s,a);let l=0;s.children.forEach(function(e){r(e,a+l),l+=e.getTotalWeight()}),s.frame!==i.root&&t(s,a+s.getTotalWeight())}(this.groupedCalltreeRoot,0)}forEachCall(t,r){let s=[],a=0,l=0;for(let o of this.samples){let n=null;for(n=o;n&&n.frame!=i.root&&-1===s.indexOf(n);n=n.parent);for(;s.length>0&&(0,e.lastOf)(s)!=n;){r(s.pop(),a)}const h=[];for(let e=o;e&&e.frame!=i.root&&e!=n;e=e.parent)h.push(e);h.reverse();for(let e of h)t(e,a);s=s.concat(h),a+=this.weights[l++]}for(let e=s.length-1;e>=0;e--)r(s[e],a)}forEachFrame(e){this.frames.forEach(e)}getProfileWithRecursionFlattened(){const e=new h,t=[],r=new Set;this.forEachCall(function(s,a){r.has(s.frame)?t.push(null):(r.add(s.frame),t.push(s),e.enterFrame(s.frame,a))},function(s,a){const i=t.pop();i&&(r.delete(i.frame),e.leaveFrame(i.frame,a))});const s=e.build();return s.name=this.name,s.valueFormatter=this.valueFormatter,this.forEachFrame(e=>{s.frames.getOrInsert(e).overwriteWeightWith(e)}),s}getInvertedProfileForCallersOf(e){const t=i.getOrInsert(this.frames,e),r=new n,s=[];!function e(r){if(r.frame===t)s.push(r);else for(let t of r.children)e(t)}(this.appendOrderCalltreeRoot);for(let l of s){const e=[];for(let t=l;null!=t&&t.frame!==i.root;t=t.parent)e.push(t.frame);r.appendSampleWithWeight(e,l.getTotalWeight())}const a=r.build();return a.name=this.name,a.valueFormatter=this.valueFormatter,a}getProfileForCalleesOf(e){const t=i.getOrInsert(this.frames,e),r=new n;!function e(s){if(s.frame===t)!function(e){const t=[];!function e(s){t.push(s.frame),r.appendSampleWithWeight(t,s.getSelfWeight());for(let t of s.children)e(t);t.pop()}(e)}(s);else for(let t of s.children)e(t)}(this.appendOrderCalltreeRoot);const s=r.build();return s.name=this.name,s.valueFormatter=this.valueFormatter,s}demangle(){return r(this,void 0,void 0,function*(){let e=null;for(let t of this.frames)t.name.startsWith("__Z")&&(e||(e=(yield s).demangleCpp),t.name=e(t.name))})}remapSymbols(e){for(let t of this.frames){const r=e(t);if(null==r)continue;const{name:s,file:a,line:i,col:l}=r;null!=s&&(t.name=s),null!=a&&(t.file=a),null!=i&&(t.line=i),null!=l&&(t.col=l)}}}exports.Profile=o;class n extends o{constructor(){super(...arguments),this.pendingSample=null}_appendSample(t,r,s){if(isNaN(r))throw new Error("invalid weight");let a=s?this.appendOrderCalltreeRoot:this.groupedCalltreeRoot,i=new Set;for(let o of t){const t=s?(0,e.lastOf)(a.children):a.children.find(e=>e.frame===o);if(t&&!t.isFrozen()&&t.frame==o)a=t;else{const e=a;a=new l(o,a),e.children.push(a)}a.addToTotalWeight(r),i.add(a.frame)}if(a.addToSelfWeight(r),s)for(let e of a.children)e.freeze();if(s){a.frame.addToSelfWeight(r);for(let e of i)e.addToTotalWeight(r);a===(0,e.lastOf)(this.samples)?this.weights[this.weights.length-1]+=r:(this.samples.push(a),this.weights.push(r))}}appendSampleWithWeight(e,t){if(0===t)return;if(t<0)throw new Error("Samples must have positive weights");const r=e.map(e=>i.getOrInsert(this.frames,e));this._appendSample(r,t,!0),this._appendSample(r,t,!1)}appendSampleWithTimestamp(e,t){if(this.pendingSample){if(t0?this.appendSampleWithWeight(this.pendingSample.stack,this.pendingSample.centralTimestamp-this.pendingSample.startTimestamp):(this.appendSampleWithWeight(this.pendingSample.stack,1),this.setValueFormatter(new t.RawValueFormatter))),this.totalWeight=Math.max(this.totalWeight,this.weights.reduce((e,t)=>e+t,0)),this.sortGroupedCallTree(),this}}exports.StackListProfileBuilder=n;class h extends o{constructor(){super(...arguments),this.appendOrderStack=[this.appendOrderCalltreeRoot],this.groupedOrderStack=[this.groupedCalltreeRoot],this.framesInStack=new Map,this.stack=[],this.lastValue=0}addWeightsToFrames(t){const r=t-this.lastValue;for(let e of this.framesInStack.keys())e.addToTotalWeight(r);const s=(0,e.lastOf)(this.stack);s&&s.addToSelfWeight(r)}addWeightsToNodes(t,r){const s=t-this.lastValue;for(let e of r)e.addToTotalWeight(s);const a=(0,e.lastOf)(r);a&&a.addToSelfWeight(s)}_enterFrame(t,r,s){let a=s?this.appendOrderStack:this.groupedOrderStack;this.addWeightsToNodes(r,a);let i=(0,e.lastOf)(a);if(i){if(s){const e=r-this.lastValue;if(e>0)this.samples.push(i),this.weights.push(r-this.lastValue);else if(e<0)throw new Error(`Samples must be provided in increasing order of cumulative value. Last sample was ${this.lastValue}, this sample was ${r}`)}const o=s?(0,e.lastOf)(i.children):i.children.find(e=>e.frame===t);let n;o&&!o.isFrozen()&&o.frame==t?n=o:(n=new l(t,i),i.children.push(n)),a.push(n)}}enterFrame(e,t){const r=i.getOrInsert(this.frames,e);this.addWeightsToFrames(t),this._enterFrame(r,t,!0),this._enterFrame(r,t,!1),this.stack.push(r);const s=this.framesInStack.get(r)||0;this.framesInStack.set(r,s+1),this.lastValue=t,this.totalWeight=Math.max(this.totalWeight,this.lastValue)}_leaveFrame(e,t,r){let s=r?this.appendOrderStack:this.groupedOrderStack;if(this.addWeightsToNodes(t,s),r){const r=this.appendOrderStack.pop();if(null==r)throw new Error(`Trying to leave ${e.key} when stack is empty`);if(null==this.lastValue)throw new Error(`Trying to leave a ${e.key} before any have been entered`);if(r.freeze(),r.frame.key!==e.key)throw new Error(`Tried to leave frame "${e.name}" while frame "${r.frame.name}" was at the top at ${t}`);const s=t-this.lastValue;if(s>0)this.samples.push(r),this.weights.push(t-this.lastValue);else if(s<0)throw new Error(`Samples must be provided in increasing order of cumulative value. Last sample was ${this.lastValue}, this sample was ${t}`)}else this.groupedOrderStack.pop()}leaveFrame(e,t){const r=i.getOrInsert(this.frames,e);this.addWeightsToFrames(t),this._leaveFrame(r,t,!0),this._leaveFrame(r,t,!1),this.stack.pop();const s=this.framesInStack.get(r);null!=s&&(1===s?this.framesInStack.delete(r):this.framesInStack.set(r,s-1),this.lastValue=t,this.totalWeight=Math.max(this.totalWeight,this.lastValue))}build(){if(this.appendOrderStack.length>1||this.groupedOrderStack.length>1)throw new Error("Tried to complete profile construction with a non-empty stack");return this.sortGroupedCallTree(),this}}exports.CallTreeProfileBuilder=h; },{"./utils":"ucYa","./value-formatters":"LsM4","_bundle_loader":"TUK3","./demangle-cpp":[["demangle-cpp.1768f4cc.js","bS28"],"demangle-cpp.1768f4cc.js.map","bS28"]}],"x8nU":[function(require,module,exports) { "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileFormat=void 0,exports.FileFormat=e,function(e){let t,o;!function(e){e.EVENTED="evented",e.SAMPLED="sampled"}(t=e.ProfileType||(e.ProfileType={})),function(e){e.OPEN_FRAME="O",e.CLOSE_FRAME="C"}(o=e.EventType||(e.EventType={}))}(e||(exports.FileFormat=e={})); },{}],"EHrm":[function(require,module,exports) { -module.exports={name:"speedscope",version:"1.15.2",description:"",repository:"jlfwong/speedscope",main:"index.js",bin:{speedscope:"./bin/cli.js"},scripts:{deploy:"./scripts/deploy.sh",prepack:"./scripts/build-release.sh",prettier:"prettier --write 'src/**/*.ts' 'src/**/*.tsx'",lint:"eslint 'src/**/*.ts' 'src/**/*.tsx'",jest:"./scripts/test-setup.sh && jest --runInBand",coverage:"npm run jest -- --coverage",typecheck:"tsc --noEmit",test:"./scripts/ci.sh",serve:"parcel assets/index.html --open --no-autoinstall"},files:["bin/cli.js","dist/release/**","!*.map"],browserslist:["last 2 Chrome versions","last 2 Firefox versions"],author:"",license:"MIT",devDependencies:{"@types/jest":"22.2.3","@types/jszip":"3.1.4","@types/node":"14.0.1","@types/pako":"1.0.0","@typescript-eslint/eslint-plugin":"4.19.0","@typescript-eslint/parser":"4.19.0",acorn:"7.2.0",aphrodite:"2.1.0",eslint:"6.0.0","eslint-plugin-prettier":"2.6.0","eslint-plugin-react-hooks":"4.0.2",jest:"24.3.0",jsverify:"0.8.3",jszip:"3.1.5",pako:"1.0.6","parcel-bundler":"1.12.4",preact:"10.4.1",prettier:"2.0.4",protobufjs:"6.8.8","source-map":"0.6.1","ts-jest":"24.3.0",typescript:"4.2.3","typescript-json-schema":"0.42.0","uglify-es":"3.2.2","uint8array-json-parser":"0.0.2"},jest:{transform:{"^.+\\.tsx?$":"ts-jest"},setupFilesAfterEnv:["./src/jest-setup.js"],testRegex:"\\.test\\.tsx?$",collectCoverageFrom:["**/*.{ts,tsx}","!**/*.d.{ts,tsx}"],moduleFileExtensions:["ts","tsx","js","jsx","json"]},dependencies:{open:"7.2.0"}}; +module.exports={name:"speedscope",version:"1.16.0",description:"",repository:"jlfwong/speedscope",main:"index.js",bin:{speedscope:"./bin/cli.js"},scripts:{deploy:"./scripts/deploy.sh",prepack:"./scripts/build-release.sh",prettier:"prettier --write 'src/**/*.ts' 'src/**/*.tsx'",lint:"eslint 'src/**/*.ts' 'src/**/*.tsx'",jest:"./scripts/test-setup.sh && jest --runInBand",coverage:"npm run jest -- --coverage",typecheck:"tsc --noEmit",test:"./scripts/ci.sh",serve:"parcel assets/index.html --open --no-autoinstall"},files:["bin/cli.js","dist/release/**","!*.map"],browserslist:["last 2 Chrome versions","last 2 Firefox versions"],author:"",license:"MIT",devDependencies:{"@types/jest":"22.2.3","@types/jszip":"3.1.4","@types/node":"14.0.1","@types/pako":"1.0.0","@typescript-eslint/eslint-plugin":"4.19.0","@typescript-eslint/parser":"4.19.0",acorn:"7.2.0",aphrodite:"2.1.0",eslint:"6.0.0","eslint-plugin-prettier":"2.6.0","eslint-plugin-react-hooks":"4.0.2",jest:"24.3.0",jsverify:"0.8.3",jszip:"3.1.5",pako:"1.0.6","parcel-bundler":"1.12.4",preact:"10.4.1",prettier:"2.0.4",protobufjs:"6.8.8","source-map":"0.6.1","ts-jest":"24.3.0",typescript:"4.2.3","typescript-json-schema":"0.42.0","uglify-es":"3.2.2","uint8array-json-parser":"0.0.2"},jest:{transform:{"^.+\\.tsx?$":"ts-jest"},setupFilesAfterEnv:["./src/jest-setup.js"],testRegex:"\\.test\\.tsx?$",collectCoverageFrom:["**/*.{ts,tsx}","!**/*.d.{ts,tsx}"],moduleFileExtensions:["ts","tsx","js","jsx","json"]},dependencies:{open:"7.2.0"}}; },{}],"Xzb6":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.exportProfileGroup=r,exports.importSpeedscopeProfiles=s,exports.saveToFile=l;var e=require("./profile"),t=require("./value-formatters"),n=require("./file-format-spec");function r(e){const t=[],n=new Map;function r(e){let r=n.get(e);if(null==r){const o={name:e.name};null!=e.file&&(o.file=e.file),null!=e.line&&(o.line=e.line),null!=e.col&&(o.col=e.col),r=t.length,n.set(e,r),t.push(o)}return r}const a={exporter:`speedscope@${require("../../package.json").version}`,name:e.name,activeProfileIndex:e.indexToView,$schema:"https://www.speedscope.app/file-format-schema.json",shared:{frames:t},profiles:[]};for(let s of e.profiles)a.profiles.push(o(s,r));return a}function o(e,t){const r={type:n.FileFormat.ProfileType.EVENTED,name:e.getName(),unit:e.getWeightUnit(),startValue:0,endValue:e.getTotalWeight(),events:[]};return e.forEachCall((e,o)=>{r.events.push({type:n.FileFormat.EventType.OPEN_FRAME,frame:t(e.frame),at:o})},(e,o)=>{r.events.push({type:n.FileFormat.EventType.CLOSE_FRAME,frame:t(e.frame),at:o})}),r}function a(r,o){function a(e){const{name:n,unit:o}=r;switch(o){case"nanoseconds":case"microseconds":case"milliseconds":case"seconds":e.setValueFormatter(new t.TimeFormatter(o));break;case"bytes":e.setValueFormatter(new t.ByteFormatter);break;case"none":e.setValueFormatter(new t.RawValueFormatter)}e.setName(n)}switch(r.type){case n.FileFormat.ProfileType.EVENTED:return function(t){const{startValue:r,endValue:s,events:l}=t,i=new e.CallTreeProfileBuilder(s-r);a(i);const c=o.map((e,t)=>Object.assign({key:t},e));for(let e of l)switch(e.type){case n.FileFormat.EventType.OPEN_FRAME:i.enterFrame(c[e.frame],e.at-r);break;case n.FileFormat.EventType.CLOSE_FRAME:i.leaveFrame(c[e.frame],e.at-r)}return i.build()}(r);case n.FileFormat.ProfileType.SAMPLED:return function(t){const{startValue:n,endValue:r,samples:s,weights:l}=t,i=new e.StackListProfileBuilder(r-n);a(i);const c=o.map((e,t)=>Object.assign({key:t},e));if(s.length!==l.length)throw new Error(`Expected samples.length (${s.length}) to equal weights.length (${l.length})`);for(let e=0;ec[e]),n)}return i.build()}(r)}}function s(e){return{name:e.name||e.profiles[0].name||"profile",indexToView:e.activeProfileIndex||0,profiles:e.profiles.map(t=>a(t,e.shared.frames))}}function l(e){const t=r(e),n=new Blob([JSON.stringify(t)],{type:"text/json"}),o=`${(t.name?t.name.split(".")[0]:"profile").replace(/\W+/g,"_")}.speedscope.json`;console.log("Saving",o);const a=document.createElement("a");a.download=o,a.href=window.URL.createObjectURL(n),a.dataset.downloadurl=["text/json",a.download,a.href].join(":"),document.body.appendChild(a),a.click(),document.body.removeChild(a)} },{"./profile":"YG8z","./value-formatters":"LsM4","./file-format-spec":"x8nU","../../package.json":"EHrm"}],"C6HJ":[function(require,module,exports) { @@ -181,7 +181,7 @@ module.exports={name:"speedscope",version:"1.15.2",description:"",repository:"jl module.exports="perf-vertx-stacks-01-collapsed-all.2681da68.txt"; },{}],"wCGh":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Application=exports.GLCanvas=void 0;var e=require("preact"),t=require("aphrodite"),o=require("./style"),i=require("../lib/emscripten"),r=require("./sandwich-view"),s=require("../lib/file-format"),n=require("./flamechart-view-container"),a=require("./toolbar"),l=require("../lib/js-source-map"),c=require("./themes/theme"),p=require("../lib/view-mode"),d=require("../app-state"),h=require("../lib/preact-helpers"),m=function(e,t,o,i){return new(o||(o=Promise))(function(r,s){function n(e){try{l(i.next(e))}catch(t){s(t)}}function a(e){try{l(i.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(n,a)}l((i=i.apply(e,t||[])).next())})};const u=require("_bundle_loader")(require.resolve("../import"));function f(e,t){return m(this,void 0,void 0,function*(){return(yield u).importProfileGroupFromText(e,t)})}function v(e,t){return m(this,void 0,void 0,function*(){return(yield u).importProfileGroupFromBase64(e,t)})}function g(e,t){return m(this,void 0,void 0,function*(){return(yield u).importProfilesFromArrayBuffer(e,t)})}function w(e){return m(this,void 0,void 0,function*(){return(yield u).importProfilesFromFile(e)})}function y(e){return m(this,void 0,void 0,function*(){return(yield u).importFromFileSystemDirectoryEntry(e)})}u.then(()=>{}),require("_bundle_loader")(require.resolve("../lib/demangle-cpp")).then(()=>{}),require("_bundle_loader")(require.resolve("source-map")).then(()=>{});const b=require("../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt");class x extends h.StatelessComponent{constructor(){super(...arguments),this.canvas=null,this.ref=(e=>{e instanceof HTMLCanvasElement?this.canvas=e:this.canvas=null,this.props.setGLCanvas(this.canvas)}),this.container=null,this.containerRef=(e=>{e instanceof HTMLElement?this.container=e:this.container=null}),this.maybeResize=(()=>{if(!this.container)return;if(!this.props.canvasContext)return;let{width:e,height:t}=this.container.getBoundingClientRect();const o=e,i=t,r=e*window.devicePixelRatio,s=t*window.devicePixelRatio;this.props.canvasContext.gl.resize(r,s,o,i)}),this.onWindowResize=(()=>{this.props.canvasContext&&this.props.canvasContext.requestFrame()})}componentWillReceiveProps(e){this.props.canvasContext!==e.canvasContext&&(this.props.canvasContext&&this.props.canvasContext.removeBeforeFrameHandler(this.maybeResize),e.canvasContext&&(e.canvasContext.addBeforeFrameHandler(this.maybeResize),e.canvasContext.requestFrame()))}componentDidMount(){window.addEventListener("resize",this.onWindowResize)}componentWillUnmount(){this.props.canvasContext&&this.props.canvasContext.removeBeforeFrameHandler(this.maybeResize),window.removeEventListener("resize",this.onWindowResize)}render(){const o=P(this.props.theme);return(0,e.h)("div",{ref:this.containerRef,className:(0,t.css)(o.glCanvasView)},(0,e.h)("canvas",{ref:this.ref,width:1,height:1}))}}exports.GLCanvas=x;class C extends h.StatelessComponent{constructor(){super(...arguments),this.loadExample=(()=>{this.loadProfile(()=>m(this,void 0,void 0,function*(){const e=yield fetch(b).then(e=>e.text());return yield f("perf-vertx-stacks-01-collapsed-all.txt",e)}))}),this.onDrop=(e=>{if(this.props.setDragActive(!1),e.preventDefault(),!e.dataTransfer)return;const t=e.dataTransfer.items[0];if("webkitGetAsEntry"in t){const e=t.webkitGetAsEntry();if(e.isDirectory&&e.name.endsWith(".trace"))return console.log("Importing as Instruments.app .trace file"),void this.loadProfile(()=>m(this,void 0,void 0,function*(){return yield y(e)}))}let o=e.dataTransfer.files.item(0);o&&this.loadFromFile(o)}),this.onDragOver=(e=>{this.props.setDragActive(!0),e.preventDefault()}),this.onDragLeave=(e=>{this.props.setDragActive(!1),e.preventDefault()}),this.onWindowKeyPress=(e=>m(this,void 0,void 0,function*(){if("1"===e.key)this.props.setViewMode(p.ViewMode.CHRONO_FLAME_CHART);else if("2"===e.key)this.props.setViewMode(p.ViewMode.LEFT_HEAVY_FLAME_GRAPH);else if("3"===e.key)this.props.setViewMode(p.ViewMode.SANDWICH_VIEW);else if("r"===e.key){const{flattenRecursion:e}=this.props;this.props.setFlattenRecursion(!e)}else if("n"===e.key){const{activeProfileState:e}=this.props;e&&this.props.setProfileIndexToView(e.index+1)}else if("p"===e.key){const{activeProfileState:e}=this.props;e&&this.props.setProfileIndexToView(e.index-1)}})),this.saveFile=(()=>{if(this.props.profileGroup){const{name:e,indexToView:t,profiles:o}=this.props.profileGroup,i={name:e,indexToView:t,profiles:o.map(e=>e.profile)};(0,s.saveToFile)(i)}}),this.browseForFile=(()=>{const e=document.createElement("input");e.type="file",e.addEventListener("change",this.onFileSelect),e.click()}),this.onWindowKeyDown=(e=>m(this,void 0,void 0,function*(){"s"===e.key&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.saveFile()):"o"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.browseForFile())})),this.onDocumentPaste=(e=>{if(null!=document.activeElement&&"INPUT"===document.activeElement.nodeName)return;e.preventDefault(),e.stopPropagation();const t=e.clipboardData;if(!t)return;const o=t.getData("text");this.loadProfile(()=>m(this,void 0,void 0,function*(){return yield f("From Clipboard",o)}))}),this.onFileSelect=(e=>{const t=e.target.files.item(0);t&&this.loadFromFile(t)})}loadProfile(e){return m(this,void 0,void 0,function*(){if(this.props.setLoading(!0),yield new Promise(e=>setTimeout(e,0)),!this.props.glCanvas)return;console.time("import");let t=null;try{t=yield e()}catch(o){return console.log("Failed to load format",o),void this.props.setError(!0)}if(null==t)return alert("Unrecognized format! See documentation about supported formats."),void this.props.setLoading(!1);if(0===t.profiles.length)return alert("Successfully imported profile, but it's empty!"),void this.props.setLoading(!1);this.props.hashParams.title&&(t=Object.assign(Object.assign({},t),{name:this.props.hashParams.title})),document.title=`${t.name} - speedscope`,this.props.hashParams.viewMode&&this.props.setViewMode(this.props.hashParams.viewMode);for(let e of t.profiles)yield e.demangle();for(let e of t.profiles){const t=this.props.hashParams.title||e.getName();e.setName(t)}console.timeEnd("import"),this.props.setProfileGroup(t),this.props.setLoading(!1)})}getStyle(){return P(this.props.theme)}loadFromFile(e){this.loadProfile(()=>m(this,void 0,void 0,function*(){const t=yield w(e);if(t){for(let o of t.profiles)o.getName()||o.setName(e.name);return t}if(this.props.profileGroup&&this.props.activeProfileState){const t=new FileReader,o=new Promise(e=>{t.addEventListener("loadend",()=>{if("string"!=typeof t.result)throw new Error("Expected reader.result to be a string");e(t.result)})});t.readAsText(e);const r=yield o;let s=null;const n=(0,i.importEmscriptenSymbolMap)(r);n&&(console.log("Importing as emscripten symbol map"),s=n);const a=yield(0,l.importJavaScriptSourceMapSymbolRemapper)(r,e.name);if(!s&&a&&(console.log("Importing as JavaScript source map"),s=a),null!=s)return{name:this.props.profileGroup.name||"profile",indexToView:this.props.profileGroup.indexToView,profiles:this.props.profileGroup.profiles.map(e=>{const t=e.profile.shallowClone();return t.remapSymbols(s),t})}}return null}))}componentDidMount(){window.addEventListener("keydown",this.onWindowKeyDown),window.addEventListener("keypress",this.onWindowKeyPress),document.addEventListener("paste",this.onDocumentPaste),this.maybeLoadHashParamProfile()}componentWillUnmount(){window.removeEventListener("keydown",this.onWindowKeyDown),window.removeEventListener("keypress",this.onWindowKeyPress),document.removeEventListener("paste",this.onDocumentPaste)}maybeLoadHashParamProfile(){return m(this,void 0,void 0,function*(){const{profileURL:e}=this.props.hashParams;if(e){if(!d.canUseXHR)return void alert(`Cannot load a profile URL when loading from "${window.location.protocol}" URL protocol`);this.loadProfile(()=>m(this,void 0,void 0,function*(){const t=yield fetch(e);let o=new URL(e,window.location.href).pathname;return o.includes("/")&&(o=o.slice(o.lastIndexOf("/")+1)),yield g(o,yield t.arrayBuffer())}))}else if(this.props.hashParams.localProfilePath){window.speedscope={loadFileFromBase64:(e,t)=>{this.loadProfile(()=>v(e,t))}};const e=document.createElement("script");e.src=`file:///${this.props.hashParams.localProfilePath}`,document.head.appendChild(e)}})}renderLanding(){const o=this.getStyle();return(0,e.h)("div",{className:(0,t.css)(o.landingContainer)},(0,e.h)("div",{className:(0,t.css)(o.landingMessage)},(0,e.h)("p",{className:(0,t.css)(o.landingP)},"👋 Hi there! Welcome to 🔬speedscope, an interactive"," ",(0,e.h)("a",{className:(0,t.css)(o.link),href:"http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html"},"flamegraph")," ","visualizer. Use it to help you make your software faster."),d.canUseXHR?(0,e.h)("p",{className:(0,t.css)(o.landingP)},"Drag and drop a profile file onto this window to get started, click the big blue button below to browse for a profile to explore, or"," ",(0,e.h)("a",{tabIndex:0,className:(0,t.css)(o.link),onClick:this.loadExample},"click here")," ","to load an example profile."):(0,e.h)("p",{className:(0,t.css)(o.landingP)},"Drag and drop a profile file onto this window to get started, or click the big blue button below to browse for a profile to explore."),(0,e.h)("div",{className:(0,t.css)(o.browseButtonContainer)},(0,e.h)("input",{type:"file",name:"file",id:"file",onChange:this.onFileSelect,className:(0,t.css)(o.hide)}),(0,e.h)("label",{for:"file",className:(0,t.css)(o.browseButton),tabIndex:0},"Browse")),(0,e.h)("p",{className:(0,t.css)(o.landingP)},"See the"," ",(0,e.h)("a",{className:(0,t.css)(o.link),href:"https://github.com/jlfwong/speedscope#usage",target:"_blank"},"documentation")," ","for information about supported file formats, keyboard shortcuts, and how to navigate around the profile."),(0,e.h)("p",{className:(0,t.css)(o.landingP)},"speedscope is open source. Please"," ",(0,e.h)("a",{className:(0,t.css)(o.link),target:"_blank",href:"https://github.com/jlfwong/speedscope/issues"},"report any issues on GitHub"),".")))}renderError(){const o=this.getStyle();return(0,e.h)("div",{className:(0,t.css)(o.error)},(0,e.h)("div",null,"😿 Something went wrong."),(0,e.h)("div",null,"Check the JS console for more details."))}renderLoadingBar(){const o=this.getStyle();return(0,e.h)("div",{className:(0,t.css)(o.loading)})}renderContent(){const{viewMode:t,activeProfileState:o,error:i,loading:s,glCanvas:a}=this.props;if(i)return this.renderError();if(s)return this.renderLoadingBar();if(!o||!a)return this.renderLanding();switch(t){case p.ViewMode.CHRONO_FLAME_CHART:return(0,e.h)(n.ChronoFlamechartView,{activeProfileState:o,glCanvas:a});case p.ViewMode.LEFT_HEAVY_FLAME_GRAPH:return(0,e.h)(n.LeftHeavyFlamechartView,{activeProfileState:o,glCanvas:a});case p.ViewMode.SANDWICH_VIEW:return(0,e.h)(r.SandwichViewContainer,{activeProfileState:o,glCanvas:a})}}render(){const o=this.getStyle();return(0,e.h)("div",{onDrop:this.onDrop,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,className:(0,t.css)(o.root,this.props.dragActive&&o.dragTargetRoot)},(0,e.h)(x,{setGLCanvas:this.props.setGLCanvas,canvasContext:this.props.canvasContext,theme:this.props.theme}),(0,e.h)(a.Toolbar,Object.assign({saveFile:this.saveFile,browseForFile:this.browseForFile},this.props)),(0,e.h)("div",{className:(0,t.css)(o.contentContainer)},this.renderContent()),this.props.dragActive&&(0,e.h)("div",{className:(0,t.css)(o.dragTarget)}))}}exports.Application=C;const P=(0,c.withTheme)(e=>t.StyleSheet.create({glCanvasView:{position:"absolute",width:"100vw",height:"100vh",zIndex:-1,pointerEvents:"none"},error:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%"},loading:{height:3,marginBottom:-3,background:e.selectionPrimaryColor,transformOrigin:"0% 50%",animationName:[{from:{transform:"scaleX(0)"},to:{transform:"scaleX(1)"}}],animationTimingFunction:"cubic-bezier(0, 1, 0, 1)",animationDuration:"30s"},root:{width:"100vw",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative",fontFamily:o.FontFamily.MONOSPACE,lineHeight:"20px",color:e.fgPrimaryColor},dragTargetRoot:{cursor:"copy"},dragTarget:{boxSizing:"border-box",position:"absolute",top:0,left:0,width:"100%",height:"100%",border:`5px dashed ${e.selectionPrimaryColor}`,pointerEvents:"none"},contentContainer:{position:"relative",display:"flex",overflow:"hidden",flexDirection:"column",flex:1},landingContainer:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},landingMessage:{maxWidth:600},landingP:{marginBottom:16},hide:{display:"none"},browseButtonContainer:{display:"flex",alignItems:"center",justifyContent:"center"},browseButton:{marginBottom:16,height:72,flex:1,maxWidth:256,textAlign:"center",fontSize:o.FontSize.BIG_BUTTON,lineHeight:"72px",background:e.selectionPrimaryColor,color:e.altFgPrimaryColor,transition:`all ${o.Duration.HOVER_CHANGE} ease-in`,":hover":{background:e.selectionSecondaryColor}},link:{color:e.selectionPrimaryColor,cursor:"pointer",textDecoration:"none",transition:`all ${o.Duration.HOVER_CHANGE} ease-in`,":hover":{color:e.selectionSecondaryColor}}})); -},{"preact":"aSor","aphrodite":"CxN7","./style":"hvr4","../lib/emscripten":"FbpF","./sandwich-view":"L8J2","../lib/file-format":"Xzb6","./flamechart-view-container":"PJJu","./toolbar":"BPHY","../lib/js-source-map":"bv0g","./themes/theme":"gzKG","../lib/view-mode":"dpTI","../app-state":"LDQe","../lib/preact-helpers":"Hete","_bundle_loader":"TUK3","../import":[["import.f56540a0.js","uRa7"],"import.f56540a0.js.map","uRa7"],"../lib/demangle-cpp":[["demangle-cpp.1768f4cc.js","bS28"],"demangle-cpp.1768f4cc.js.map","bS28"],"source-map":[["source-map.438fa06b.js","aRf0"],"source-map.438fa06b.js.map","aRf0"],"../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt":"ThNa"}],"A6uO":[function(require,module,exports) { +},{"preact":"aSor","aphrodite":"CxN7","./style":"hvr4","../lib/emscripten":"FbpF","./sandwich-view":"L8J2","../lib/file-format":"Xzb6","./flamechart-view-container":"PJJu","./toolbar":"BPHY","../lib/js-source-map":"bv0g","./themes/theme":"gzKG","../lib/view-mode":"dpTI","../app-state":"LDQe","../lib/preact-helpers":"Hete","_bundle_loader":"TUK3","../import":[["import.8ae8aa3d.js","uRa7"],"import.8ae8aa3d.js.map","uRa7"],"../lib/demangle-cpp":[["demangle-cpp.1768f4cc.js","bS28"],"demangle-cpp.1768f4cc.js.map","bS28"],"source-map":[["source-map.438fa06b.js","aRf0"],"source-map.438fa06b.js.map","aRf0"],"../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt":"ThNa"}],"A6uO":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApplicationContainer=void 0;var e=require("preact"),t=require("../app-state/getters"),o=require("preact/compat"),r=require("../app-state/active-profile-state"),a=require("./themes/theme"),i=require("../app-state"),s=require("../lib/atom"),n=require("./search-view"),m=require("./application");const u=(0,o.memo)(()=>{const u=(0,s.useAtom)(i.glCanvasAtom),l=(0,a.useTheme)(),p=(0,o.useMemo)(()=>u?(0,t.getCanvasContext)({theme:l,canvas:u}):null,[l,u]);return(0,e.h)(n.ProfileSearchContextProvider,null,(0,e.h)(m.Application,{activeProfileState:(0,r.useActiveProfileState)(),canvasContext:p,setGLCanvas:i.glCanvasAtom.set,setLoading:i.loadingAtom.set,setError:i.errorAtom.set,setProfileGroup:i.profileGroupAtom.setProfileGroup,setDragActive:i.dragActiveAtom.set,setViewMode:i.viewModeAtom.set,setFlattenRecursion:i.flattenRecursionAtom.set,setProfileIndexToView:i.profileGroupAtom.setProfileIndexToView,profileGroup:(0,s.useAtom)(i.profileGroupAtom),theme:l,flattenRecursion:(0,s.useAtom)(i.flattenRecursionAtom),viewMode:(0,s.useAtom)(i.viewModeAtom),hashParams:(0,s.useAtom)(i.hashParamsAtom),glCanvas:u,dragActive:(0,s.useAtom)(i.dragActiveAtom),loading:(0,s.useAtom)(i.loadingAtom),error:(0,s.useAtom)(i.errorAtom)}))});exports.ApplicationContainer=u; },{"preact":"aSor","../app-state/getters":"zEXv","preact/compat":"AQ6k","../app-state/active-profile-state":"MY42","./themes/theme":"gzKG","../app-state":"LDQe","../lib/atom":"QkVE","./search-view":"t9CM","./application":"wCGh"}],"K5F6":[function(require,module,exports) { "use strict";var e=require("preact"),o=require("./views/application-container"),d=require("./views/themes/theme");console.log(`speedscope v${require("../package.json").version}`),module.hot&&(module.hot.dispose(()=>{(0,e.render)((0,e.h)("div",null),document.body,document.body.lastElementChild||void 0)}),module.hot.accept()),(0,e.render)((0,e.h)(d.ThemeProvider,null,(0,e.h)(o.ApplicationContainer,null)),document.body,document.body.lastElementChild||void 0); @@ -190,4 +190,4 @@ module.exports=function(n){return new Promise(function(e,o){var r=document.creat },{}],0:[function(require,module,exports) { var b=require("TUK3");b.register("js",require("Yi9z")); },{}]},{},[0,"K5F6"], null) -//# sourceMappingURL=speedscope.0d51a4b1.js.map \ No newline at end of file +//# sourceMappingURL=speedscope.f27db165.js.map \ No newline at end of file diff --git a/src/version.h b/src/version.h index 7fdf7d15..eaebf050 100644 --- a/src/version.h +++ b/src/version.h @@ -1,3 +1,3 @@ -#define VERSION_NUMBER "0.0.10-pre" +#define VERSION_NUMBER "0.0.10-wip" #define VERSION_NAME "Pride is not the opposite of shame, but its source."