diff --git a/package.json b/package.json index 8b6e6f795..248bd7ddb 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,7 @@ "description": "", "repository": "jlfwong/speedscope", "main": "index.js", - "bin": { - "speedscope": "./bin/cli.mjs" - }, + "bin": "./bin/cli.mjs", "scripts": { "deploy": "./scripts/deploy.sh", "prepack": "./scripts/prepack.sh --outdir \"$(pwd)/dist/release\" --protocol file", @@ -46,7 +44,6 @@ "jsverify": "0.8.3", "jszip": "3.1.5", "pako": "1.0.6", - "preact": "10.4.1", "prettier": "3.1.1", "protobufjs": "6.8.8", "source-map": "0.6.1", @@ -78,6 +75,7 @@ ] }, "dependencies": { - "open": "10.1.0" + "open": "10.1.0", + "preact": "^10.25.3" } } diff --git a/src/app-state/index.ts b/src/app-state/index.ts index 280a30f5f..6c1a967f3 100644 --- a/src/app-state/index.ts +++ b/src/app-state/index.ts @@ -1,7 +1,11 @@ import {Atom} from '../lib/atom' import {ViewMode} from '../lib/view-mode' import {getHashParams, HashParams} from '../lib/hash-params' -import {ProfileGroupAtom} from './profile-group' +import {ProfileGroupAtom, Metadata} from './profile-group' +import { VNode } from 'preact' +import { MutableRef } from 'preact/hooks' +import { Application } from '../views/application' +import { HoveredPoint } from '../lib/utils' // True if recursion should be flattened when viewing flamegraphs export const flattenRecursionAtom = new Atom(false, 'flattenRecursion') @@ -51,6 +55,46 @@ export const loadingAtom = new Atom(isImmediatelyLoading, 'loading') // imported was invalid. export const errorAtom = new Atom(false, 'error') +// Stores the metadata of loaded profile +export const metadataAtom = new Atom(null, 'metadata'); + +// Type for the function that returns Element with a welcome message +type WelcomeMessageFunc = (divClass: string, pClass: string, aClass: string, browseButton: VNode) => VNode +export type CustomWelcomeMessage = { + // Default message when no profile is loaded + default?: WelcomeMessageFunc +} + +export const customWelcomeMessagesAtom = new Atom({}, 'welcomeMessage') + +// The optional toolbar config - undefined fields fall back to the default behavior +interface ToolbarConfig { + // The title of toolbar, displayed when no profile is loaded + title?: string, + // Whether import button should be displayed + importButton?: boolean, + // Whether export button should be displayed + exportButton?: boolean, + // Whether theme button should be displayed + themeButton?: boolean, + // Whether help button should be displayed + helpButton?: boolean, + // Whether importing with drag&drop should be enabled + dragImport?: boolean, +} + +// The state indicating whether loaded profile contains only metadata +export const metadataOnlyProfileAtom = new Atom(false, 'metadataOnlyProfile'); + +// The toolbar configuration allowing to change title or disable buttons +export const toolbarConfigAtom = new Atom({}, 'toolbarConfig') + +// The reference to the object with application +export const appRefAtom = new Atom | null>(null, 'appRef'); + +// The coordinates of hovered point +export const timestampHoveredAtom = new Atom(null, 'timestampHovered'); + export enum SortField { SYMBOL_NAME, SELF, @@ -68,7 +112,7 @@ export interface SortMethod { } // The table sorting method using for the sandwich view, specifying the column -// to sort by, and the direction to sort that clumn. +// to sort by, and the direction to sort that column. export const tableSortMethodAtom = new Atom( { field: SortField.SELF, diff --git a/src/app-state/profile-group.ts b/src/app-state/profile-group.ts index d294a4f16..eb2d63316 100644 --- a/src/app-state/profile-group.ts +++ b/src/app-state/profile-group.ts @@ -30,6 +30,28 @@ export interface ProfileState { sandwichViewState: SandwichViewState } +export interface Metadata { + // The process ID for the process that output this event. + pid: number + + // The thread ID for the thread that output this event. + tid: number + + // The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity. + ts: number + + // The thread clock timestamp of the event. The timestamps are provided at microsecond granularity. + tts?: number + + // The name of the event, as displayed in Trace Viewer + name?: string + + // The event categories. This is a comma separated list of categories for the event. The categories can be used to hide events in the Trace Viewer UI. + cat?: string + + // Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section. + args?: any +} export type ProfileGroupState = { name: string diff --git a/src/gl/flamechart-color-pass-renderer.ts b/src/gl/flamechart-color-pass-renderer.ts index e0b273f26..3c571ae73 100644 --- a/src/gl/flamechart-color-pass-renderer.ts +++ b/src/gl/flamechart-color-pass-renderer.ts @@ -122,6 +122,10 @@ export class FlamechartColorPassRenderer { this.buffer = gl.createVertexBuffer(vertexFormat.stride * vertices.length) this.buffer.uploadFloats(floats) + this.updateMaterial(gl, theme) + } + + updateMaterial(gl: Graphics.Context, theme: Theme) { this.material = gl.createMaterial(vertexFormat, vert, frag(theme.colorForBucketGLSL)) } diff --git a/src/import/profile.proto.js b/src/import/profile.proto.js index b8252daff..74cb67675 100644 --- a/src/import/profile.proto.js +++ b/src/import/profile.proto.js @@ -2,3542 +2,3023 @@ // // To regenerate this file, run the following in the repository root: // -// node node_modules/protobufjs/cli/bin/pbjs -t static-module -w commonjs -o src/import/profile.proto.js src/import/profile.proto +// node node_modules/protobufjs/cli/bin/pbjs -t static-module -w es6 -o src/import/profile.proto.js src/import/profile.proto // // Then prepend this comment to the result. /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -'use strict' - -var $protobuf = require('protobufjs/minimal') +import * as $protobuf from "protobufjs/minimal"; // Common aliases -var $Reader = $protobuf.Reader, - $Writer = $protobuf.Writer, - $util = $protobuf.util +const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace -var $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {}) +const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); -$root.perftools = (function() { - /** - * Namespace perftools. - * @exports perftools - * @namespace - */ - var perftools = {} +export const perftools = $root.perftools = (() => { - perftools.profiles = (function() { /** - * Namespace profiles. - * @memberof perftools + * Namespace perftools. + * @exports perftools * @namespace */ - var profiles = {} - - profiles.Profile = (function() { - /** - * Properties of a Profile. - * @memberof perftools.profiles - * @interface IProfile - * @property {Array.|null} [sampleType] Profile sampleType - * @property {Array.|null} [sample] Profile sample - * @property {Array.|null} [mapping] Profile mapping - * @property {Array.|null} [location] Profile location - * @property {Array.|null} ["function"] Profile function - * @property {Array.|null} [stringTable] Profile stringTable - * @property {number|Long|null} [dropFrames] Profile dropFrames - * @property {number|Long|null} [keepFrames] Profile keepFrames - * @property {number|Long|null} [timeNanos] Profile timeNanos - * @property {number|Long|null} [durationNanos] Profile durationNanos - * @property {perftools.profiles.IValueType|null} [periodType] Profile periodType - * @property {number|Long|null} [period] Profile period - * @property {Array.|null} [comment] Profile comment - * @property {number|Long|null} [defaultSampleType] Profile defaultSampleType - */ - - /** - * Constructs a new Profile. - * @memberof perftools.profiles - * @classdesc Represents a Profile. - * @implements IProfile - * @constructor - * @param {perftools.profiles.IProfile=} [properties] Properties to set - */ - function Profile(properties) { - this.sampleType = [] - this.sample = [] - this.mapping = [] - this.location = [] - this['function'] = [] - this.stringTable = [] - this.comment = [] - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Profile sampleType. - * @member {Array.} sampleType - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.sampleType = $util.emptyArray - - /** - * Profile sample. - * @member {Array.} sample - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.sample = $util.emptyArray - - /** - * Profile mapping. - * @member {Array.} mapping - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.mapping = $util.emptyArray - - /** - * Profile location. - * @member {Array.} location - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.location = $util.emptyArray - - /** - * Profile function. - * @member {Array.} function - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype['function'] = $util.emptyArray - - /** - * Profile stringTable. - * @member {Array.} stringTable - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.stringTable = $util.emptyArray - - /** - * Profile dropFrames. - * @member {number|Long} dropFrames - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.dropFrames = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Profile keepFrames. - * @member {number|Long} keepFrames - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.keepFrames = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Profile timeNanos. - * @member {number|Long} timeNanos - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.timeNanos = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Profile durationNanos. - * @member {number|Long} durationNanos - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.durationNanos = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Profile periodType. - * @member {perftools.profiles.IValueType|null|undefined} periodType - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.periodType = null - - /** - * Profile period. - * @member {number|Long} period - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.period = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Profile comment. - * @member {Array.} comment - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.comment = $util.emptyArray - - /** - * Profile defaultSampleType. - * @member {number|Long} defaultSampleType - * @memberof perftools.profiles.Profile - * @instance - */ - Profile.prototype.defaultSampleType = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Creates a new Profile instance using the specified properties. - * @function create - * @memberof perftools.profiles.Profile - * @static - * @param {perftools.profiles.IProfile=} [properties] Properties to set - * @returns {perftools.profiles.Profile} Profile instance - */ - Profile.create = function create(properties) { - return new Profile(properties) - } - - /** - * Encodes the specified Profile message. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Profile - * @static - * @param {perftools.profiles.IProfile} message Profile message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Profile.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.sampleType != null && message.sampleType.length) - for (var i = 0; i < message.sampleType.length; ++i) - $root.perftools.profiles.ValueType.encode( - message.sampleType[i], - writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), - ).ldelim() - if (message.sample != null && message.sample.length) - for (var i = 0; i < message.sample.length; ++i) - $root.perftools.profiles.Sample.encode( - message.sample[i], - writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), - ).ldelim() - if (message.mapping != null && message.mapping.length) - for (var i = 0; i < message.mapping.length; ++i) - $root.perftools.profiles.Mapping.encode( - message.mapping[i], - writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), - ).ldelim() - if (message.location != null && message.location.length) - for (var i = 0; i < message.location.length; ++i) - $root.perftools.profiles.Location.encode( - message.location[i], - writer.uint32(/* id 4, wireType 2 =*/ 34).fork(), - ).ldelim() - if (message['function'] != null && message['function'].length) - for (var i = 0; i < message['function'].length; ++i) - $root.perftools.profiles.Function.encode( - message['function'][i], - writer.uint32(/* id 5, wireType 2 =*/ 42).fork(), - ).ldelim() - if (message.stringTable != null && message.stringTable.length) - for (var i = 0; i < message.stringTable.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.stringTable[i]) - if (message.dropFrames != null && message.hasOwnProperty('dropFrames')) - writer.uint32(/* id 7, wireType 0 =*/ 56).int64(message.dropFrames) - if (message.keepFrames != null && message.hasOwnProperty('keepFrames')) - writer.uint32(/* id 8, wireType 0 =*/ 64).int64(message.keepFrames) - if (message.timeNanos != null && message.hasOwnProperty('timeNanos')) - writer.uint32(/* id 9, wireType 0 =*/ 72).int64(message.timeNanos) - if (message.durationNanos != null && message.hasOwnProperty('durationNanos')) - writer.uint32(/* id 10, wireType 0 =*/ 80).int64(message.durationNanos) - if (message.periodType != null && message.hasOwnProperty('periodType')) - $root.perftools.profiles.ValueType.encode( - message.periodType, - writer.uint32(/* id 11, wireType 2 =*/ 90).fork(), - ).ldelim() - if (message.period != null && message.hasOwnProperty('period')) - writer.uint32(/* id 12, wireType 0 =*/ 96).int64(message.period) - if (message.comment != null && message.comment.length) { - writer.uint32(/* id 13, wireType 2 =*/ 106).fork() - for (var i = 0; i < message.comment.length; ++i) writer.int64(message.comment[i]) - writer.ldelim() - } - if (message.defaultSampleType != null && message.hasOwnProperty('defaultSampleType')) - writer.uint32(/* id 14, wireType 0 =*/ 112).int64(message.defaultSampleType) - return writer - } - - /** - * Encodes the specified Profile message, length delimited. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Profile - * @static - * @param {perftools.profiles.IProfile} message Profile message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Profile.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Profile message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Profile - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Profile} Profile - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Profile.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Profile() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (!(message.sampleType && message.sampleType.length)) message.sampleType = [] - message.sampleType.push( - $root.perftools.profiles.ValueType.decode(reader, reader.uint32()), - ) - break - case 2: - if (!(message.sample && message.sample.length)) message.sample = [] - message.sample.push($root.perftools.profiles.Sample.decode(reader, reader.uint32())) - break - case 3: - if (!(message.mapping && message.mapping.length)) message.mapping = [] - message.mapping.push($root.perftools.profiles.Mapping.decode(reader, reader.uint32())) - break - case 4: - if (!(message.location && message.location.length)) message.location = [] - message.location.push( - $root.perftools.profiles.Location.decode(reader, reader.uint32()), - ) - break - case 5: - if (!(message['function'] && message['function'].length)) message['function'] = [] - message['function'].push( - $root.perftools.profiles.Function.decode(reader, reader.uint32()), - ) - break - case 6: - if (!(message.stringTable && message.stringTable.length)) message.stringTable = [] - message.stringTable.push(reader.string()) - break - case 7: - message.dropFrames = reader.int64() - break - case 8: - message.keepFrames = reader.int64() - break - case 9: - message.timeNanos = reader.int64() - break - case 10: - message.durationNanos = reader.int64() - break - case 11: - message.periodType = $root.perftools.profiles.ValueType.decode( - reader, - reader.uint32(), - ) - break - case 12: - message.period = reader.int64() - break - case 13: - if (!(message.comment && message.comment.length)) message.comment = [] - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos - while (reader.pos < end2) message.comment.push(reader.int64()) - } else message.comment.push(reader.int64()) - break - case 14: - message.defaultSampleType = reader.int64() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Profile message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Profile - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Profile} Profile - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Profile.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Profile message. - * @function verify - * @memberof perftools.profiles.Profile - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Profile.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.sampleType != null && message.hasOwnProperty('sampleType')) { - if (!Array.isArray(message.sampleType)) return 'sampleType: array expected' - for (var i = 0; i < message.sampleType.length; ++i) { - var error = $root.perftools.profiles.ValueType.verify(message.sampleType[i]) - if (error) return 'sampleType.' + error - } - } - if (message.sample != null && message.hasOwnProperty('sample')) { - if (!Array.isArray(message.sample)) return 'sample: array expected' - for (var i = 0; i < message.sample.length; ++i) { - var error = $root.perftools.profiles.Sample.verify(message.sample[i]) - if (error) return 'sample.' + error - } - } - if (message.mapping != null && message.hasOwnProperty('mapping')) { - if (!Array.isArray(message.mapping)) return 'mapping: array expected' - for (var i = 0; i < message.mapping.length; ++i) { - var error = $root.perftools.profiles.Mapping.verify(message.mapping[i]) - if (error) return 'mapping.' + error - } - } - if (message.location != null && message.hasOwnProperty('location')) { - if (!Array.isArray(message.location)) return 'location: array expected' - for (var i = 0; i < message.location.length; ++i) { - var error = $root.perftools.profiles.Location.verify(message.location[i]) - if (error) return 'location.' + error - } - } - if (message['function'] != null && message.hasOwnProperty('function')) { - if (!Array.isArray(message['function'])) return 'function: array expected' - for (var i = 0; i < message['function'].length; ++i) { - var error = $root.perftools.profiles.Function.verify(message['function'][i]) - if (error) return 'function.' + error - } - } - if (message.stringTable != null && message.hasOwnProperty('stringTable')) { - if (!Array.isArray(message.stringTable)) return 'stringTable: array expected' - for (var i = 0; i < message.stringTable.length; ++i) - if (!$util.isString(message.stringTable[i])) return 'stringTable: string[] expected' - } - if (message.dropFrames != null && message.hasOwnProperty('dropFrames')) - if ( - !$util.isInteger(message.dropFrames) && - !( - message.dropFrames && - $util.isInteger(message.dropFrames.low) && - $util.isInteger(message.dropFrames.high) - ) - ) - return 'dropFrames: integer|Long expected' - if (message.keepFrames != null && message.hasOwnProperty('keepFrames')) - if ( - !$util.isInteger(message.keepFrames) && - !( - message.keepFrames && - $util.isInteger(message.keepFrames.low) && - $util.isInteger(message.keepFrames.high) - ) - ) - return 'keepFrames: integer|Long expected' - if (message.timeNanos != null && message.hasOwnProperty('timeNanos')) - if ( - !$util.isInteger(message.timeNanos) && - !( - message.timeNanos && - $util.isInteger(message.timeNanos.low) && - $util.isInteger(message.timeNanos.high) - ) - ) - return 'timeNanos: integer|Long expected' - if (message.durationNanos != null && message.hasOwnProperty('durationNanos')) - if ( - !$util.isInteger(message.durationNanos) && - !( - message.durationNanos && - $util.isInteger(message.durationNanos.low) && - $util.isInteger(message.durationNanos.high) - ) - ) - return 'durationNanos: integer|Long expected' - if (message.periodType != null && message.hasOwnProperty('periodType')) { - var error = $root.perftools.profiles.ValueType.verify(message.periodType) - if (error) return 'periodType.' + error - } - if (message.period != null && message.hasOwnProperty('period')) - if ( - !$util.isInteger(message.period) && - !( - message.period && - $util.isInteger(message.period.low) && - $util.isInteger(message.period.high) - ) - ) - return 'period: integer|Long expected' - if (message.comment != null && message.hasOwnProperty('comment')) { - if (!Array.isArray(message.comment)) return 'comment: array expected' - for (var i = 0; i < message.comment.length; ++i) - if ( - !$util.isInteger(message.comment[i]) && - !( - message.comment[i] && - $util.isInteger(message.comment[i].low) && - $util.isInteger(message.comment[i].high) - ) - ) - return 'comment: integer|Long[] expected' - } - if (message.defaultSampleType != null && message.hasOwnProperty('defaultSampleType')) - if ( - !$util.isInteger(message.defaultSampleType) && - !( - message.defaultSampleType && - $util.isInteger(message.defaultSampleType.low) && - $util.isInteger(message.defaultSampleType.high) - ) - ) - return 'defaultSampleType: integer|Long expected' - return null - } - - /** - * Creates a Profile message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Profile - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Profile} Profile - */ - Profile.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Profile) return object - var message = new $root.perftools.profiles.Profile() - if (object.sampleType) { - if (!Array.isArray(object.sampleType)) - throw TypeError('.perftools.profiles.Profile.sampleType: array expected') - message.sampleType = [] - for (var i = 0; i < object.sampleType.length; ++i) { - if (typeof object.sampleType[i] !== 'object') - throw TypeError('.perftools.profiles.Profile.sampleType: object expected') - message.sampleType[i] = $root.perftools.profiles.ValueType.fromObject( - object.sampleType[i], - ) - } - } - if (object.sample) { - if (!Array.isArray(object.sample)) - throw TypeError('.perftools.profiles.Profile.sample: array expected') - message.sample = [] - for (var i = 0; i < object.sample.length; ++i) { - if (typeof object.sample[i] !== 'object') - throw TypeError('.perftools.profiles.Profile.sample: object expected') - message.sample[i] = $root.perftools.profiles.Sample.fromObject(object.sample[i]) - } - } - if (object.mapping) { - if (!Array.isArray(object.mapping)) - throw TypeError('.perftools.profiles.Profile.mapping: array expected') - message.mapping = [] - for (var i = 0; i < object.mapping.length; ++i) { - if (typeof object.mapping[i] !== 'object') - throw TypeError('.perftools.profiles.Profile.mapping: object expected') - message.mapping[i] = $root.perftools.profiles.Mapping.fromObject(object.mapping[i]) - } - } - if (object.location) { - if (!Array.isArray(object.location)) - throw TypeError('.perftools.profiles.Profile.location: array expected') - message.location = [] - for (var i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== 'object') - throw TypeError('.perftools.profiles.Profile.location: object expected') - message.location[i] = $root.perftools.profiles.Location.fromObject(object.location[i]) - } - } - if (object['function']) { - if (!Array.isArray(object['function'])) - throw TypeError('.perftools.profiles.Profile.function: array expected') - message['function'] = [] - for (var i = 0; i < object['function'].length; ++i) { - if (typeof object['function'][i] !== 'object') - throw TypeError('.perftools.profiles.Profile.function: object expected') - message['function'][i] = $root.perftools.profiles.Function.fromObject( - object['function'][i], - ) - } - } - if (object.stringTable) { - if (!Array.isArray(object.stringTable)) - throw TypeError('.perftools.profiles.Profile.stringTable: array expected') - message.stringTable = [] - for (var i = 0; i < object.stringTable.length; ++i) - message.stringTable[i] = String(object.stringTable[i]) - } - if (object.dropFrames != null) - if ($util.Long) - (message.dropFrames = $util.Long.fromValue(object.dropFrames)).unsigned = false - else if (typeof object.dropFrames === 'string') - message.dropFrames = parseInt(object.dropFrames, 10) - else if (typeof object.dropFrames === 'number') message.dropFrames = object.dropFrames - else if (typeof object.dropFrames === 'object') - message.dropFrames = new $util.LongBits( - object.dropFrames.low >>> 0, - object.dropFrames.high >>> 0, - ).toNumber() - if (object.keepFrames != null) - if ($util.Long) - (message.keepFrames = $util.Long.fromValue(object.keepFrames)).unsigned = false - else if (typeof object.keepFrames === 'string') - message.keepFrames = parseInt(object.keepFrames, 10) - else if (typeof object.keepFrames === 'number') message.keepFrames = object.keepFrames - else if (typeof object.keepFrames === 'object') - message.keepFrames = new $util.LongBits( - object.keepFrames.low >>> 0, - object.keepFrames.high >>> 0, - ).toNumber() - if (object.timeNanos != null) - if ($util.Long) - (message.timeNanos = $util.Long.fromValue(object.timeNanos)).unsigned = false - else if (typeof object.timeNanos === 'string') - message.timeNanos = parseInt(object.timeNanos, 10) - else if (typeof object.timeNanos === 'number') message.timeNanos = object.timeNanos - else if (typeof object.timeNanos === 'object') - message.timeNanos = new $util.LongBits( - object.timeNanos.low >>> 0, - object.timeNanos.high >>> 0, - ).toNumber() - if (object.durationNanos != null) - if ($util.Long) - (message.durationNanos = $util.Long.fromValue(object.durationNanos)).unsigned = false - else if (typeof object.durationNanos === 'string') - message.durationNanos = parseInt(object.durationNanos, 10) - else if (typeof object.durationNanos === 'number') - message.durationNanos = object.durationNanos - else if (typeof object.durationNanos === 'object') - message.durationNanos = new $util.LongBits( - object.durationNanos.low >>> 0, - object.durationNanos.high >>> 0, - ).toNumber() - if (object.periodType != null) { - if (typeof object.periodType !== 'object') - throw TypeError('.perftools.profiles.Profile.periodType: object expected') - message.periodType = $root.perftools.profiles.ValueType.fromObject(object.periodType) - } - if (object.period != null) - if ($util.Long) (message.period = $util.Long.fromValue(object.period)).unsigned = false - else if (typeof object.period === 'string') message.period = parseInt(object.period, 10) - else if (typeof object.period === 'number') message.period = object.period - else if (typeof object.period === 'object') - message.period = new $util.LongBits( - object.period.low >>> 0, - object.period.high >>> 0, - ).toNumber() - if (object.comment) { - if (!Array.isArray(object.comment)) - throw TypeError('.perftools.profiles.Profile.comment: array expected') - message.comment = [] - for (var i = 0; i < object.comment.length; ++i) - if ($util.Long) - (message.comment[i] = $util.Long.fromValue(object.comment[i])).unsigned = false - else if (typeof object.comment[i] === 'string') - message.comment[i] = parseInt(object.comment[i], 10) - else if (typeof object.comment[i] === 'number') message.comment[i] = object.comment[i] - else if (typeof object.comment[i] === 'object') - message.comment[i] = new $util.LongBits( - object.comment[i].low >>> 0, - object.comment[i].high >>> 0, - ).toNumber() - } - if (object.defaultSampleType != null) - if ($util.Long) - (message.defaultSampleType = $util.Long.fromValue( - object.defaultSampleType, - )).unsigned = false - else if (typeof object.defaultSampleType === 'string') - message.defaultSampleType = parseInt(object.defaultSampleType, 10) - else if (typeof object.defaultSampleType === 'number') - message.defaultSampleType = object.defaultSampleType - else if (typeof object.defaultSampleType === 'object') - message.defaultSampleType = new $util.LongBits( - object.defaultSampleType.low >>> 0, - object.defaultSampleType.high >>> 0, - ).toNumber() - return message - } - - /** - * Creates a plain object from a Profile message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Profile - * @static - * @param {perftools.profiles.Profile} message Profile - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Profile.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.arrays || options.defaults) { - object.sampleType = [] - object.sample = [] - object.mapping = [] - object.location = [] - object['function'] = [] - object.stringTable = [] - object.comment = [] - } - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.dropFrames = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.dropFrames = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.keepFrames = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.keepFrames = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.timeNanos = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.timeNanos = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.durationNanos = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.durationNanos = options.longs === String ? '0' : 0 - object.periodType = null - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.period = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.period = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.defaultSampleType = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.defaultSampleType = options.longs === String ? '0' : 0 - } - if (message.sampleType && message.sampleType.length) { - object.sampleType = [] - for (var j = 0; j < message.sampleType.length; ++j) - object.sampleType[j] = $root.perftools.profiles.ValueType.toObject( - message.sampleType[j], - options, - ) - } - if (message.sample && message.sample.length) { - object.sample = [] - for (var j = 0; j < message.sample.length; ++j) - object.sample[j] = $root.perftools.profiles.Sample.toObject(message.sample[j], options) - } - if (message.mapping && message.mapping.length) { - object.mapping = [] - for (var j = 0; j < message.mapping.length; ++j) - object.mapping[j] = $root.perftools.profiles.Mapping.toObject( - message.mapping[j], - options, - ) - } - if (message.location && message.location.length) { - object.location = [] - for (var j = 0; j < message.location.length; ++j) - object.location[j] = $root.perftools.profiles.Location.toObject( - message.location[j], - options, - ) - } - if (message['function'] && message['function'].length) { - object['function'] = [] - for (var j = 0; j < message['function'].length; ++j) - object['function'][j] = $root.perftools.profiles.Function.toObject( - message['function'][j], - options, - ) - } - if (message.stringTable && message.stringTable.length) { - object.stringTable = [] - for (var j = 0; j < message.stringTable.length; ++j) - object.stringTable[j] = message.stringTable[j] - } - if (message.dropFrames != null && message.hasOwnProperty('dropFrames')) - if (typeof message.dropFrames === 'number') - object.dropFrames = - options.longs === String ? String(message.dropFrames) : message.dropFrames - else - object.dropFrames = - options.longs === String - ? $util.Long.prototype.toString.call(message.dropFrames) - : options.longs === Number - ? new $util.LongBits( - message.dropFrames.low >>> 0, - message.dropFrames.high >>> 0, - ).toNumber() - : message.dropFrames - if (message.keepFrames != null && message.hasOwnProperty('keepFrames')) - if (typeof message.keepFrames === 'number') - object.keepFrames = - options.longs === String ? String(message.keepFrames) : message.keepFrames - else - object.keepFrames = - options.longs === String - ? $util.Long.prototype.toString.call(message.keepFrames) - : options.longs === Number - ? new $util.LongBits( - message.keepFrames.low >>> 0, - message.keepFrames.high >>> 0, - ).toNumber() - : message.keepFrames - if (message.timeNanos != null && message.hasOwnProperty('timeNanos')) - if (typeof message.timeNanos === 'number') - object.timeNanos = - options.longs === String ? String(message.timeNanos) : message.timeNanos - else - object.timeNanos = - options.longs === String - ? $util.Long.prototype.toString.call(message.timeNanos) - : options.longs === Number - ? new $util.LongBits( - message.timeNanos.low >>> 0, - message.timeNanos.high >>> 0, - ).toNumber() - : message.timeNanos - if (message.durationNanos != null && message.hasOwnProperty('durationNanos')) - if (typeof message.durationNanos === 'number') - object.durationNanos = - options.longs === String ? String(message.durationNanos) : message.durationNanos - else - object.durationNanos = - options.longs === String - ? $util.Long.prototype.toString.call(message.durationNanos) - : options.longs === Number - ? new $util.LongBits( - message.durationNanos.low >>> 0, - message.durationNanos.high >>> 0, - ).toNumber() - : message.durationNanos - if (message.periodType != null && message.hasOwnProperty('periodType')) - object.periodType = $root.perftools.profiles.ValueType.toObject( - message.periodType, - options, - ) - if (message.period != null && message.hasOwnProperty('period')) - if (typeof message.period === 'number') - object.period = options.longs === String ? String(message.period) : message.period - else - object.period = - options.longs === String - ? $util.Long.prototype.toString.call(message.period) - : options.longs === Number - ? new $util.LongBits( - message.period.low >>> 0, - message.period.high >>> 0, - ).toNumber() - : message.period - if (message.comment && message.comment.length) { - object.comment = [] - for (var j = 0; j < message.comment.length; ++j) - if (typeof message.comment[j] === 'number') - object.comment[j] = - options.longs === String ? String(message.comment[j]) : message.comment[j] - else - object.comment[j] = - options.longs === String - ? $util.Long.prototype.toString.call(message.comment[j]) - : options.longs === Number - ? new $util.LongBits( - message.comment[j].low >>> 0, - message.comment[j].high >>> 0, - ).toNumber() - : message.comment[j] - } - if (message.defaultSampleType != null && message.hasOwnProperty('defaultSampleType')) - if (typeof message.defaultSampleType === 'number') - object.defaultSampleType = - options.longs === String - ? String(message.defaultSampleType) - : message.defaultSampleType - else - object.defaultSampleType = - options.longs === String - ? $util.Long.prototype.toString.call(message.defaultSampleType) - : options.longs === Number - ? new $util.LongBits( - message.defaultSampleType.low >>> 0, - message.defaultSampleType.high >>> 0, - ).toNumber() - : message.defaultSampleType - return object - } - - /** - * Converts this Profile to JSON. - * @function toJSON - * @memberof perftools.profiles.Profile - * @instance - * @returns {Object.} JSON object - */ - Profile.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Profile - })() - - profiles.ValueType = (function() { - /** - * Properties of a ValueType. - * @memberof perftools.profiles - * @interface IValueType - * @property {number|Long|null} [type] ValueType type - * @property {number|Long|null} [unit] ValueType unit - */ - - /** - * Constructs a new ValueType. - * @memberof perftools.profiles - * @classdesc Represents a ValueType. - * @implements IValueType - * @constructor - * @param {perftools.profiles.IValueType=} [properties] Properties to set - */ - function ValueType(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * ValueType type. - * @member {number|Long} type - * @memberof perftools.profiles.ValueType - * @instance - */ - ValueType.prototype.type = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * ValueType unit. - * @member {number|Long} unit - * @memberof perftools.profiles.ValueType - * @instance - */ - ValueType.prototype.unit = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Creates a new ValueType instance using the specified properties. - * @function create - * @memberof perftools.profiles.ValueType - * @static - * @param {perftools.profiles.IValueType=} [properties] Properties to set - * @returns {perftools.profiles.ValueType} ValueType instance - */ - ValueType.create = function create(properties) { - return new ValueType(properties) - } - - /** - * Encodes the specified ValueType message. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.ValueType - * @static - * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueType.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.type != null && message.hasOwnProperty('type')) - writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.type) - if (message.unit != null && message.hasOwnProperty('unit')) - writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.unit) - return writer - } - - /** - * Encodes the specified ValueType message, length delimited. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.ValueType - * @static - * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueType.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a ValueType message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.ValueType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.ValueType} ValueType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueType.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.ValueType() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.type = reader.int64() - break - case 2: - message.unit = reader.int64() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a ValueType message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.ValueType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.ValueType} ValueType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueType.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a ValueType message. - * @function verify - * @memberof perftools.profiles.ValueType - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValueType.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.type != null && message.hasOwnProperty('type')) - if ( - !$util.isInteger(message.type) && - !( - message.type && - $util.isInteger(message.type.low) && - $util.isInteger(message.type.high) - ) - ) - return 'type: integer|Long expected' - if (message.unit != null && message.hasOwnProperty('unit')) - if ( - !$util.isInteger(message.unit) && - !( - message.unit && - $util.isInteger(message.unit.low) && - $util.isInteger(message.unit.high) - ) - ) - return 'unit: integer|Long expected' - return null - } - - /** - * Creates a ValueType message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.ValueType - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.ValueType} ValueType - */ - ValueType.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.ValueType) return object - var message = new $root.perftools.profiles.ValueType() - if (object.type != null) - if ($util.Long) (message.type = $util.Long.fromValue(object.type)).unsigned = false - else if (typeof object.type === 'string') message.type = parseInt(object.type, 10) - else if (typeof object.type === 'number') message.type = object.type - else if (typeof object.type === 'object') - message.type = new $util.LongBits( - object.type.low >>> 0, - object.type.high >>> 0, - ).toNumber() - if (object.unit != null) - if ($util.Long) (message.unit = $util.Long.fromValue(object.unit)).unsigned = false - else if (typeof object.unit === 'string') message.unit = parseInt(object.unit, 10) - else if (typeof object.unit === 'number') message.unit = object.unit - else if (typeof object.unit === 'object') - message.unit = new $util.LongBits( - object.unit.low >>> 0, - object.unit.high >>> 0, - ).toNumber() - return message - } - - /** - * Creates a plain object from a ValueType message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.ValueType - * @static - * @param {perftools.profiles.ValueType} message ValueType - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValueType.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.type = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.type = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.unit = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.unit = options.longs === String ? '0' : 0 - } - if (message.type != null && message.hasOwnProperty('type')) - if (typeof message.type === 'number') - object.type = options.longs === String ? String(message.type) : message.type - else - object.type = - options.longs === String - ? $util.Long.prototype.toString.call(message.type) - : options.longs === Number - ? new $util.LongBits(message.type.low >>> 0, message.type.high >>> 0).toNumber() - : message.type - if (message.unit != null && message.hasOwnProperty('unit')) - if (typeof message.unit === 'number') - object.unit = options.longs === String ? String(message.unit) : message.unit - else - object.unit = - options.longs === String - ? $util.Long.prototype.toString.call(message.unit) - : options.longs === Number - ? new $util.LongBits(message.unit.low >>> 0, message.unit.high >>> 0).toNumber() - : message.unit - return object - } - - /** - * Converts this ValueType to JSON. - * @function toJSON - * @memberof perftools.profiles.ValueType - * @instance - * @returns {Object.} JSON object - */ - ValueType.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return ValueType - })() - - profiles.Sample = (function() { - /** - * Properties of a Sample. - * @memberof perftools.profiles - * @interface ISample - * @property {Array.|null} [locationId] Sample locationId - * @property {Array.|null} [value] Sample value - * @property {Array.|null} [label] Sample label - */ - - /** - * Constructs a new Sample. - * @memberof perftools.profiles - * @classdesc Represents a Sample. - * @implements ISample - * @constructor - * @param {perftools.profiles.ISample=} [properties] Properties to set - */ - function Sample(properties) { - this.locationId = [] - this.value = [] - this.label = [] - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Sample locationId. - * @member {Array.} locationId - * @memberof perftools.profiles.Sample - * @instance - */ - Sample.prototype.locationId = $util.emptyArray - - /** - * Sample value. - * @member {Array.} value - * @memberof perftools.profiles.Sample - * @instance - */ - Sample.prototype.value = $util.emptyArray - - /** - * Sample label. - * @member {Array.} label - * @memberof perftools.profiles.Sample - * @instance - */ - Sample.prototype.label = $util.emptyArray - - /** - * Creates a new Sample instance using the specified properties. - * @function create - * @memberof perftools.profiles.Sample - * @static - * @param {perftools.profiles.ISample=} [properties] Properties to set - * @returns {perftools.profiles.Sample} Sample instance - */ - Sample.create = function create(properties) { - return new Sample(properties) - } - - /** - * Encodes the specified Sample message. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Sample - * @static - * @param {perftools.profiles.ISample} message Sample message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Sample.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.locationId != null && message.locationId.length) { - writer.uint32(/* id 1, wireType 2 =*/ 10).fork() - for (var i = 0; i < message.locationId.length; ++i) writer.uint64(message.locationId[i]) - writer.ldelim() - } - if (message.value != null && message.value.length) { - writer.uint32(/* id 2, wireType 2 =*/ 18).fork() - for (var i = 0; i < message.value.length; ++i) writer.int64(message.value[i]) - writer.ldelim() - } - if (message.label != null && message.label.length) - for (var i = 0; i < message.label.length; ++i) - $root.perftools.profiles.Label.encode( - message.label[i], - writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), - ).ldelim() - return writer - } - - /** - * Encodes the specified Sample message, length delimited. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Sample - * @static - * @param {perftools.profiles.ISample} message Sample message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Sample.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Sample message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Sample - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Sample} Sample - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Sample.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Sample() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (!(message.locationId && message.locationId.length)) message.locationId = [] - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos - while (reader.pos < end2) message.locationId.push(reader.uint64()) - } else message.locationId.push(reader.uint64()) - break - case 2: - if (!(message.value && message.value.length)) message.value = [] - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos - while (reader.pos < end2) message.value.push(reader.int64()) - } else message.value.push(reader.int64()) - break - case 3: - if (!(message.label && message.label.length)) message.label = [] - message.label.push($root.perftools.profiles.Label.decode(reader, reader.uint32())) - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Sample message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Sample - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Sample} Sample - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Sample.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Sample message. - * @function verify - * @memberof perftools.profiles.Sample - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Sample.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.locationId != null && message.hasOwnProperty('locationId')) { - if (!Array.isArray(message.locationId)) return 'locationId: array expected' - for (var i = 0; i < message.locationId.length; ++i) - if ( - !$util.isInteger(message.locationId[i]) && - !( - message.locationId[i] && - $util.isInteger(message.locationId[i].low) && - $util.isInteger(message.locationId[i].high) - ) - ) - return 'locationId: integer|Long[] expected' - } - if (message.value != null && message.hasOwnProperty('value')) { - if (!Array.isArray(message.value)) return 'value: array expected' - for (var i = 0; i < message.value.length; ++i) - if ( - !$util.isInteger(message.value[i]) && - !( - message.value[i] && - $util.isInteger(message.value[i].low) && - $util.isInteger(message.value[i].high) - ) - ) - return 'value: integer|Long[] expected' - } - if (message.label != null && message.hasOwnProperty('label')) { - if (!Array.isArray(message.label)) return 'label: array expected' - for (var i = 0; i < message.label.length; ++i) { - var error = $root.perftools.profiles.Label.verify(message.label[i]) - if (error) return 'label.' + error - } - } - return null - } - - /** - * Creates a Sample message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Sample - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Sample} Sample - */ - Sample.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Sample) return object - var message = new $root.perftools.profiles.Sample() - if (object.locationId) { - if (!Array.isArray(object.locationId)) - throw TypeError('.perftools.profiles.Sample.locationId: array expected') - message.locationId = [] - for (var i = 0; i < object.locationId.length; ++i) - if ($util.Long) - (message.locationId[i] = $util.Long.fromValue(object.locationId[i])).unsigned = true - else if (typeof object.locationId[i] === 'string') - message.locationId[i] = parseInt(object.locationId[i], 10) - else if (typeof object.locationId[i] === 'number') - message.locationId[i] = object.locationId[i] - else if (typeof object.locationId[i] === 'object') - message.locationId[i] = new $util.LongBits( - object.locationId[i].low >>> 0, - object.locationId[i].high >>> 0, - ).toNumber(true) - } - if (object.value) { - if (!Array.isArray(object.value)) - throw TypeError('.perftools.profiles.Sample.value: array expected') - message.value = [] - for (var i = 0; i < object.value.length; ++i) - if ($util.Long) - (message.value[i] = $util.Long.fromValue(object.value[i])).unsigned = false - else if (typeof object.value[i] === 'string') - message.value[i] = parseInt(object.value[i], 10) - else if (typeof object.value[i] === 'number') message.value[i] = object.value[i] - else if (typeof object.value[i] === 'object') - message.value[i] = new $util.LongBits( - object.value[i].low >>> 0, - object.value[i].high >>> 0, - ).toNumber() - } - if (object.label) { - if (!Array.isArray(object.label)) - throw TypeError('.perftools.profiles.Sample.label: array expected') - message.label = [] - for (var i = 0; i < object.label.length; ++i) { - if (typeof object.label[i] !== 'object') - throw TypeError('.perftools.profiles.Sample.label: object expected') - message.label[i] = $root.perftools.profiles.Label.fromObject(object.label[i]) - } - } - return message - } - - /** - * Creates a plain object from a Sample message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Sample - * @static - * @param {perftools.profiles.Sample} message Sample - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Sample.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.arrays || options.defaults) { - object.locationId = [] - object.value = [] - object.label = [] - } - if (message.locationId && message.locationId.length) { - object.locationId = [] - for (var j = 0; j < message.locationId.length; ++j) - if (typeof message.locationId[j] === 'number') - object.locationId[j] = - options.longs === String ? String(message.locationId[j]) : message.locationId[j] - else - object.locationId[j] = - options.longs === String - ? $util.Long.prototype.toString.call(message.locationId[j]) - : options.longs === Number - ? new $util.LongBits( - message.locationId[j].low >>> 0, - message.locationId[j].high >>> 0, - ).toNumber(true) - : message.locationId[j] - } - if (message.value && message.value.length) { - object.value = [] - for (var j = 0; j < message.value.length; ++j) - if (typeof message.value[j] === 'number') - object.value[j] = - options.longs === String ? String(message.value[j]) : message.value[j] - else - object.value[j] = - options.longs === String - ? $util.Long.prototype.toString.call(message.value[j]) - : options.longs === Number - ? new $util.LongBits( - message.value[j].low >>> 0, - message.value[j].high >>> 0, - ).toNumber() - : message.value[j] - } - if (message.label && message.label.length) { - object.label = [] - for (var j = 0; j < message.label.length; ++j) - object.label[j] = $root.perftools.profiles.Label.toObject(message.label[j], options) - } - return object - } - - /** - * Converts this Sample to JSON. - * @function toJSON - * @memberof perftools.profiles.Sample - * @instance - * @returns {Object.} JSON object - */ - Sample.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Sample - })() - - profiles.Label = (function() { - /** - * Properties of a Label. - * @memberof perftools.profiles - * @interface ILabel - * @property {number|Long|null} [key] Label key - * @property {number|Long|null} [str] Label str - * @property {number|Long|null} [num] Label num - * @property {number|Long|null} [numUnit] Label numUnit - */ - - /** - * Constructs a new Label. - * @memberof perftools.profiles - * @classdesc Represents a Label. - * @implements ILabel - * @constructor - * @param {perftools.profiles.ILabel=} [properties] Properties to set - */ - function Label(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Label key. - * @member {number|Long} key - * @memberof perftools.profiles.Label - * @instance - */ - Label.prototype.key = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Label str. - * @member {number|Long} str - * @memberof perftools.profiles.Label - * @instance - */ - Label.prototype.str = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Label num. - * @member {number|Long} num - * @memberof perftools.profiles.Label - * @instance - */ - Label.prototype.num = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Label numUnit. - * @member {number|Long} numUnit - * @memberof perftools.profiles.Label - * @instance - */ - Label.prototype.numUnit = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Creates a new Label instance using the specified properties. - * @function create - * @memberof perftools.profiles.Label - * @static - * @param {perftools.profiles.ILabel=} [properties] Properties to set - * @returns {perftools.profiles.Label} Label instance - */ - Label.create = function create(properties) { - return new Label(properties) - } - - /** - * Encodes the specified Label message. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Label - * @static - * @param {perftools.profiles.ILabel} message Label message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Label.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.key != null && message.hasOwnProperty('key')) - writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.key) - if (message.str != null && message.hasOwnProperty('str')) - writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.str) - if (message.num != null && message.hasOwnProperty('num')) - writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.num) - if (message.numUnit != null && message.hasOwnProperty('numUnit')) - writer.uint32(/* id 4, wireType 0 =*/ 32).int64(message.numUnit) - return writer - } - - /** - * Encodes the specified Label message, length delimited. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Label - * @static - * @param {perftools.profiles.ILabel} message Label message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Label.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Label message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Label - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Label} Label - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Label.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Label() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.key = reader.int64() - break - case 2: - message.str = reader.int64() - break - case 3: - message.num = reader.int64() - break - case 4: - message.numUnit = reader.int64() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Label message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Label - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Label} Label - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Label.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Label message. - * @function verify - * @memberof perftools.profiles.Label - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Label.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.key != null && message.hasOwnProperty('key')) - if ( - !$util.isInteger(message.key) && - !(message.key && $util.isInteger(message.key.low) && $util.isInteger(message.key.high)) - ) - return 'key: integer|Long expected' - if (message.str != null && message.hasOwnProperty('str')) - if ( - !$util.isInteger(message.str) && - !(message.str && $util.isInteger(message.str.low) && $util.isInteger(message.str.high)) - ) - return 'str: integer|Long expected' - if (message.num != null && message.hasOwnProperty('num')) - if ( - !$util.isInteger(message.num) && - !(message.num && $util.isInteger(message.num.low) && $util.isInteger(message.num.high)) - ) - return 'num: integer|Long expected' - if (message.numUnit != null && message.hasOwnProperty('numUnit')) - if ( - !$util.isInteger(message.numUnit) && - !( - message.numUnit && - $util.isInteger(message.numUnit.low) && - $util.isInteger(message.numUnit.high) - ) - ) - return 'numUnit: integer|Long expected' - return null - } - - /** - * Creates a Label message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Label - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Label} Label - */ - Label.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Label) return object - var message = new $root.perftools.profiles.Label() - if (object.key != null) - if ($util.Long) (message.key = $util.Long.fromValue(object.key)).unsigned = false - else if (typeof object.key === 'string') message.key = parseInt(object.key, 10) - else if (typeof object.key === 'number') message.key = object.key - else if (typeof object.key === 'object') - message.key = new $util.LongBits(object.key.low >>> 0, object.key.high >>> 0).toNumber() - if (object.str != null) - if ($util.Long) (message.str = $util.Long.fromValue(object.str)).unsigned = false - else if (typeof object.str === 'string') message.str = parseInt(object.str, 10) - else if (typeof object.str === 'number') message.str = object.str - else if (typeof object.str === 'object') - message.str = new $util.LongBits(object.str.low >>> 0, object.str.high >>> 0).toNumber() - if (object.num != null) - if ($util.Long) (message.num = $util.Long.fromValue(object.num)).unsigned = false - else if (typeof object.num === 'string') message.num = parseInt(object.num, 10) - else if (typeof object.num === 'number') message.num = object.num - else if (typeof object.num === 'object') - message.num = new $util.LongBits(object.num.low >>> 0, object.num.high >>> 0).toNumber() - if (object.numUnit != null) - if ($util.Long) (message.numUnit = $util.Long.fromValue(object.numUnit)).unsigned = false - else if (typeof object.numUnit === 'string') - message.numUnit = parseInt(object.numUnit, 10) - else if (typeof object.numUnit === 'number') message.numUnit = object.numUnit - else if (typeof object.numUnit === 'object') - message.numUnit = new $util.LongBits( - object.numUnit.low >>> 0, - object.numUnit.high >>> 0, - ).toNumber() - return message - } - - /** - * Creates a plain object from a Label message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Label - * @static - * @param {perftools.profiles.Label} message Label - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Label.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.key = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.key = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.str = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.str = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.num = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.num = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.numUnit = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.numUnit = options.longs === String ? '0' : 0 - } - if (message.key != null && message.hasOwnProperty('key')) - if (typeof message.key === 'number') - object.key = options.longs === String ? String(message.key) : message.key - else - object.key = - options.longs === String - ? $util.Long.prototype.toString.call(message.key) - : options.longs === Number - ? new $util.LongBits(message.key.low >>> 0, message.key.high >>> 0).toNumber() - : message.key - if (message.str != null && message.hasOwnProperty('str')) - if (typeof message.str === 'number') - object.str = options.longs === String ? String(message.str) : message.str - else - object.str = - options.longs === String - ? $util.Long.prototype.toString.call(message.str) - : options.longs === Number - ? new $util.LongBits(message.str.low >>> 0, message.str.high >>> 0).toNumber() - : message.str - if (message.num != null && message.hasOwnProperty('num')) - if (typeof message.num === 'number') - object.num = options.longs === String ? String(message.num) : message.num - else - object.num = - options.longs === String - ? $util.Long.prototype.toString.call(message.num) - : options.longs === Number - ? new $util.LongBits(message.num.low >>> 0, message.num.high >>> 0).toNumber() - : message.num - if (message.numUnit != null && message.hasOwnProperty('numUnit')) - if (typeof message.numUnit === 'number') - object.numUnit = options.longs === String ? String(message.numUnit) : message.numUnit - else - object.numUnit = - options.longs === String - ? $util.Long.prototype.toString.call(message.numUnit) - : options.longs === Number - ? new $util.LongBits( - message.numUnit.low >>> 0, - message.numUnit.high >>> 0, - ).toNumber() - : message.numUnit - return object - } - - /** - * Converts this Label to JSON. - * @function toJSON - * @memberof perftools.profiles.Label - * @instance - * @returns {Object.} JSON object - */ - Label.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Label - })() - - profiles.Mapping = (function() { - /** - * Properties of a Mapping. - * @memberof perftools.profiles - * @interface IMapping - * @property {number|Long|null} [id] Mapping id - * @property {number|Long|null} [memoryStart] Mapping memoryStart - * @property {number|Long|null} [memoryLimit] Mapping memoryLimit - * @property {number|Long|null} [fileOffset] Mapping fileOffset - * @property {number|Long|null} [filename] Mapping filename - * @property {number|Long|null} [buildId] Mapping buildId - * @property {boolean|null} [hasFunctions] Mapping hasFunctions - * @property {boolean|null} [hasFilenames] Mapping hasFilenames - * @property {boolean|null} [hasLineNumbers] Mapping hasLineNumbers - * @property {boolean|null} [hasInlineFrames] Mapping hasInlineFrames - */ - - /** - * Constructs a new Mapping. - * @memberof perftools.profiles - * @classdesc Represents a Mapping. - * @implements IMapping - * @constructor - * @param {perftools.profiles.IMapping=} [properties] Properties to set - */ - function Mapping(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Mapping id. - * @member {number|Long} id - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Mapping memoryStart. - * @member {number|Long} memoryStart - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.memoryStart = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Mapping memoryLimit. - * @member {number|Long} memoryLimit - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.memoryLimit = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Mapping fileOffset. - * @member {number|Long} fileOffset - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.fileOffset = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Mapping filename. - * @member {number|Long} filename - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.filename = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Mapping buildId. - * @member {number|Long} buildId - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.buildId = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Mapping hasFunctions. - * @member {boolean} hasFunctions - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.hasFunctions = false - - /** - * Mapping hasFilenames. - * @member {boolean} hasFilenames - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.hasFilenames = false - - /** - * Mapping hasLineNumbers. - * @member {boolean} hasLineNumbers - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.hasLineNumbers = false - - /** - * Mapping hasInlineFrames. - * @member {boolean} hasInlineFrames - * @memberof perftools.profiles.Mapping - * @instance - */ - Mapping.prototype.hasInlineFrames = false - - /** - * Creates a new Mapping instance using the specified properties. - * @function create - * @memberof perftools.profiles.Mapping - * @static - * @param {perftools.profiles.IMapping=} [properties] Properties to set - * @returns {perftools.profiles.Mapping} Mapping instance - */ - Mapping.create = function create(properties) { - return new Mapping(properties) - } - - /** - * Encodes the specified Mapping message. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Mapping - * @static - * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Mapping.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.id != null && message.hasOwnProperty('id')) - writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.id) - if (message.memoryStart != null && message.hasOwnProperty('memoryStart')) - writer.uint32(/* id 2, wireType 0 =*/ 16).uint64(message.memoryStart) - if (message.memoryLimit != null && message.hasOwnProperty('memoryLimit')) - writer.uint32(/* id 3, wireType 0 =*/ 24).uint64(message.memoryLimit) - if (message.fileOffset != null && message.hasOwnProperty('fileOffset')) - writer.uint32(/* id 4, wireType 0 =*/ 32).uint64(message.fileOffset) - if (message.filename != null && message.hasOwnProperty('filename')) - writer.uint32(/* id 5, wireType 0 =*/ 40).int64(message.filename) - if (message.buildId != null && message.hasOwnProperty('buildId')) - writer.uint32(/* id 6, wireType 0 =*/ 48).int64(message.buildId) - if (message.hasFunctions != null && message.hasOwnProperty('hasFunctions')) - writer.uint32(/* id 7, wireType 0 =*/ 56).bool(message.hasFunctions) - if (message.hasFilenames != null && message.hasOwnProperty('hasFilenames')) - writer.uint32(/* id 8, wireType 0 =*/ 64).bool(message.hasFilenames) - if (message.hasLineNumbers != null && message.hasOwnProperty('hasLineNumbers')) - writer.uint32(/* id 9, wireType 0 =*/ 72).bool(message.hasLineNumbers) - if (message.hasInlineFrames != null && message.hasOwnProperty('hasInlineFrames')) - writer.uint32(/* id 10, wireType 0 =*/ 80).bool(message.hasInlineFrames) - return writer - } - - /** - * Encodes the specified Mapping message, length delimited. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Mapping - * @static - * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Mapping.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Mapping message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Mapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Mapping} Mapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Mapping.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Mapping() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.id = reader.uint64() - break - case 2: - message.memoryStart = reader.uint64() - break - case 3: - message.memoryLimit = reader.uint64() - break - case 4: - message.fileOffset = reader.uint64() - break - case 5: - message.filename = reader.int64() - break - case 6: - message.buildId = reader.int64() - break - case 7: - message.hasFunctions = reader.bool() - break - case 8: - message.hasFilenames = reader.bool() - break - case 9: - message.hasLineNumbers = reader.bool() - break - case 10: - message.hasInlineFrames = reader.bool() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Mapping message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Mapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Mapping} Mapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Mapping.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Mapping message. - * @function verify - * @memberof perftools.profiles.Mapping - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Mapping.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.id != null && message.hasOwnProperty('id')) - if ( - !$util.isInteger(message.id) && - !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)) - ) - return 'id: integer|Long expected' - if (message.memoryStart != null && message.hasOwnProperty('memoryStart')) - if ( - !$util.isInteger(message.memoryStart) && - !( - message.memoryStart && - $util.isInteger(message.memoryStart.low) && - $util.isInteger(message.memoryStart.high) - ) - ) - return 'memoryStart: integer|Long expected' - if (message.memoryLimit != null && message.hasOwnProperty('memoryLimit')) - if ( - !$util.isInteger(message.memoryLimit) && - !( - message.memoryLimit && - $util.isInteger(message.memoryLimit.low) && - $util.isInteger(message.memoryLimit.high) - ) - ) - return 'memoryLimit: integer|Long expected' - if (message.fileOffset != null && message.hasOwnProperty('fileOffset')) - if ( - !$util.isInteger(message.fileOffset) && - !( - message.fileOffset && - $util.isInteger(message.fileOffset.low) && - $util.isInteger(message.fileOffset.high) - ) - ) - return 'fileOffset: integer|Long expected' - if (message.filename != null && message.hasOwnProperty('filename')) - if ( - !$util.isInteger(message.filename) && - !( - message.filename && - $util.isInteger(message.filename.low) && - $util.isInteger(message.filename.high) - ) - ) - return 'filename: integer|Long expected' - if (message.buildId != null && message.hasOwnProperty('buildId')) - if ( - !$util.isInteger(message.buildId) && - !( - message.buildId && - $util.isInteger(message.buildId.low) && - $util.isInteger(message.buildId.high) - ) - ) - return 'buildId: integer|Long expected' - if (message.hasFunctions != null && message.hasOwnProperty('hasFunctions')) - if (typeof message.hasFunctions !== 'boolean') return 'hasFunctions: boolean expected' - if (message.hasFilenames != null && message.hasOwnProperty('hasFilenames')) - if (typeof message.hasFilenames !== 'boolean') return 'hasFilenames: boolean expected' - if (message.hasLineNumbers != null && message.hasOwnProperty('hasLineNumbers')) - if (typeof message.hasLineNumbers !== 'boolean') return 'hasLineNumbers: boolean expected' - if (message.hasInlineFrames != null && message.hasOwnProperty('hasInlineFrames')) - if (typeof message.hasInlineFrames !== 'boolean') - return 'hasInlineFrames: boolean expected' - return null - } - - /** - * Creates a Mapping message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Mapping - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Mapping} Mapping - */ - Mapping.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Mapping) return object - var message = new $root.perftools.profiles.Mapping() - if (object.id != null) - if ($util.Long) (message.id = $util.Long.fromValue(object.id)).unsigned = true - else if (typeof object.id === 'string') message.id = parseInt(object.id, 10) - else if (typeof object.id === 'number') message.id = object.id - else if (typeof object.id === 'object') - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber( - true, - ) - if (object.memoryStart != null) - if ($util.Long) - (message.memoryStart = $util.Long.fromValue(object.memoryStart)).unsigned = true - else if (typeof object.memoryStart === 'string') - message.memoryStart = parseInt(object.memoryStart, 10) - else if (typeof object.memoryStart === 'number') message.memoryStart = object.memoryStart - else if (typeof object.memoryStart === 'object') - message.memoryStart = new $util.LongBits( - object.memoryStart.low >>> 0, - object.memoryStart.high >>> 0, - ).toNumber(true) - if (object.memoryLimit != null) - if ($util.Long) - (message.memoryLimit = $util.Long.fromValue(object.memoryLimit)).unsigned = true - else if (typeof object.memoryLimit === 'string') - message.memoryLimit = parseInt(object.memoryLimit, 10) - else if (typeof object.memoryLimit === 'number') message.memoryLimit = object.memoryLimit - else if (typeof object.memoryLimit === 'object') - message.memoryLimit = new $util.LongBits( - object.memoryLimit.low >>> 0, - object.memoryLimit.high >>> 0, - ).toNumber(true) - if (object.fileOffset != null) - if ($util.Long) - (message.fileOffset = $util.Long.fromValue(object.fileOffset)).unsigned = true - else if (typeof object.fileOffset === 'string') - message.fileOffset = parseInt(object.fileOffset, 10) - else if (typeof object.fileOffset === 'number') message.fileOffset = object.fileOffset - else if (typeof object.fileOffset === 'object') - message.fileOffset = new $util.LongBits( - object.fileOffset.low >>> 0, - object.fileOffset.high >>> 0, - ).toNumber(true) - if (object.filename != null) - if ($util.Long) - (message.filename = $util.Long.fromValue(object.filename)).unsigned = false - else if (typeof object.filename === 'string') - message.filename = parseInt(object.filename, 10) - else if (typeof object.filename === 'number') message.filename = object.filename - else if (typeof object.filename === 'object') - message.filename = new $util.LongBits( - object.filename.low >>> 0, - object.filename.high >>> 0, - ).toNumber() - if (object.buildId != null) - if ($util.Long) (message.buildId = $util.Long.fromValue(object.buildId)).unsigned = false - else if (typeof object.buildId === 'string') - message.buildId = parseInt(object.buildId, 10) - else if (typeof object.buildId === 'number') message.buildId = object.buildId - else if (typeof object.buildId === 'object') - message.buildId = new $util.LongBits( - object.buildId.low >>> 0, - object.buildId.high >>> 0, - ).toNumber() - if (object.hasFunctions != null) message.hasFunctions = Boolean(object.hasFunctions) - if (object.hasFilenames != null) message.hasFilenames = Boolean(object.hasFilenames) - if (object.hasLineNumbers != null) message.hasLineNumbers = Boolean(object.hasLineNumbers) - if (object.hasInlineFrames != null) - message.hasInlineFrames = Boolean(object.hasInlineFrames) - return message - } - - /** - * Creates a plain object from a Mapping message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Mapping - * @static - * @param {perftools.profiles.Mapping} message Mapping - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Mapping.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.id = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.id = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.memoryStart = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.memoryStart = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.memoryLimit = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.memoryLimit = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.fileOffset = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.fileOffset = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.filename = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.filename = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.buildId = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.buildId = options.longs === String ? '0' : 0 - object.hasFunctions = false - object.hasFilenames = false - object.hasLineNumbers = false - object.hasInlineFrames = false - } - if (message.id != null && message.hasOwnProperty('id')) - if (typeof message.id === 'number') - object.id = options.longs === String ? String(message.id) : message.id - else - object.id = - options.longs === String - ? $util.Long.prototype.toString.call(message.id) - : options.longs === Number - ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) - : message.id - if (message.memoryStart != null && message.hasOwnProperty('memoryStart')) - if (typeof message.memoryStart === 'number') - object.memoryStart = - options.longs === String ? String(message.memoryStart) : message.memoryStart - else - object.memoryStart = - options.longs === String - ? $util.Long.prototype.toString.call(message.memoryStart) - : options.longs === Number - ? new $util.LongBits( - message.memoryStart.low >>> 0, - message.memoryStart.high >>> 0, - ).toNumber(true) - : message.memoryStart - if (message.memoryLimit != null && message.hasOwnProperty('memoryLimit')) - if (typeof message.memoryLimit === 'number') - object.memoryLimit = - options.longs === String ? String(message.memoryLimit) : message.memoryLimit - else - object.memoryLimit = - options.longs === String - ? $util.Long.prototype.toString.call(message.memoryLimit) - : options.longs === Number - ? new $util.LongBits( - message.memoryLimit.low >>> 0, - message.memoryLimit.high >>> 0, - ).toNumber(true) - : message.memoryLimit - if (message.fileOffset != null && message.hasOwnProperty('fileOffset')) - if (typeof message.fileOffset === 'number') - object.fileOffset = - options.longs === String ? String(message.fileOffset) : message.fileOffset - else - object.fileOffset = - options.longs === String - ? $util.Long.prototype.toString.call(message.fileOffset) - : options.longs === Number - ? new $util.LongBits( - message.fileOffset.low >>> 0, - message.fileOffset.high >>> 0, - ).toNumber(true) - : message.fileOffset - if (message.filename != null && message.hasOwnProperty('filename')) - if (typeof message.filename === 'number') - object.filename = options.longs === String ? String(message.filename) : message.filename - else - object.filename = - options.longs === String - ? $util.Long.prototype.toString.call(message.filename) - : options.longs === Number - ? new $util.LongBits( - message.filename.low >>> 0, - message.filename.high >>> 0, - ).toNumber() - : message.filename - if (message.buildId != null && message.hasOwnProperty('buildId')) - if (typeof message.buildId === 'number') - object.buildId = options.longs === String ? String(message.buildId) : message.buildId - else - object.buildId = - options.longs === String - ? $util.Long.prototype.toString.call(message.buildId) - : options.longs === Number - ? new $util.LongBits( - message.buildId.low >>> 0, - message.buildId.high >>> 0, - ).toNumber() - : message.buildId - if (message.hasFunctions != null && message.hasOwnProperty('hasFunctions')) - object.hasFunctions = message.hasFunctions - if (message.hasFilenames != null && message.hasOwnProperty('hasFilenames')) - object.hasFilenames = message.hasFilenames - if (message.hasLineNumbers != null && message.hasOwnProperty('hasLineNumbers')) - object.hasLineNumbers = message.hasLineNumbers - if (message.hasInlineFrames != null && message.hasOwnProperty('hasInlineFrames')) - object.hasInlineFrames = message.hasInlineFrames - return object - } - - /** - * Converts this Mapping to JSON. - * @function toJSON - * @memberof perftools.profiles.Mapping - * @instance - * @returns {Object.} JSON object - */ - Mapping.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Mapping - })() - - profiles.Location = (function() { - /** - * Properties of a Location. - * @memberof perftools.profiles - * @interface ILocation - * @property {number|Long|null} [id] Location id - * @property {number|Long|null} [mappingId] Location mappingId - * @property {number|Long|null} [address] Location address - * @property {Array.|null} [line] Location line - * @property {boolean|null} [isFolded] Location isFolded - */ - - /** - * Constructs a new Location. - * @memberof perftools.profiles - * @classdesc Represents a Location. - * @implements ILocation - * @constructor - * @param {perftools.profiles.ILocation=} [properties] Properties to set - */ - function Location(properties) { - this.line = [] - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Location id. - * @member {number|Long} id - * @memberof perftools.profiles.Location - * @instance - */ - Location.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Location mappingId. - * @member {number|Long} mappingId - * @memberof perftools.profiles.Location - * @instance - */ - Location.prototype.mappingId = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Location address. - * @member {number|Long} address - * @memberof perftools.profiles.Location - * @instance - */ - Location.prototype.address = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Location line. - * @member {Array.} line - * @memberof perftools.profiles.Location - * @instance - */ - Location.prototype.line = $util.emptyArray - - /** - * Location isFolded. - * @member {boolean} isFolded - * @memberof perftools.profiles.Location - * @instance - */ - Location.prototype.isFolded = false - - /** - * Creates a new Location instance using the specified properties. - * @function create - * @memberof perftools.profiles.Location - * @static - * @param {perftools.profiles.ILocation=} [properties] Properties to set - * @returns {perftools.profiles.Location} Location instance - */ - Location.create = function create(properties) { - return new Location(properties) - } - - /** - * Encodes the specified Location message. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Location - * @static - * @param {perftools.profiles.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.id != null && message.hasOwnProperty('id')) - writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.id) - if (message.mappingId != null && message.hasOwnProperty('mappingId')) - writer.uint32(/* id 2, wireType 0 =*/ 16).uint64(message.mappingId) - if (message.address != null && message.hasOwnProperty('address')) - writer.uint32(/* id 3, wireType 0 =*/ 24).uint64(message.address) - if (message.line != null && message.line.length) - for (var i = 0; i < message.line.length; ++i) - $root.perftools.profiles.Line.encode( - message.line[i], - writer.uint32(/* id 4, wireType 2 =*/ 34).fork(), - ).ldelim() - if (message.isFolded != null && message.hasOwnProperty('isFolded')) - writer.uint32(/* id 5, wireType 0 =*/ 40).bool(message.isFolded) - return writer - } - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Location - * @static - * @param {perftools.profiles.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Location message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Location() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.id = reader.uint64() - break - case 2: - message.mappingId = reader.uint64() - break - case 3: - message.address = reader.uint64() - break - case 4: - if (!(message.line && message.line.length)) message.line = [] - message.line.push($root.perftools.profiles.Line.decode(reader, reader.uint32())) - break - case 5: - message.isFolded = reader.bool() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Location message. - * @function verify - * @memberof perftools.profiles.Location - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Location.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.id != null && message.hasOwnProperty('id')) - if ( - !$util.isInteger(message.id) && - !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)) - ) - return 'id: integer|Long expected' - if (message.mappingId != null && message.hasOwnProperty('mappingId')) - if ( - !$util.isInteger(message.mappingId) && - !( - message.mappingId && - $util.isInteger(message.mappingId.low) && - $util.isInteger(message.mappingId.high) - ) - ) - return 'mappingId: integer|Long expected' - if (message.address != null && message.hasOwnProperty('address')) - if ( - !$util.isInteger(message.address) && - !( - message.address && - $util.isInteger(message.address.low) && - $util.isInteger(message.address.high) - ) - ) - return 'address: integer|Long expected' - if (message.line != null && message.hasOwnProperty('line')) { - if (!Array.isArray(message.line)) return 'line: array expected' - for (var i = 0; i < message.line.length; ++i) { - var error = $root.perftools.profiles.Line.verify(message.line[i]) - if (error) return 'line.' + error - } - } - if (message.isFolded != null && message.hasOwnProperty('isFolded')) - if (typeof message.isFolded !== 'boolean') return 'isFolded: boolean expected' - return null - } - - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Location - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Location} Location - */ - Location.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Location) return object - var message = new $root.perftools.profiles.Location() - if (object.id != null) - if ($util.Long) (message.id = $util.Long.fromValue(object.id)).unsigned = true - else if (typeof object.id === 'string') message.id = parseInt(object.id, 10) - else if (typeof object.id === 'number') message.id = object.id - else if (typeof object.id === 'object') - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber( - true, - ) - if (object.mappingId != null) - if ($util.Long) - (message.mappingId = $util.Long.fromValue(object.mappingId)).unsigned = true - else if (typeof object.mappingId === 'string') - message.mappingId = parseInt(object.mappingId, 10) - else if (typeof object.mappingId === 'number') message.mappingId = object.mappingId - else if (typeof object.mappingId === 'object') - message.mappingId = new $util.LongBits( - object.mappingId.low >>> 0, - object.mappingId.high >>> 0, - ).toNumber(true) - if (object.address != null) - if ($util.Long) (message.address = $util.Long.fromValue(object.address)).unsigned = true - else if (typeof object.address === 'string') - message.address = parseInt(object.address, 10) - else if (typeof object.address === 'number') message.address = object.address - else if (typeof object.address === 'object') - message.address = new $util.LongBits( - object.address.low >>> 0, - object.address.high >>> 0, - ).toNumber(true) - if (object.line) { - if (!Array.isArray(object.line)) - throw TypeError('.perftools.profiles.Location.line: array expected') - message.line = [] - for (var i = 0; i < object.line.length; ++i) { - if (typeof object.line[i] !== 'object') - throw TypeError('.perftools.profiles.Location.line: object expected') - message.line[i] = $root.perftools.profiles.Line.fromObject(object.line[i]) - } - } - if (object.isFolded != null) message.isFolded = Boolean(object.isFolded) - return message - } - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Location - * @static - * @param {perftools.profiles.Location} message Location - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Location.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.arrays || options.defaults) object.line = [] - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.id = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.id = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.mappingId = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.mappingId = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.address = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.address = options.longs === String ? '0' : 0 - object.isFolded = false - } - if (message.id != null && message.hasOwnProperty('id')) - if (typeof message.id === 'number') - object.id = options.longs === String ? String(message.id) : message.id - else - object.id = - options.longs === String - ? $util.Long.prototype.toString.call(message.id) - : options.longs === Number - ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) - : message.id - if (message.mappingId != null && message.hasOwnProperty('mappingId')) - if (typeof message.mappingId === 'number') - object.mappingId = - options.longs === String ? String(message.mappingId) : message.mappingId - else - object.mappingId = - options.longs === String - ? $util.Long.prototype.toString.call(message.mappingId) - : options.longs === Number - ? new $util.LongBits( - message.mappingId.low >>> 0, - message.mappingId.high >>> 0, - ).toNumber(true) - : message.mappingId - if (message.address != null && message.hasOwnProperty('address')) - if (typeof message.address === 'number') - object.address = options.longs === String ? String(message.address) : message.address - else - object.address = - options.longs === String - ? $util.Long.prototype.toString.call(message.address) - : options.longs === Number - ? new $util.LongBits( - message.address.low >>> 0, - message.address.high >>> 0, - ).toNumber(true) - : message.address - if (message.line && message.line.length) { - object.line = [] - for (var j = 0; j < message.line.length; ++j) - object.line[j] = $root.perftools.profiles.Line.toObject(message.line[j], options) - } - if (message.isFolded != null && message.hasOwnProperty('isFolded')) - object.isFolded = message.isFolded - return object - } - - /** - * Converts this Location to JSON. - * @function toJSON - * @memberof perftools.profiles.Location - * @instance - * @returns {Object.} JSON object - */ - Location.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Location - })() - - profiles.Line = (function() { - /** - * Properties of a Line. - * @memberof perftools.profiles - * @interface ILine - * @property {number|Long|null} [functionId] Line functionId - * @property {number|Long|null} [line] Line line - */ - - /** - * Constructs a new Line. - * @memberof perftools.profiles - * @classdesc Represents a Line. - * @implements ILine - * @constructor - * @param {perftools.profiles.ILine=} [properties] Properties to set - */ - function Line(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Line functionId. - * @member {number|Long} functionId - * @memberof perftools.profiles.Line - * @instance - */ - Line.prototype.functionId = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Line line. - * @member {number|Long} line - * @memberof perftools.profiles.Line - * @instance - */ - Line.prototype.line = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Creates a new Line instance using the specified properties. - * @function create - * @memberof perftools.profiles.Line - * @static - * @param {perftools.profiles.ILine=} [properties] Properties to set - * @returns {perftools.profiles.Line} Line instance - */ - Line.create = function create(properties) { - return new Line(properties) - } - - /** - * Encodes the specified Line message. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Line - * @static - * @param {perftools.profiles.ILine} message Line message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Line.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.functionId != null && message.hasOwnProperty('functionId')) - writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.functionId) - if (message.line != null && message.hasOwnProperty('line')) - writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.line) - return writer - } - - /** - * Encodes the specified Line message, length delimited. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Line - * @static - * @param {perftools.profiles.ILine} message Line message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Line.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Line message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Line - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Line} Line - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Line.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Line() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.functionId = reader.uint64() - break - case 2: - message.line = reader.int64() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Line message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Line - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Line} Line - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Line.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Line message. - * @function verify - * @memberof perftools.profiles.Line - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Line.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.functionId != null && message.hasOwnProperty('functionId')) - if ( - !$util.isInteger(message.functionId) && - !( - message.functionId && - $util.isInteger(message.functionId.low) && - $util.isInteger(message.functionId.high) - ) - ) - return 'functionId: integer|Long expected' - if (message.line != null && message.hasOwnProperty('line')) - if ( - !$util.isInteger(message.line) && - !( - message.line && - $util.isInteger(message.line.low) && - $util.isInteger(message.line.high) - ) - ) - return 'line: integer|Long expected' - return null - } - - /** - * Creates a Line message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Line - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Line} Line - */ - Line.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Line) return object - var message = new $root.perftools.profiles.Line() - if (object.functionId != null) - if ($util.Long) - (message.functionId = $util.Long.fromValue(object.functionId)).unsigned = true - else if (typeof object.functionId === 'string') - message.functionId = parseInt(object.functionId, 10) - else if (typeof object.functionId === 'number') message.functionId = object.functionId - else if (typeof object.functionId === 'object') - message.functionId = new $util.LongBits( - object.functionId.low >>> 0, - object.functionId.high >>> 0, - ).toNumber(true) - if (object.line != null) - if ($util.Long) (message.line = $util.Long.fromValue(object.line)).unsigned = false - else if (typeof object.line === 'string') message.line = parseInt(object.line, 10) - else if (typeof object.line === 'number') message.line = object.line - else if (typeof object.line === 'object') - message.line = new $util.LongBits( - object.line.low >>> 0, - object.line.high >>> 0, - ).toNumber() - return message - } - - /** - * Creates a plain object from a Line message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Line - * @static - * @param {perftools.profiles.Line} message Line - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Line.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.functionId = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.functionId = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.line = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.line = options.longs === String ? '0' : 0 - } - if (message.functionId != null && message.hasOwnProperty('functionId')) - if (typeof message.functionId === 'number') - object.functionId = - options.longs === String ? String(message.functionId) : message.functionId - else - object.functionId = - options.longs === String - ? $util.Long.prototype.toString.call(message.functionId) - : options.longs === Number - ? new $util.LongBits( - message.functionId.low >>> 0, - message.functionId.high >>> 0, - ).toNumber(true) - : message.functionId - if (message.line != null && message.hasOwnProperty('line')) - if (typeof message.line === 'number') - object.line = options.longs === String ? String(message.line) : message.line - else - object.line = - options.longs === String - ? $util.Long.prototype.toString.call(message.line) - : options.longs === Number - ? new $util.LongBits(message.line.low >>> 0, message.line.high >>> 0).toNumber() - : message.line - return object - } - - /** - * Converts this Line to JSON. - * @function toJSON - * @memberof perftools.profiles.Line - * @instance - * @returns {Object.} JSON object - */ - Line.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Line - })() - - profiles.Function = (function() { - /** - * Properties of a Function. - * @memberof perftools.profiles - * @interface IFunction - * @property {number|Long|null} [id] Function id - * @property {number|Long|null} [name] Function name - * @property {number|Long|null} [systemName] Function systemName - * @property {number|Long|null} [filename] Function filename - * @property {number|Long|null} [startLine] Function startLine - */ - - /** - * Constructs a new Function. - * @memberof perftools.profiles - * @classdesc Represents a Function. - * @implements IFunction - * @constructor - * @param {perftools.profiles.IFunction=} [properties] Properties to set - */ - function Function(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]] - } - - /** - * Function id. - * @member {number|Long} id - * @memberof perftools.profiles.Function - * @instance - */ - Function.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0 - - /** - * Function name. - * @member {number|Long} name - * @memberof perftools.profiles.Function - * @instance - */ - Function.prototype.name = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Function systemName. - * @member {number|Long} systemName - * @memberof perftools.profiles.Function - * @instance - */ - Function.prototype.systemName = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Function filename. - * @member {number|Long} filename - * @memberof perftools.profiles.Function - * @instance - */ - Function.prototype.filename = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Function startLine. - * @member {number|Long} startLine - * @memberof perftools.profiles.Function - * @instance - */ - Function.prototype.startLine = $util.Long ? $util.Long.fromBits(0, 0, false) : 0 - - /** - * Creates a new Function instance using the specified properties. - * @function create - * @memberof perftools.profiles.Function - * @static - * @param {perftools.profiles.IFunction=} [properties] Properties to set - * @returns {perftools.profiles.Function} Function instance - */ - Function.create = function create(properties) { - return new Function(properties) - } - - /** - * Encodes the specified Function message. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. - * @function encode - * @memberof perftools.profiles.Function - * @static - * @param {perftools.profiles.IFunction} message Function message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Function.encode = function encode(message, writer) { - if (!writer) writer = $Writer.create() - if (message.id != null && message.hasOwnProperty('id')) - writer.uint32(/* id 1, wireType 0 =*/ 8).uint64(message.id) - if (message.name != null && message.hasOwnProperty('name')) - writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.name) - if (message.systemName != null && message.hasOwnProperty('systemName')) - writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.systemName) - if (message.filename != null && message.hasOwnProperty('filename')) - writer.uint32(/* id 4, wireType 0 =*/ 32).int64(message.filename) - if (message.startLine != null && message.hasOwnProperty('startLine')) - writer.uint32(/* id 5, wireType 0 =*/ 40).int64(message.startLine) - return writer - } - - /** - * Encodes the specified Function message, length delimited. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. - * @function encodeDelimited - * @memberof perftools.profiles.Function - * @static - * @param {perftools.profiles.IFunction} message Function message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Function.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim() - } - - /** - * Decodes a Function message from the specified reader or buffer. - * @function decode - * @memberof perftools.profiles.Function - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {perftools.profiles.Function} Function - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Function.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) reader = $Reader.create(reader) - var end = length === undefined ? reader.len : reader.pos + length, - message = new $root.perftools.profiles.Function() - while (reader.pos < end) { - var tag = reader.uint32() - switch (tag >>> 3) { - case 1: - message.id = reader.uint64() - break - case 2: - message.name = reader.int64() - break - case 3: - message.systemName = reader.int64() - break - case 4: - message.filename = reader.int64() - break - case 5: - message.startLine = reader.int64() - break - default: - reader.skipType(tag & 7) - break - } - } - return message - } - - /** - * Decodes a Function message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof perftools.profiles.Function - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {perftools.profiles.Function} Function - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Function.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) reader = new $Reader(reader) - return this.decode(reader, reader.uint32()) - } - - /** - * Verifies a Function message. - * @function verify - * @memberof perftools.profiles.Function - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Function.verify = function verify(message) { - if (typeof message !== 'object' || message === null) return 'object expected' - if (message.id != null && message.hasOwnProperty('id')) - if ( - !$util.isInteger(message.id) && - !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)) - ) - return 'id: integer|Long expected' - if (message.name != null && message.hasOwnProperty('name')) - if ( - !$util.isInteger(message.name) && - !( - message.name && - $util.isInteger(message.name.low) && - $util.isInteger(message.name.high) - ) - ) - return 'name: integer|Long expected' - if (message.systemName != null && message.hasOwnProperty('systemName')) - if ( - !$util.isInteger(message.systemName) && - !( - message.systemName && - $util.isInteger(message.systemName.low) && - $util.isInteger(message.systemName.high) - ) - ) - return 'systemName: integer|Long expected' - if (message.filename != null && message.hasOwnProperty('filename')) - if ( - !$util.isInteger(message.filename) && - !( - message.filename && - $util.isInteger(message.filename.low) && - $util.isInteger(message.filename.high) - ) - ) - return 'filename: integer|Long expected' - if (message.startLine != null && message.hasOwnProperty('startLine')) - if ( - !$util.isInteger(message.startLine) && - !( - message.startLine && - $util.isInteger(message.startLine.low) && - $util.isInteger(message.startLine.high) - ) - ) - return 'startLine: integer|Long expected' - return null - } - - /** - * Creates a Function message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof perftools.profiles.Function - * @static - * @param {Object.} object Plain object - * @returns {perftools.profiles.Function} Function - */ - Function.fromObject = function fromObject(object) { - if (object instanceof $root.perftools.profiles.Function) return object - var message = new $root.perftools.profiles.Function() - if (object.id != null) - if ($util.Long) (message.id = $util.Long.fromValue(object.id)).unsigned = true - else if (typeof object.id === 'string') message.id = parseInt(object.id, 10) - else if (typeof object.id === 'number') message.id = object.id - else if (typeof object.id === 'object') - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber( - true, - ) - if (object.name != null) - if ($util.Long) (message.name = $util.Long.fromValue(object.name)).unsigned = false - else if (typeof object.name === 'string') message.name = parseInt(object.name, 10) - else if (typeof object.name === 'number') message.name = object.name - else if (typeof object.name === 'object') - message.name = new $util.LongBits( - object.name.low >>> 0, - object.name.high >>> 0, - ).toNumber() - if (object.systemName != null) - if ($util.Long) - (message.systemName = $util.Long.fromValue(object.systemName)).unsigned = false - else if (typeof object.systemName === 'string') - message.systemName = parseInt(object.systemName, 10) - else if (typeof object.systemName === 'number') message.systemName = object.systemName - else if (typeof object.systemName === 'object') - message.systemName = new $util.LongBits( - object.systemName.low >>> 0, - object.systemName.high >>> 0, - ).toNumber() - if (object.filename != null) - if ($util.Long) - (message.filename = $util.Long.fromValue(object.filename)).unsigned = false - else if (typeof object.filename === 'string') - message.filename = parseInt(object.filename, 10) - else if (typeof object.filename === 'number') message.filename = object.filename - else if (typeof object.filename === 'object') - message.filename = new $util.LongBits( - object.filename.low >>> 0, - object.filename.high >>> 0, - ).toNumber() - if (object.startLine != null) - if ($util.Long) - (message.startLine = $util.Long.fromValue(object.startLine)).unsigned = false - else if (typeof object.startLine === 'string') - message.startLine = parseInt(object.startLine, 10) - else if (typeof object.startLine === 'number') message.startLine = object.startLine - else if (typeof object.startLine === 'object') - message.startLine = new $util.LongBits( - object.startLine.low >>> 0, - object.startLine.high >>> 0, - ).toNumber() - return message - } - - /** - * Creates a plain object from a Function message. Also converts values to other types if specified. - * @function toObject - * @memberof perftools.profiles.Function - * @static - * @param {perftools.profiles.Function} message Function - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Function.toObject = function toObject(message, options) { - if (!options) options = {} - var object = {} - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, true) - object.id = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.id = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.name = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.name = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.systemName = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.systemName = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.filename = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.filename = options.longs === String ? '0' : 0 - if ($util.Long) { - var long = new $util.Long(0, 0, false) - object.startLine = - options.longs === String - ? long.toString() - : options.longs === Number - ? long.toNumber() - : long - } else object.startLine = options.longs === String ? '0' : 0 - } - if (message.id != null && message.hasOwnProperty('id')) - if (typeof message.id === 'number') - object.id = options.longs === String ? String(message.id) : message.id - else - object.id = - options.longs === String - ? $util.Long.prototype.toString.call(message.id) - : options.longs === Number - ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) - : message.id - if (message.name != null && message.hasOwnProperty('name')) - if (typeof message.name === 'number') - object.name = options.longs === String ? String(message.name) : message.name - else - object.name = - options.longs === String - ? $util.Long.prototype.toString.call(message.name) - : options.longs === Number - ? new $util.LongBits(message.name.low >>> 0, message.name.high >>> 0).toNumber() - : message.name - if (message.systemName != null && message.hasOwnProperty('systemName')) - if (typeof message.systemName === 'number') - object.systemName = - options.longs === String ? String(message.systemName) : message.systemName - else - object.systemName = - options.longs === String - ? $util.Long.prototype.toString.call(message.systemName) - : options.longs === Number - ? new $util.LongBits( - message.systemName.low >>> 0, - message.systemName.high >>> 0, - ).toNumber() - : message.systemName - if (message.filename != null && message.hasOwnProperty('filename')) - if (typeof message.filename === 'number') - object.filename = options.longs === String ? String(message.filename) : message.filename - else - object.filename = - options.longs === String - ? $util.Long.prototype.toString.call(message.filename) - : options.longs === Number - ? new $util.LongBits( - message.filename.low >>> 0, - message.filename.high >>> 0, - ).toNumber() - : message.filename - if (message.startLine != null && message.hasOwnProperty('startLine')) - if (typeof message.startLine === 'number') - object.startLine = - options.longs === String ? String(message.startLine) : message.startLine - else - object.startLine = - options.longs === String - ? $util.Long.prototype.toString.call(message.startLine) - : options.longs === Number - ? new $util.LongBits( - message.startLine.low >>> 0, - message.startLine.high >>> 0, - ).toNumber() - : message.startLine - return object - } - - /** - * Converts this Function to JSON. - * @function toJSON - * @memberof perftools.profiles.Function - * @instance - * @returns {Object.} JSON object - */ - Function.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions) - } - - return Function - })() - - return profiles - })() - - return perftools -})() - -module.exports = $root + const perftools = {}; + + perftools.profiles = (function() { + + /** + * Namespace profiles. + * @memberof perftools + * @namespace + */ + const profiles = {}; + + profiles.Profile = (function() { + + /** + * Properties of a Profile. + * @memberof perftools.profiles + * @interface IProfile + * @property {Array.|null} [sampleType] Profile sampleType + * @property {Array.|null} [sample] Profile sample + * @property {Array.|null} [mapping] Profile mapping + * @property {Array.|null} [location] Profile location + * @property {Array.|null} ["function"] Profile function + * @property {Array.|null} [stringTable] Profile stringTable + * @property {number|Long|null} [dropFrames] Profile dropFrames + * @property {number|Long|null} [keepFrames] Profile keepFrames + * @property {number|Long|null} [timeNanos] Profile timeNanos + * @property {number|Long|null} [durationNanos] Profile durationNanos + * @property {perftools.profiles.IValueType|null} [periodType] Profile periodType + * @property {number|Long|null} [period] Profile period + * @property {Array.|null} [comment] Profile comment + * @property {number|Long|null} [defaultSampleType] Profile defaultSampleType + */ + + /** + * Constructs a new Profile. + * @memberof perftools.profiles + * @classdesc Represents a Profile. + * @implements IProfile + * @constructor + * @param {perftools.profiles.IProfile=} [properties] Properties to set + */ + function Profile(properties) { + this.sampleType = []; + this.sample = []; + this.mapping = []; + this.location = []; + this["function"] = []; + this.stringTable = []; + this.comment = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Profile sampleType. + * @member {Array.} sampleType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.sampleType = $util.emptyArray; + + /** + * Profile sample. + * @member {Array.} sample + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.sample = $util.emptyArray; + + /** + * Profile mapping. + * @member {Array.} mapping + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.mapping = $util.emptyArray; + + /** + * Profile location. + * @member {Array.} location + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.location = $util.emptyArray; + + /** + * Profile function. + * @member {Array.} function + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype["function"] = $util.emptyArray; + + /** + * Profile stringTable. + * @member {Array.} stringTable + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.stringTable = $util.emptyArray; + + /** + * Profile dropFrames. + * @member {number|Long} dropFrames + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.dropFrames = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile keepFrames. + * @member {number|Long} keepFrames + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.keepFrames = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile timeNanos. + * @member {number|Long} timeNanos + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.timeNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile durationNanos. + * @member {number|Long} durationNanos + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.durationNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile periodType. + * @member {perftools.profiles.IValueType|null|undefined} periodType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.periodType = null; + + /** + * Profile period. + * @member {number|Long} period + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.period = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile comment. + * @member {Array.} comment + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.comment = $util.emptyArray; + + /** + * Profile defaultSampleType. + * @member {number|Long} defaultSampleType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.defaultSampleType = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Profile instance using the specified properties. + * @function create + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile=} [properties] Properties to set + * @returns {perftools.profiles.Profile} Profile instance + */ + Profile.create = function create(properties) { + return new Profile(properties); + }; + + /** + * Encodes the specified Profile message. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sampleType != null && message.sampleType.length) + for (let i = 0; i < message.sampleType.length; ++i) + $root.perftools.profiles.ValueType.encode(message.sampleType[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.sample != null && message.sample.length) + for (let i = 0; i < message.sample.length; ++i) + $root.perftools.profiles.Sample.encode(message.sample[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mapping != null && message.mapping.length) + for (let i = 0; i < message.mapping.length; ++i) + $root.perftools.profiles.Mapping.encode(message.mapping[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.location != null && message.location.length) + for (let i = 0; i < message.location.length; ++i) + $root.perftools.profiles.Location.encode(message.location[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message["function"] != null && message["function"].length) + for (let i = 0; i < message["function"].length; ++i) + $root.perftools.profiles.Function.encode(message["function"][i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.stringTable != null && message.stringTable.length) + for (let i = 0; i < message.stringTable.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.stringTable[i]); + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.dropFrames); + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.keepFrames); + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.timeNanos); + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.durationNanos); + if (message.periodType != null && message.hasOwnProperty("periodType")) + $root.perftools.profiles.ValueType.encode(message.periodType, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.period != null && message.hasOwnProperty("period")) + writer.uint32(/* id 12, wireType 0 =*/96).int64(message.period); + if (message.comment != null && message.comment.length) { + writer.uint32(/* id 13, wireType 2 =*/106).fork(); + for (let i = 0; i < message.comment.length; ++i) + writer.int64(message.comment[i]); + writer.ldelim(); + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + writer.uint32(/* id 14, wireType 0 =*/112).int64(message.defaultSampleType); + return writer; + }; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Profile(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.sampleType && message.sampleType.length)) + message.sampleType = []; + message.sampleType.push($root.perftools.profiles.ValueType.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.sample && message.sample.length)) + message.sample = []; + message.sample.push($root.perftools.profiles.Sample.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.mapping && message.mapping.length)) + message.mapping = []; + message.mapping.push($root.perftools.profiles.Mapping.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.perftools.profiles.Location.decode(reader, reader.uint32())); + break; + case 5: + if (!(message["function"] && message["function"].length)) + message["function"] = []; + message["function"].push($root.perftools.profiles.Function.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.stringTable && message.stringTable.length)) + message.stringTable = []; + message.stringTable.push(reader.string()); + break; + case 7: + message.dropFrames = reader.int64(); + break; + case 8: + message.keepFrames = reader.int64(); + break; + case 9: + message.timeNanos = reader.int64(); + break; + case 10: + message.durationNanos = reader.int64(); + break; + case 11: + message.periodType = $root.perftools.profiles.ValueType.decode(reader, reader.uint32()); + break; + case 12: + message.period = reader.int64(); + break; + case 13: + if (!(message.comment && message.comment.length)) + message.comment = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.comment.push(reader.int64()); + } else + message.comment.push(reader.int64()); + break; + case 14: + message.defaultSampleType = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Profile message. + * @function verify + * @memberof perftools.profiles.Profile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Profile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sampleType != null && message.hasOwnProperty("sampleType")) { + if (!Array.isArray(message.sampleType)) + return "sampleType: array expected"; + for (let i = 0; i < message.sampleType.length; ++i) { + let error = $root.perftools.profiles.ValueType.verify(message.sampleType[i]); + if (error) + return "sampleType." + error; + } + } + if (message.sample != null && message.hasOwnProperty("sample")) { + if (!Array.isArray(message.sample)) + return "sample: array expected"; + for (let i = 0; i < message.sample.length; ++i) { + let error = $root.perftools.profiles.Sample.verify(message.sample[i]); + if (error) + return "sample." + error; + } + } + if (message.mapping != null && message.hasOwnProperty("mapping")) { + if (!Array.isArray(message.mapping)) + return "mapping: array expected"; + for (let i = 0; i < message.mapping.length; ++i) { + let error = $root.perftools.profiles.Mapping.verify(message.mapping[i]); + if (error) + return "mapping." + error; + } + } + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (let i = 0; i < message.location.length; ++i) { + let error = $root.perftools.profiles.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + if (message["function"] != null && message.hasOwnProperty("function")) { + if (!Array.isArray(message["function"])) + return "function: array expected"; + for (let i = 0; i < message["function"].length; ++i) { + let error = $root.perftools.profiles.Function.verify(message["function"][i]); + if (error) + return "function." + error; + } + } + if (message.stringTable != null && message.hasOwnProperty("stringTable")) { + if (!Array.isArray(message.stringTable)) + return "stringTable: array expected"; + for (let i = 0; i < message.stringTable.length; ++i) + if (!$util.isString(message.stringTable[i])) + return "stringTable: string[] expected"; + } + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + if (!$util.isInteger(message.dropFrames) && !(message.dropFrames && $util.isInteger(message.dropFrames.low) && $util.isInteger(message.dropFrames.high))) + return "dropFrames: integer|Long expected"; + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + if (!$util.isInteger(message.keepFrames) && !(message.keepFrames && $util.isInteger(message.keepFrames.low) && $util.isInteger(message.keepFrames.high))) + return "keepFrames: integer|Long expected"; + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + if (!$util.isInteger(message.timeNanos) && !(message.timeNanos && $util.isInteger(message.timeNanos.low) && $util.isInteger(message.timeNanos.high))) + return "timeNanos: integer|Long expected"; + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + if (!$util.isInteger(message.durationNanos) && !(message.durationNanos && $util.isInteger(message.durationNanos.low) && $util.isInteger(message.durationNanos.high))) + return "durationNanos: integer|Long expected"; + if (message.periodType != null && message.hasOwnProperty("periodType")) { + let error = $root.perftools.profiles.ValueType.verify(message.periodType); + if (error) + return "periodType." + error; + } + if (message.period != null && message.hasOwnProperty("period")) + if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) + return "period: integer|Long expected"; + if (message.comment != null && message.hasOwnProperty("comment")) { + if (!Array.isArray(message.comment)) + return "comment: array expected"; + for (let i = 0; i < message.comment.length; ++i) + if (!$util.isInteger(message.comment[i]) && !(message.comment[i] && $util.isInteger(message.comment[i].low) && $util.isInteger(message.comment[i].high))) + return "comment: integer|Long[] expected"; + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + if (!$util.isInteger(message.defaultSampleType) && !(message.defaultSampleType && $util.isInteger(message.defaultSampleType.low) && $util.isInteger(message.defaultSampleType.high))) + return "defaultSampleType: integer|Long expected"; + return null; + }; + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Profile + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Profile} Profile + */ + Profile.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Profile) + return object; + let message = new $root.perftools.profiles.Profile(); + if (object.sampleType) { + if (!Array.isArray(object.sampleType)) + throw TypeError(".perftools.profiles.Profile.sampleType: array expected"); + message.sampleType = []; + for (let i = 0; i < object.sampleType.length; ++i) { + if (typeof object.sampleType[i] !== "object") + throw TypeError(".perftools.profiles.Profile.sampleType: object expected"); + message.sampleType[i] = $root.perftools.profiles.ValueType.fromObject(object.sampleType[i]); + } + } + if (object.sample) { + if (!Array.isArray(object.sample)) + throw TypeError(".perftools.profiles.Profile.sample: array expected"); + message.sample = []; + for (let i = 0; i < object.sample.length; ++i) { + if (typeof object.sample[i] !== "object") + throw TypeError(".perftools.profiles.Profile.sample: object expected"); + message.sample[i] = $root.perftools.profiles.Sample.fromObject(object.sample[i]); + } + } + if (object.mapping) { + if (!Array.isArray(object.mapping)) + throw TypeError(".perftools.profiles.Profile.mapping: array expected"); + message.mapping = []; + for (let i = 0; i < object.mapping.length; ++i) { + if (typeof object.mapping[i] !== "object") + throw TypeError(".perftools.profiles.Profile.mapping: object expected"); + message.mapping[i] = $root.perftools.profiles.Mapping.fromObject(object.mapping[i]); + } + } + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".perftools.profiles.Profile.location: array expected"); + message.location = []; + for (let i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".perftools.profiles.Profile.location: object expected"); + message.location[i] = $root.perftools.profiles.Location.fromObject(object.location[i]); + } + } + if (object["function"]) { + if (!Array.isArray(object["function"])) + throw TypeError(".perftools.profiles.Profile.function: array expected"); + message["function"] = []; + for (let i = 0; i < object["function"].length; ++i) { + if (typeof object["function"][i] !== "object") + throw TypeError(".perftools.profiles.Profile.function: object expected"); + message["function"][i] = $root.perftools.profiles.Function.fromObject(object["function"][i]); + } + } + if (object.stringTable) { + if (!Array.isArray(object.stringTable)) + throw TypeError(".perftools.profiles.Profile.stringTable: array expected"); + message.stringTable = []; + for (let i = 0; i < object.stringTable.length; ++i) + message.stringTable[i] = String(object.stringTable[i]); + } + if (object.dropFrames != null) + if ($util.Long) + (message.dropFrames = $util.Long.fromValue(object.dropFrames)).unsigned = false; + else if (typeof object.dropFrames === "string") + message.dropFrames = parseInt(object.dropFrames, 10); + else if (typeof object.dropFrames === "number") + message.dropFrames = object.dropFrames; + else if (typeof object.dropFrames === "object") + message.dropFrames = new $util.LongBits(object.dropFrames.low >>> 0, object.dropFrames.high >>> 0).toNumber(); + if (object.keepFrames != null) + if ($util.Long) + (message.keepFrames = $util.Long.fromValue(object.keepFrames)).unsigned = false; + else if (typeof object.keepFrames === "string") + message.keepFrames = parseInt(object.keepFrames, 10); + else if (typeof object.keepFrames === "number") + message.keepFrames = object.keepFrames; + else if (typeof object.keepFrames === "object") + message.keepFrames = new $util.LongBits(object.keepFrames.low >>> 0, object.keepFrames.high >>> 0).toNumber(); + if (object.timeNanos != null) + if ($util.Long) + (message.timeNanos = $util.Long.fromValue(object.timeNanos)).unsigned = false; + else if (typeof object.timeNanos === "string") + message.timeNanos = parseInt(object.timeNanos, 10); + else if (typeof object.timeNanos === "number") + message.timeNanos = object.timeNanos; + else if (typeof object.timeNanos === "object") + message.timeNanos = new $util.LongBits(object.timeNanos.low >>> 0, object.timeNanos.high >>> 0).toNumber(); + if (object.durationNanos != null) + if ($util.Long) + (message.durationNanos = $util.Long.fromValue(object.durationNanos)).unsigned = false; + else if (typeof object.durationNanos === "string") + message.durationNanos = parseInt(object.durationNanos, 10); + else if (typeof object.durationNanos === "number") + message.durationNanos = object.durationNanos; + else if (typeof object.durationNanos === "object") + message.durationNanos = new $util.LongBits(object.durationNanos.low >>> 0, object.durationNanos.high >>> 0).toNumber(); + if (object.periodType != null) { + if (typeof object.periodType !== "object") + throw TypeError(".perftools.profiles.Profile.periodType: object expected"); + message.periodType = $root.perftools.profiles.ValueType.fromObject(object.periodType); + } + if (object.period != null) + if ($util.Long) + (message.period = $util.Long.fromValue(object.period)).unsigned = false; + else if (typeof object.period === "string") + message.period = parseInt(object.period, 10); + else if (typeof object.period === "number") + message.period = object.period; + else if (typeof object.period === "object") + message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(); + if (object.comment) { + if (!Array.isArray(object.comment)) + throw TypeError(".perftools.profiles.Profile.comment: array expected"); + message.comment = []; + for (let i = 0; i < object.comment.length; ++i) + if ($util.Long) + (message.comment[i] = $util.Long.fromValue(object.comment[i])).unsigned = false; + else if (typeof object.comment[i] === "string") + message.comment[i] = parseInt(object.comment[i], 10); + else if (typeof object.comment[i] === "number") + message.comment[i] = object.comment[i]; + else if (typeof object.comment[i] === "object") + message.comment[i] = new $util.LongBits(object.comment[i].low >>> 0, object.comment[i].high >>> 0).toNumber(); + } + if (object.defaultSampleType != null) + if ($util.Long) + (message.defaultSampleType = $util.Long.fromValue(object.defaultSampleType)).unsigned = false; + else if (typeof object.defaultSampleType === "string") + message.defaultSampleType = parseInt(object.defaultSampleType, 10); + else if (typeof object.defaultSampleType === "number") + message.defaultSampleType = object.defaultSampleType; + else if (typeof object.defaultSampleType === "object") + message.defaultSampleType = new $util.LongBits(object.defaultSampleType.low >>> 0, object.defaultSampleType.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.Profile} message Profile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Profile.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.sampleType = []; + object.sample = []; + object.mapping = []; + object.location = []; + object["function"] = []; + object.stringTable = []; + object.comment = []; + } + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.dropFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.dropFrames = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.keepFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.keepFrames = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.timeNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timeNanos = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.durationNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.durationNanos = options.longs === String ? "0" : 0; + object.periodType = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.period = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.defaultSampleType = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.defaultSampleType = options.longs === String ? "0" : 0; + } + if (message.sampleType && message.sampleType.length) { + object.sampleType = []; + for (let j = 0; j < message.sampleType.length; ++j) + object.sampleType[j] = $root.perftools.profiles.ValueType.toObject(message.sampleType[j], options); + } + if (message.sample && message.sample.length) { + object.sample = []; + for (let j = 0; j < message.sample.length; ++j) + object.sample[j] = $root.perftools.profiles.Sample.toObject(message.sample[j], options); + } + if (message.mapping && message.mapping.length) { + object.mapping = []; + for (let j = 0; j < message.mapping.length; ++j) + object.mapping[j] = $root.perftools.profiles.Mapping.toObject(message.mapping[j], options); + } + if (message.location && message.location.length) { + object.location = []; + for (let j = 0; j < message.location.length; ++j) + object.location[j] = $root.perftools.profiles.Location.toObject(message.location[j], options); + } + if (message["function"] && message["function"].length) { + object["function"] = []; + for (let j = 0; j < message["function"].length; ++j) + object["function"][j] = $root.perftools.profiles.Function.toObject(message["function"][j], options); + } + if (message.stringTable && message.stringTable.length) { + object.stringTable = []; + for (let j = 0; j < message.stringTable.length; ++j) + object.stringTable[j] = message.stringTable[j]; + } + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + if (typeof message.dropFrames === "number") + object.dropFrames = options.longs === String ? String(message.dropFrames) : message.dropFrames; + else + object.dropFrames = options.longs === String ? $util.Long.prototype.toString.call(message.dropFrames) : options.longs === Number ? new $util.LongBits(message.dropFrames.low >>> 0, message.dropFrames.high >>> 0).toNumber() : message.dropFrames; + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + if (typeof message.keepFrames === "number") + object.keepFrames = options.longs === String ? String(message.keepFrames) : message.keepFrames; + else + object.keepFrames = options.longs === String ? $util.Long.prototype.toString.call(message.keepFrames) : options.longs === Number ? new $util.LongBits(message.keepFrames.low >>> 0, message.keepFrames.high >>> 0).toNumber() : message.keepFrames; + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + if (typeof message.timeNanos === "number") + object.timeNanos = options.longs === String ? String(message.timeNanos) : message.timeNanos; + else + object.timeNanos = options.longs === String ? $util.Long.prototype.toString.call(message.timeNanos) : options.longs === Number ? new $util.LongBits(message.timeNanos.low >>> 0, message.timeNanos.high >>> 0).toNumber() : message.timeNanos; + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + if (typeof message.durationNanos === "number") + object.durationNanos = options.longs === String ? String(message.durationNanos) : message.durationNanos; + else + object.durationNanos = options.longs === String ? $util.Long.prototype.toString.call(message.durationNanos) : options.longs === Number ? new $util.LongBits(message.durationNanos.low >>> 0, message.durationNanos.high >>> 0).toNumber() : message.durationNanos; + if (message.periodType != null && message.hasOwnProperty("periodType")) + object.periodType = $root.perftools.profiles.ValueType.toObject(message.periodType, options); + if (message.period != null && message.hasOwnProperty("period")) + if (typeof message.period === "number") + object.period = options.longs === String ? String(message.period) : message.period; + else + object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber() : message.period; + if (message.comment && message.comment.length) { + object.comment = []; + for (let j = 0; j < message.comment.length; ++j) + if (typeof message.comment[j] === "number") + object.comment[j] = options.longs === String ? String(message.comment[j]) : message.comment[j]; + else + object.comment[j] = options.longs === String ? $util.Long.prototype.toString.call(message.comment[j]) : options.longs === Number ? new $util.LongBits(message.comment[j].low >>> 0, message.comment[j].high >>> 0).toNumber() : message.comment[j]; + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + if (typeof message.defaultSampleType === "number") + object.defaultSampleType = options.longs === String ? String(message.defaultSampleType) : message.defaultSampleType; + else + object.defaultSampleType = options.longs === String ? $util.Long.prototype.toString.call(message.defaultSampleType) : options.longs === Number ? new $util.LongBits(message.defaultSampleType.low >>> 0, message.defaultSampleType.high >>> 0).toNumber() : message.defaultSampleType; + return object; + }; + + /** + * Converts this Profile to JSON. + * @function toJSON + * @memberof perftools.profiles.Profile + * @instance + * @returns {Object.} JSON object + */ + Profile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Profile; + })(); + + profiles.ValueType = (function() { + + /** + * Properties of a ValueType. + * @memberof perftools.profiles + * @interface IValueType + * @property {number|Long|null} [type] ValueType type + * @property {number|Long|null} [unit] ValueType unit + */ + + /** + * Constructs a new ValueType. + * @memberof perftools.profiles + * @classdesc Represents a ValueType. + * @implements IValueType + * @constructor + * @param {perftools.profiles.IValueType=} [properties] Properties to set + */ + function ValueType(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValueType type. + * @member {number|Long} type + * @memberof perftools.profiles.ValueType + * @instance + */ + ValueType.prototype.type = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ValueType unit. + * @member {number|Long} unit + * @memberof perftools.profiles.ValueType + * @instance + */ + ValueType.prototype.unit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ValueType instance using the specified properties. + * @function create + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType=} [properties] Properties to set + * @returns {perftools.profiles.ValueType} ValueType instance + */ + ValueType.create = function create(properties) { + return new ValueType(properties); + }; + + /** + * Encodes the specified ValueType message. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.type); + if (message.unit != null && message.hasOwnProperty("unit")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unit); + return writer; + }; + + /** + * Encodes the specified ValueType message, length delimited. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValueType message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.ValueType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.ValueType} ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.ValueType(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int64(); + break; + case 2: + message.unit = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValueType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.ValueType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.ValueType} ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValueType message. + * @function verify + * @memberof perftools.profiles.ValueType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValueType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isInteger(message.type) && !(message.type && $util.isInteger(message.type.low) && $util.isInteger(message.type.high))) + return "type: integer|Long expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isInteger(message.unit) && !(message.unit && $util.isInteger(message.unit.low) && $util.isInteger(message.unit.high))) + return "unit: integer|Long expected"; + return null; + }; + + /** + * Creates a ValueType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.ValueType + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.ValueType} ValueType + */ + ValueType.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.ValueType) + return object; + let message = new $root.perftools.profiles.ValueType(); + if (object.type != null) + if ($util.Long) + (message.type = $util.Long.fromValue(object.type)).unsigned = false; + else if (typeof object.type === "string") + message.type = parseInt(object.type, 10); + else if (typeof object.type === "number") + message.type = object.type; + else if (typeof object.type === "object") + message.type = new $util.LongBits(object.type.low >>> 0, object.type.high >>> 0).toNumber(); + if (object.unit != null) + if ($util.Long) + (message.unit = $util.Long.fromValue(object.unit)).unsigned = false; + else if (typeof object.unit === "string") + message.unit = parseInt(object.unit, 10); + else if (typeof object.unit === "number") + message.unit = object.unit; + else if (typeof object.unit === "object") + message.unit = new $util.LongBits(object.unit.low >>> 0, object.unit.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ValueType message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.ValueType} message ValueType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValueType.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.type = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.type = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.unit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unit = options.longs === String ? "0" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + if (typeof message.type === "number") + object.type = options.longs === String ? String(message.type) : message.type; + else + object.type = options.longs === String ? $util.Long.prototype.toString.call(message.type) : options.longs === Number ? new $util.LongBits(message.type.low >>> 0, message.type.high >>> 0).toNumber() : message.type; + if (message.unit != null && message.hasOwnProperty("unit")) + if (typeof message.unit === "number") + object.unit = options.longs === String ? String(message.unit) : message.unit; + else + object.unit = options.longs === String ? $util.Long.prototype.toString.call(message.unit) : options.longs === Number ? new $util.LongBits(message.unit.low >>> 0, message.unit.high >>> 0).toNumber() : message.unit; + return object; + }; + + /** + * Converts this ValueType to JSON. + * @function toJSON + * @memberof perftools.profiles.ValueType + * @instance + * @returns {Object.} JSON object + */ + ValueType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValueType; + })(); + + profiles.Sample = (function() { + + /** + * Properties of a Sample. + * @memberof perftools.profiles + * @interface ISample + * @property {Array.|null} [locationId] Sample locationId + * @property {Array.|null} [value] Sample value + * @property {Array.|null} [label] Sample label + */ + + /** + * Constructs a new Sample. + * @memberof perftools.profiles + * @classdesc Represents a Sample. + * @implements ISample + * @constructor + * @param {perftools.profiles.ISample=} [properties] Properties to set + */ + function Sample(properties) { + this.locationId = []; + this.value = []; + this.label = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sample locationId. + * @member {Array.} locationId + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.locationId = $util.emptyArray; + + /** + * Sample value. + * @member {Array.} value + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.value = $util.emptyArray; + + /** + * Sample label. + * @member {Array.} label + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.label = $util.emptyArray; + + /** + * Creates a new Sample instance using the specified properties. + * @function create + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample=} [properties] Properties to set + * @returns {perftools.profiles.Sample} Sample instance + */ + Sample.create = function create(properties) { + return new Sample(properties); + }; + + /** + * Encodes the specified Sample message. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample} message Sample message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sample.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locationId != null && message.locationId.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.locationId.length; ++i) + writer.uint64(message.locationId[i]); + writer.ldelim(); + } + if (message.value != null && message.value.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (let i = 0; i < message.value.length; ++i) + writer.int64(message.value[i]); + writer.ldelim(); + } + if (message.label != null && message.label.length) + for (let i = 0; i < message.label.length; ++i) + $root.perftools.profiles.Label.encode(message.label[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Sample message, length delimited. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample} message Sample message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sample.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Sample message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Sample + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Sample} Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sample.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Sample(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.locationId && message.locationId.length)) + message.locationId = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.locationId.push(reader.uint64()); + } else + message.locationId.push(reader.uint64()); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.value.push(reader.int64()); + } else + message.value.push(reader.int64()); + break; + case 3: + if (!(message.label && message.label.length)) + message.label = []; + message.label.push($root.perftools.profiles.Label.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Sample message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Sample + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Sample} Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sample.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sample message. + * @function verify + * @memberof perftools.profiles.Sample + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sample.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locationId != null && message.hasOwnProperty("locationId")) { + if (!Array.isArray(message.locationId)) + return "locationId: array expected"; + for (let i = 0; i < message.locationId.length; ++i) + if (!$util.isInteger(message.locationId[i]) && !(message.locationId[i] && $util.isInteger(message.locationId[i].low) && $util.isInteger(message.locationId[i].high))) + return "locationId: integer|Long[] expected"; + } + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (let i = 0; i < message.value.length; ++i) + if (!$util.isInteger(message.value[i]) && !(message.value[i] && $util.isInteger(message.value[i].low) && $util.isInteger(message.value[i].high))) + return "value: integer|Long[] expected"; + } + if (message.label != null && message.hasOwnProperty("label")) { + if (!Array.isArray(message.label)) + return "label: array expected"; + for (let i = 0; i < message.label.length; ++i) { + let error = $root.perftools.profiles.Label.verify(message.label[i]); + if (error) + return "label." + error; + } + } + return null; + }; + + /** + * Creates a Sample message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Sample + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Sample} Sample + */ + Sample.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Sample) + return object; + let message = new $root.perftools.profiles.Sample(); + if (object.locationId) { + if (!Array.isArray(object.locationId)) + throw TypeError(".perftools.profiles.Sample.locationId: array expected"); + message.locationId = []; + for (let i = 0; i < object.locationId.length; ++i) + if ($util.Long) + (message.locationId[i] = $util.Long.fromValue(object.locationId[i])).unsigned = true; + else if (typeof object.locationId[i] === "string") + message.locationId[i] = parseInt(object.locationId[i], 10); + else if (typeof object.locationId[i] === "number") + message.locationId[i] = object.locationId[i]; + else if (typeof object.locationId[i] === "object") + message.locationId[i] = new $util.LongBits(object.locationId[i].low >>> 0, object.locationId[i].high >>> 0).toNumber(true); + } + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".perftools.profiles.Sample.value: array expected"); + message.value = []; + for (let i = 0; i < object.value.length; ++i) + if ($util.Long) + (message.value[i] = $util.Long.fromValue(object.value[i])).unsigned = false; + else if (typeof object.value[i] === "string") + message.value[i] = parseInt(object.value[i], 10); + else if (typeof object.value[i] === "number") + message.value[i] = object.value[i]; + else if (typeof object.value[i] === "object") + message.value[i] = new $util.LongBits(object.value[i].low >>> 0, object.value[i].high >>> 0).toNumber(); + } + if (object.label) { + if (!Array.isArray(object.label)) + throw TypeError(".perftools.profiles.Sample.label: array expected"); + message.label = []; + for (let i = 0; i < object.label.length; ++i) { + if (typeof object.label[i] !== "object") + throw TypeError(".perftools.profiles.Sample.label: object expected"); + message.label[i] = $root.perftools.profiles.Label.fromObject(object.label[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Sample message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.Sample} message Sample + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sample.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.locationId = []; + object.value = []; + object.label = []; + } + if (message.locationId && message.locationId.length) { + object.locationId = []; + for (let j = 0; j < message.locationId.length; ++j) + if (typeof message.locationId[j] === "number") + object.locationId[j] = options.longs === String ? String(message.locationId[j]) : message.locationId[j]; + else + object.locationId[j] = options.longs === String ? $util.Long.prototype.toString.call(message.locationId[j]) : options.longs === Number ? new $util.LongBits(message.locationId[j].low >>> 0, message.locationId[j].high >>> 0).toNumber(true) : message.locationId[j]; + } + if (message.value && message.value.length) { + object.value = []; + for (let j = 0; j < message.value.length; ++j) + if (typeof message.value[j] === "number") + object.value[j] = options.longs === String ? String(message.value[j]) : message.value[j]; + else + object.value[j] = options.longs === String ? $util.Long.prototype.toString.call(message.value[j]) : options.longs === Number ? new $util.LongBits(message.value[j].low >>> 0, message.value[j].high >>> 0).toNumber() : message.value[j]; + } + if (message.label && message.label.length) { + object.label = []; + for (let j = 0; j < message.label.length; ++j) + object.label[j] = $root.perftools.profiles.Label.toObject(message.label[j], options); + } + return object; + }; + + /** + * Converts this Sample to JSON. + * @function toJSON + * @memberof perftools.profiles.Sample + * @instance + * @returns {Object.} JSON object + */ + Sample.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Sample; + })(); + + profiles.Label = (function() { + + /** + * Properties of a Label. + * @memberof perftools.profiles + * @interface ILabel + * @property {number|Long|null} [key] Label key + * @property {number|Long|null} [str] Label str + * @property {number|Long|null} [num] Label num + * @property {number|Long|null} [numUnit] Label numUnit + */ + + /** + * Constructs a new Label. + * @memberof perftools.profiles + * @classdesc Represents a Label. + * @implements ILabel + * @constructor + * @param {perftools.profiles.ILabel=} [properties] Properties to set + */ + function Label(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Label key. + * @member {number|Long} key + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.key = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label str. + * @member {number|Long} str + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.str = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label num. + * @member {number|Long} num + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.num = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label numUnit. + * @member {number|Long} numUnit + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.numUnit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Label instance using the specified properties. + * @function create + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel=} [properties] Properties to set + * @returns {perftools.profiles.Label} Label instance + */ + Label.create = function create(properties) { + return new Label(properties); + }; + + /** + * Encodes the specified Label message. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.key); + if (message.str != null && message.hasOwnProperty("str")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.str); + if (message.num != null && message.hasOwnProperty("num")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.num); + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.numUnit); + return writer; + }; + + /** + * Encodes the specified Label message, length delimited. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Label message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Label(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.int64(); + break; + case 2: + message.str = reader.int64(); + break; + case 3: + message.num = reader.int64(); + break; + case 4: + message.numUnit = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Label message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Label message. + * @function verify + * @memberof perftools.profiles.Label + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Label.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isInteger(message.key) && !(message.key && $util.isInteger(message.key.low) && $util.isInteger(message.key.high))) + return "key: integer|Long expected"; + if (message.str != null && message.hasOwnProperty("str")) + if (!$util.isInteger(message.str) && !(message.str && $util.isInteger(message.str.low) && $util.isInteger(message.str.high))) + return "str: integer|Long expected"; + if (message.num != null && message.hasOwnProperty("num")) + if (!$util.isInteger(message.num) && !(message.num && $util.isInteger(message.num.low) && $util.isInteger(message.num.high))) + return "num: integer|Long expected"; + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + if (!$util.isInteger(message.numUnit) && !(message.numUnit && $util.isInteger(message.numUnit.low) && $util.isInteger(message.numUnit.high))) + return "numUnit: integer|Long expected"; + return null; + }; + + /** + * Creates a Label message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Label + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Label} Label + */ + Label.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Label) + return object; + let message = new $root.perftools.profiles.Label(); + if (object.key != null) + if ($util.Long) + (message.key = $util.Long.fromValue(object.key)).unsigned = false; + else if (typeof object.key === "string") + message.key = parseInt(object.key, 10); + else if (typeof object.key === "number") + message.key = object.key; + else if (typeof object.key === "object") + message.key = new $util.LongBits(object.key.low >>> 0, object.key.high >>> 0).toNumber(); + if (object.str != null) + if ($util.Long) + (message.str = $util.Long.fromValue(object.str)).unsigned = false; + else if (typeof object.str === "string") + message.str = parseInt(object.str, 10); + else if (typeof object.str === "number") + message.str = object.str; + else if (typeof object.str === "object") + message.str = new $util.LongBits(object.str.low >>> 0, object.str.high >>> 0).toNumber(); + if (object.num != null) + if ($util.Long) + (message.num = $util.Long.fromValue(object.num)).unsigned = false; + else if (typeof object.num === "string") + message.num = parseInt(object.num, 10); + else if (typeof object.num === "number") + message.num = object.num; + else if (typeof object.num === "object") + message.num = new $util.LongBits(object.num.low >>> 0, object.num.high >>> 0).toNumber(); + if (object.numUnit != null) + if ($util.Long) + (message.numUnit = $util.Long.fromValue(object.numUnit)).unsigned = false; + else if (typeof object.numUnit === "string") + message.numUnit = parseInt(object.numUnit, 10); + else if (typeof object.numUnit === "number") + message.numUnit = object.numUnit; + else if (typeof object.numUnit === "object") + message.numUnit = new $util.LongBits(object.numUnit.low >>> 0, object.numUnit.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Label message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.Label} message Label + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Label.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.key = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.key = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.str = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.str = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.num = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.num = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.numUnit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.numUnit = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + if (typeof message.key === "number") + object.key = options.longs === String ? String(message.key) : message.key; + else + object.key = options.longs === String ? $util.Long.prototype.toString.call(message.key) : options.longs === Number ? new $util.LongBits(message.key.low >>> 0, message.key.high >>> 0).toNumber() : message.key; + if (message.str != null && message.hasOwnProperty("str")) + if (typeof message.str === "number") + object.str = options.longs === String ? String(message.str) : message.str; + else + object.str = options.longs === String ? $util.Long.prototype.toString.call(message.str) : options.longs === Number ? new $util.LongBits(message.str.low >>> 0, message.str.high >>> 0).toNumber() : message.str; + if (message.num != null && message.hasOwnProperty("num")) + if (typeof message.num === "number") + object.num = options.longs === String ? String(message.num) : message.num; + else + object.num = options.longs === String ? $util.Long.prototype.toString.call(message.num) : options.longs === Number ? new $util.LongBits(message.num.low >>> 0, message.num.high >>> 0).toNumber() : message.num; + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + if (typeof message.numUnit === "number") + object.numUnit = options.longs === String ? String(message.numUnit) : message.numUnit; + else + object.numUnit = options.longs === String ? $util.Long.prototype.toString.call(message.numUnit) : options.longs === Number ? new $util.LongBits(message.numUnit.low >>> 0, message.numUnit.high >>> 0).toNumber() : message.numUnit; + return object; + }; + + /** + * Converts this Label to JSON. + * @function toJSON + * @memberof perftools.profiles.Label + * @instance + * @returns {Object.} JSON object + */ + Label.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Label; + })(); + + profiles.Mapping = (function() { + + /** + * Properties of a Mapping. + * @memberof perftools.profiles + * @interface IMapping + * @property {number|Long|null} [id] Mapping id + * @property {number|Long|null} [memoryStart] Mapping memoryStart + * @property {number|Long|null} [memoryLimit] Mapping memoryLimit + * @property {number|Long|null} [fileOffset] Mapping fileOffset + * @property {number|Long|null} [filename] Mapping filename + * @property {number|Long|null} [buildId] Mapping buildId + * @property {boolean|null} [hasFunctions] Mapping hasFunctions + * @property {boolean|null} [hasFilenames] Mapping hasFilenames + * @property {boolean|null} [hasLineNumbers] Mapping hasLineNumbers + * @property {boolean|null} [hasInlineFrames] Mapping hasInlineFrames + */ + + /** + * Constructs a new Mapping. + * @memberof perftools.profiles + * @classdesc Represents a Mapping. + * @implements IMapping + * @constructor + * @param {perftools.profiles.IMapping=} [properties] Properties to set + */ + function Mapping(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Mapping id. + * @member {number|Long} id + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping memoryStart. + * @member {number|Long} memoryStart + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.memoryStart = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping memoryLimit. + * @member {number|Long} memoryLimit + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.memoryLimit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping fileOffset. + * @member {number|Long} fileOffset + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.fileOffset = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping filename. + * @member {number|Long} filename + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.filename = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Mapping buildId. + * @member {number|Long} buildId + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.buildId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Mapping hasFunctions. + * @member {boolean} hasFunctions + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasFunctions = false; + + /** + * Mapping hasFilenames. + * @member {boolean} hasFilenames + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasFilenames = false; + + /** + * Mapping hasLineNumbers. + * @member {boolean} hasLineNumbers + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasLineNumbers = false; + + /** + * Mapping hasInlineFrames. + * @member {boolean} hasInlineFrames + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasInlineFrames = false; + + /** + * Creates a new Mapping instance using the specified properties. + * @function create + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping=} [properties] Properties to set + * @returns {perftools.profiles.Mapping} Mapping instance + */ + Mapping.create = function create(properties) { + return new Mapping(properties); + }; + + /** + * Encodes the specified Mapping message. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Mapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.memoryStart); + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.memoryLimit); + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.fileOffset); + if (message.filename != null && message.hasOwnProperty("filename")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.filename); + if (message.buildId != null && message.hasOwnProperty("buildId")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.buildId); + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.hasFunctions); + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.hasFilenames); + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.hasLineNumbers); + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.hasInlineFrames); + return writer; + }; + + /** + * Encodes the specified Mapping message, length delimited. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Mapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Mapping message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Mapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Mapping} Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Mapping.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Mapping(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.memoryStart = reader.uint64(); + break; + case 3: + message.memoryLimit = reader.uint64(); + break; + case 4: + message.fileOffset = reader.uint64(); + break; + case 5: + message.filename = reader.int64(); + break; + case 6: + message.buildId = reader.int64(); + break; + case 7: + message.hasFunctions = reader.bool(); + break; + case 8: + message.hasFilenames = reader.bool(); + break; + case 9: + message.hasLineNumbers = reader.bool(); + break; + case 10: + message.hasInlineFrames = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Mapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Mapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Mapping} Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Mapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Mapping message. + * @function verify + * @memberof perftools.profiles.Mapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Mapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + if (!$util.isInteger(message.memoryStart) && !(message.memoryStart && $util.isInteger(message.memoryStart.low) && $util.isInteger(message.memoryStart.high))) + return "memoryStart: integer|Long expected"; + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + if (!$util.isInteger(message.memoryLimit) && !(message.memoryLimit && $util.isInteger(message.memoryLimit.low) && $util.isInteger(message.memoryLimit.high))) + return "memoryLimit: integer|Long expected"; + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + if (!$util.isInteger(message.fileOffset) && !(message.fileOffset && $util.isInteger(message.fileOffset.low) && $util.isInteger(message.fileOffset.high))) + return "fileOffset: integer|Long expected"; + if (message.filename != null && message.hasOwnProperty("filename")) + if (!$util.isInteger(message.filename) && !(message.filename && $util.isInteger(message.filename.low) && $util.isInteger(message.filename.high))) + return "filename: integer|Long expected"; + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (!$util.isInteger(message.buildId) && !(message.buildId && $util.isInteger(message.buildId.low) && $util.isInteger(message.buildId.high))) + return "buildId: integer|Long expected"; + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + if (typeof message.hasFunctions !== "boolean") + return "hasFunctions: boolean expected"; + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + if (typeof message.hasFilenames !== "boolean") + return "hasFilenames: boolean expected"; + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + if (typeof message.hasLineNumbers !== "boolean") + return "hasLineNumbers: boolean expected"; + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + if (typeof message.hasInlineFrames !== "boolean") + return "hasInlineFrames: boolean expected"; + return null; + }; + + /** + * Creates a Mapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Mapping + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Mapping} Mapping + */ + Mapping.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Mapping) + return object; + let message = new $root.perftools.profiles.Mapping(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.memoryStart != null) + if ($util.Long) + (message.memoryStart = $util.Long.fromValue(object.memoryStart)).unsigned = true; + else if (typeof object.memoryStart === "string") + message.memoryStart = parseInt(object.memoryStart, 10); + else if (typeof object.memoryStart === "number") + message.memoryStart = object.memoryStart; + else if (typeof object.memoryStart === "object") + message.memoryStart = new $util.LongBits(object.memoryStart.low >>> 0, object.memoryStart.high >>> 0).toNumber(true); + if (object.memoryLimit != null) + if ($util.Long) + (message.memoryLimit = $util.Long.fromValue(object.memoryLimit)).unsigned = true; + else if (typeof object.memoryLimit === "string") + message.memoryLimit = parseInt(object.memoryLimit, 10); + else if (typeof object.memoryLimit === "number") + message.memoryLimit = object.memoryLimit; + else if (typeof object.memoryLimit === "object") + message.memoryLimit = new $util.LongBits(object.memoryLimit.low >>> 0, object.memoryLimit.high >>> 0).toNumber(true); + if (object.fileOffset != null) + if ($util.Long) + (message.fileOffset = $util.Long.fromValue(object.fileOffset)).unsigned = true; + else if (typeof object.fileOffset === "string") + message.fileOffset = parseInt(object.fileOffset, 10); + else if (typeof object.fileOffset === "number") + message.fileOffset = object.fileOffset; + else if (typeof object.fileOffset === "object") + message.fileOffset = new $util.LongBits(object.fileOffset.low >>> 0, object.fileOffset.high >>> 0).toNumber(true); + if (object.filename != null) + if ($util.Long) + (message.filename = $util.Long.fromValue(object.filename)).unsigned = false; + else if (typeof object.filename === "string") + message.filename = parseInt(object.filename, 10); + else if (typeof object.filename === "number") + message.filename = object.filename; + else if (typeof object.filename === "object") + message.filename = new $util.LongBits(object.filename.low >>> 0, object.filename.high >>> 0).toNumber(); + if (object.buildId != null) + if ($util.Long) + (message.buildId = $util.Long.fromValue(object.buildId)).unsigned = false; + else if (typeof object.buildId === "string") + message.buildId = parseInt(object.buildId, 10); + else if (typeof object.buildId === "number") + message.buildId = object.buildId; + else if (typeof object.buildId === "object") + message.buildId = new $util.LongBits(object.buildId.low >>> 0, object.buildId.high >>> 0).toNumber(); + if (object.hasFunctions != null) + message.hasFunctions = Boolean(object.hasFunctions); + if (object.hasFilenames != null) + message.hasFilenames = Boolean(object.hasFilenames); + if (object.hasLineNumbers != null) + message.hasLineNumbers = Boolean(object.hasLineNumbers); + if (object.hasInlineFrames != null) + message.hasInlineFrames = Boolean(object.hasInlineFrames); + return message; + }; + + /** + * Creates a plain object from a Mapping message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.Mapping} message Mapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Mapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.memoryStart = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.memoryStart = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.memoryLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.memoryLimit = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.fileOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileOffset = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.filename = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.filename = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.buildId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.buildId = options.longs === String ? "0" : 0; + object.hasFunctions = false; + object.hasFilenames = false; + object.hasLineNumbers = false; + object.hasInlineFrames = false; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + if (typeof message.memoryStart === "number") + object.memoryStart = options.longs === String ? String(message.memoryStart) : message.memoryStart; + else + object.memoryStart = options.longs === String ? $util.Long.prototype.toString.call(message.memoryStart) : options.longs === Number ? new $util.LongBits(message.memoryStart.low >>> 0, message.memoryStart.high >>> 0).toNumber(true) : message.memoryStart; + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + if (typeof message.memoryLimit === "number") + object.memoryLimit = options.longs === String ? String(message.memoryLimit) : message.memoryLimit; + else + object.memoryLimit = options.longs === String ? $util.Long.prototype.toString.call(message.memoryLimit) : options.longs === Number ? new $util.LongBits(message.memoryLimit.low >>> 0, message.memoryLimit.high >>> 0).toNumber(true) : message.memoryLimit; + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + if (typeof message.fileOffset === "number") + object.fileOffset = options.longs === String ? String(message.fileOffset) : message.fileOffset; + else + object.fileOffset = options.longs === String ? $util.Long.prototype.toString.call(message.fileOffset) : options.longs === Number ? new $util.LongBits(message.fileOffset.low >>> 0, message.fileOffset.high >>> 0).toNumber(true) : message.fileOffset; + if (message.filename != null && message.hasOwnProperty("filename")) + if (typeof message.filename === "number") + object.filename = options.longs === String ? String(message.filename) : message.filename; + else + object.filename = options.longs === String ? $util.Long.prototype.toString.call(message.filename) : options.longs === Number ? new $util.LongBits(message.filename.low >>> 0, message.filename.high >>> 0).toNumber() : message.filename; + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (typeof message.buildId === "number") + object.buildId = options.longs === String ? String(message.buildId) : message.buildId; + else + object.buildId = options.longs === String ? $util.Long.prototype.toString.call(message.buildId) : options.longs === Number ? new $util.LongBits(message.buildId.low >>> 0, message.buildId.high >>> 0).toNumber() : message.buildId; + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + object.hasFunctions = message.hasFunctions; + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + object.hasFilenames = message.hasFilenames; + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + object.hasLineNumbers = message.hasLineNumbers; + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + object.hasInlineFrames = message.hasInlineFrames; + return object; + }; + + /** + * Converts this Mapping to JSON. + * @function toJSON + * @memberof perftools.profiles.Mapping + * @instance + * @returns {Object.} JSON object + */ + Mapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Mapping; + })(); + + profiles.Location = (function() { + + /** + * Properties of a Location. + * @memberof perftools.profiles + * @interface ILocation + * @property {number|Long|null} [id] Location id + * @property {number|Long|null} [mappingId] Location mappingId + * @property {number|Long|null} [address] Location address + * @property {Array.|null} [line] Location line + * @property {boolean|null} [isFolded] Location isFolded + */ + + /** + * Constructs a new Location. + * @memberof perftools.profiles + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {perftools.profiles.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.line = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location id. + * @member {number|Long} id + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location mappingId. + * @member {number|Long} mappingId + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.mappingId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location address. + * @member {number|Long} address + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.address = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location line. + * @member {Array.} line + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.line = $util.emptyArray; + + /** + * Location isFolded. + * @member {boolean} isFolded + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.isFolded = false; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation=} [properties] Properties to set + * @returns {perftools.profiles.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.mappingId); + if (message.address != null && message.hasOwnProperty("address")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.address); + if (message.line != null && message.line.length) + for (let i = 0; i < message.line.length; ++i) + $root.perftools.profiles.Line.encode(message.line[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.isFolded != null && message.hasOwnProperty("isFolded")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isFolded); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Location(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.mappingId = reader.uint64(); + break; + case 3: + message.address = reader.uint64(); + break; + case 4: + if (!(message.line && message.line.length)) + message.line = []; + message.line.push($root.perftools.profiles.Line.decode(reader, reader.uint32())); + break; + case 5: + message.isFolded = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof perftools.profiles.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + if (!$util.isInteger(message.mappingId) && !(message.mappingId && $util.isInteger(message.mappingId.low) && $util.isInteger(message.mappingId.high))) + return "mappingId: integer|Long expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isInteger(message.address) && !(message.address && $util.isInteger(message.address.low) && $util.isInteger(message.address.high))) + return "address: integer|Long expected"; + if (message.line != null && message.hasOwnProperty("line")) { + if (!Array.isArray(message.line)) + return "line: array expected"; + for (let i = 0; i < message.line.length; ++i) { + let error = $root.perftools.profiles.Line.verify(message.line[i]); + if (error) + return "line." + error; + } + } + if (message.isFolded != null && message.hasOwnProperty("isFolded")) + if (typeof message.isFolded !== "boolean") + return "isFolded: boolean expected"; + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Location + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Location) + return object; + let message = new $root.perftools.profiles.Location(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.mappingId != null) + if ($util.Long) + (message.mappingId = $util.Long.fromValue(object.mappingId)).unsigned = true; + else if (typeof object.mappingId === "string") + message.mappingId = parseInt(object.mappingId, 10); + else if (typeof object.mappingId === "number") + message.mappingId = object.mappingId; + else if (typeof object.mappingId === "object") + message.mappingId = new $util.LongBits(object.mappingId.low >>> 0, object.mappingId.high >>> 0).toNumber(true); + if (object.address != null) + if ($util.Long) + (message.address = $util.Long.fromValue(object.address)).unsigned = true; + else if (typeof object.address === "string") + message.address = parseInt(object.address, 10); + else if (typeof object.address === "number") + message.address = object.address; + else if (typeof object.address === "object") + message.address = new $util.LongBits(object.address.low >>> 0, object.address.high >>> 0).toNumber(true); + if (object.line) { + if (!Array.isArray(object.line)) + throw TypeError(".perftools.profiles.Location.line: array expected"); + message.line = []; + for (let i = 0; i < object.line.length; ++i) { + if (typeof object.line[i] !== "object") + throw TypeError(".perftools.profiles.Location.line: object expected"); + message.line[i] = $root.perftools.profiles.Line.fromObject(object.line[i]); + } + } + if (object.isFolded != null) + message.isFolded = Boolean(object.isFolded); + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.line = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.mappingId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mappingId = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.address = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.address = options.longs === String ? "0" : 0; + object.isFolded = false; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + if (typeof message.mappingId === "number") + object.mappingId = options.longs === String ? String(message.mappingId) : message.mappingId; + else + object.mappingId = options.longs === String ? $util.Long.prototype.toString.call(message.mappingId) : options.longs === Number ? new $util.LongBits(message.mappingId.low >>> 0, message.mappingId.high >>> 0).toNumber(true) : message.mappingId; + if (message.address != null && message.hasOwnProperty("address")) + if (typeof message.address === "number") + object.address = options.longs === String ? String(message.address) : message.address; + else + object.address = options.longs === String ? $util.Long.prototype.toString.call(message.address) : options.longs === Number ? new $util.LongBits(message.address.low >>> 0, message.address.high >>> 0).toNumber(true) : message.address; + if (message.line && message.line.length) { + object.line = []; + for (let j = 0; j < message.line.length; ++j) + object.line[j] = $root.perftools.profiles.Line.toObject(message.line[j], options); + } + if (message.isFolded != null && message.hasOwnProperty("isFolded")) + object.isFolded = message.isFolded; + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof perftools.profiles.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + profiles.Line = (function() { + + /** + * Properties of a Line. + * @memberof perftools.profiles + * @interface ILine + * @property {number|Long|null} [functionId] Line functionId + * @property {number|Long|null} [line] Line line + */ + + /** + * Constructs a new Line. + * @memberof perftools.profiles + * @classdesc Represents a Line. + * @implements ILine + * @constructor + * @param {perftools.profiles.ILine=} [properties] Properties to set + */ + function Line(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line functionId. + * @member {number|Long} functionId + * @memberof perftools.profiles.Line + * @instance + */ + Line.prototype.functionId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Line line. + * @member {number|Long} line + * @memberof perftools.profiles.Line + * @instance + */ + Line.prototype.line = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine=} [properties] Properties to set + * @returns {perftools.profiles.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functionId != null && message.hasOwnProperty("functionId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.functionId); + if (message.line != null && message.hasOwnProperty("line")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.line); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Line(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.functionId = reader.uint64(); + break; + case 2: + message.line = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof perftools.profiles.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isInteger(message.functionId) && !(message.functionId && $util.isInteger(message.functionId.low) && $util.isInteger(message.functionId.high))) + return "functionId: integer|Long expected"; + if (message.line != null && message.hasOwnProperty("line")) + if (!$util.isInteger(message.line) && !(message.line && $util.isInteger(message.line.low) && $util.isInteger(message.line.high))) + return "line: integer|Long expected"; + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Line + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Line) + return object; + let message = new $root.perftools.profiles.Line(); + if (object.functionId != null) + if ($util.Long) + (message.functionId = $util.Long.fromValue(object.functionId)).unsigned = true; + else if (typeof object.functionId === "string") + message.functionId = parseInt(object.functionId, 10); + else if (typeof object.functionId === "number") + message.functionId = object.functionId; + else if (typeof object.functionId === "object") + message.functionId = new $util.LongBits(object.functionId.low >>> 0, object.functionId.high >>> 0).toNumber(true); + if (object.line != null) + if ($util.Long) + (message.line = $util.Long.fromValue(object.line)).unsigned = false; + else if (typeof object.line === "string") + message.line = parseInt(object.line, 10); + else if (typeof object.line === "number") + message.line = object.line; + else if (typeof object.line === "object") + message.line = new $util.LongBits(object.line.low >>> 0, object.line.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.functionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.functionId = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.line = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.line = options.longs === String ? "0" : 0; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (typeof message.functionId === "number") + object.functionId = options.longs === String ? String(message.functionId) : message.functionId; + else + object.functionId = options.longs === String ? $util.Long.prototype.toString.call(message.functionId) : options.longs === Number ? new $util.LongBits(message.functionId.low >>> 0, message.functionId.high >>> 0).toNumber(true) : message.functionId; + if (message.line != null && message.hasOwnProperty("line")) + if (typeof message.line === "number") + object.line = options.longs === String ? String(message.line) : message.line; + else + object.line = options.longs === String ? $util.Long.prototype.toString.call(message.line) : options.longs === Number ? new $util.LongBits(message.line.low >>> 0, message.line.high >>> 0).toNumber() : message.line; + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof perftools.profiles.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + profiles.Function = (function() { + + /** + * Properties of a Function. + * @memberof perftools.profiles + * @interface IFunction + * @property {number|Long|null} [id] Function id + * @property {number|Long|null} [name] Function name + * @property {number|Long|null} [systemName] Function systemName + * @property {number|Long|null} [filename] Function filename + * @property {number|Long|null} [startLine] Function startLine + */ + + /** + * Constructs a new Function. + * @memberof perftools.profiles + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {perftools.profiles.IFunction=} [properties] Properties to set + */ + function Function(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function id. + * @member {number|Long} id + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Function name. + * @member {number|Long} name + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.name = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function systemName. + * @member {number|Long} systemName + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.systemName = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function filename. + * @member {number|Long} filename + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.filename = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function startLine. + * @member {number|Long} startLine + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.startLine = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction=} [properties] Properties to set + * @returns {perftools.profiles.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.name); + if (message.systemName != null && message.hasOwnProperty("systemName")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.systemName); + if (message.filename != null && message.hasOwnProperty("filename")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.filename); + if (message.startLine != null && message.hasOwnProperty("startLine")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.startLine); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Function(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.name = reader.int64(); + break; + case 3: + message.systemName = reader.int64(); + break; + case 4: + message.filename = reader.int64(); + break; + case 5: + message.startLine = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof perftools.profiles.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isInteger(message.name) && !(message.name && $util.isInteger(message.name.low) && $util.isInteger(message.name.high))) + return "name: integer|Long expected"; + if (message.systemName != null && message.hasOwnProperty("systemName")) + if (!$util.isInteger(message.systemName) && !(message.systemName && $util.isInteger(message.systemName.low) && $util.isInteger(message.systemName.high))) + return "systemName: integer|Long expected"; + if (message.filename != null && message.hasOwnProperty("filename")) + if (!$util.isInteger(message.filename) && !(message.filename && $util.isInteger(message.filename.low) && $util.isInteger(message.filename.high))) + return "filename: integer|Long expected"; + if (message.startLine != null && message.hasOwnProperty("startLine")) + if (!$util.isInteger(message.startLine) && !(message.startLine && $util.isInteger(message.startLine.low) && $util.isInteger(message.startLine.high))) + return "startLine: integer|Long expected"; + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Function + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Function) + return object; + let message = new $root.perftools.profiles.Function(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.name != null) + if ($util.Long) + (message.name = $util.Long.fromValue(object.name)).unsigned = false; + else if (typeof object.name === "string") + message.name = parseInt(object.name, 10); + else if (typeof object.name === "number") + message.name = object.name; + else if (typeof object.name === "object") + message.name = new $util.LongBits(object.name.low >>> 0, object.name.high >>> 0).toNumber(); + if (object.systemName != null) + if ($util.Long) + (message.systemName = $util.Long.fromValue(object.systemName)).unsigned = false; + else if (typeof object.systemName === "string") + message.systemName = parseInt(object.systemName, 10); + else if (typeof object.systemName === "number") + message.systemName = object.systemName; + else if (typeof object.systemName === "object") + message.systemName = new $util.LongBits(object.systemName.low >>> 0, object.systemName.high >>> 0).toNumber(); + if (object.filename != null) + if ($util.Long) + (message.filename = $util.Long.fromValue(object.filename)).unsigned = false; + else if (typeof object.filename === "string") + message.filename = parseInt(object.filename, 10); + else if (typeof object.filename === "number") + message.filename = object.filename; + else if (typeof object.filename === "object") + message.filename = new $util.LongBits(object.filename.low >>> 0, object.filename.high >>> 0).toNumber(); + if (object.startLine != null) + if ($util.Long) + (message.startLine = $util.Long.fromValue(object.startLine)).unsigned = false; + else if (typeof object.startLine === "string") + message.startLine = parseInt(object.startLine, 10); + else if (typeof object.startLine === "number") + message.startLine = object.startLine; + else if (typeof object.startLine === "object") + message.startLine = new $util.LongBits(object.startLine.low >>> 0, object.startLine.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.name = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.name = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.systemName = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.systemName = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.filename = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.filename = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.startLine = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startLine = options.longs === String ? "0" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.name != null && message.hasOwnProperty("name")) + if (typeof message.name === "number") + object.name = options.longs === String ? String(message.name) : message.name; + else + object.name = options.longs === String ? $util.Long.prototype.toString.call(message.name) : options.longs === Number ? new $util.LongBits(message.name.low >>> 0, message.name.high >>> 0).toNumber() : message.name; + if (message.systemName != null && message.hasOwnProperty("systemName")) + if (typeof message.systemName === "number") + object.systemName = options.longs === String ? String(message.systemName) : message.systemName; + else + object.systemName = options.longs === String ? $util.Long.prototype.toString.call(message.systemName) : options.longs === Number ? new $util.LongBits(message.systemName.low >>> 0, message.systemName.high >>> 0).toNumber() : message.systemName; + if (message.filename != null && message.hasOwnProperty("filename")) + if (typeof message.filename === "number") + object.filename = options.longs === String ? String(message.filename) : message.filename; + else + object.filename = options.longs === String ? $util.Long.prototype.toString.call(message.filename) : options.longs === Number ? new $util.LongBits(message.filename.low >>> 0, message.filename.high >>> 0).toNumber() : message.filename; + if (message.startLine != null && message.hasOwnProperty("startLine")) + if (typeof message.startLine === "number") + object.startLine = options.longs === String ? String(message.startLine) : message.startLine; + else + object.startLine = options.longs === String ? $util.Long.prototype.toString.call(message.startLine) : options.longs === Number ? new $util.LongBits(message.startLine.low >>> 0, message.startLine.high >>> 0).toNumber() : message.startLine; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof perftools.profiles.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Function; + })(); + + return profiles; + })(); + + return perftools; +})(); + +export { $root as default }; diff --git a/src/import/trace-event.ts b/src/import/trace-event.ts index ceb09eadf..436330f96 100644 --- a/src/import/trace-event.ts +++ b/src/import/trace-event.ts @@ -7,6 +7,8 @@ import { StackListProfileBuilder, } from '../lib/profile' import {TimeFormatter} from '../lib/value-formatters' +import {metadataAtom} from '../app-state' +import {Metadata} from '../app-state/profile-group'; // This file concerns import from the "Trace Event Format", authored by Google // and used for Google's own chrome://trace. @@ -317,9 +319,6 @@ function getEventName(event: TraceEvent): string { */ function getEventId(event: TraceEvent): string { let key = getEventName(event) - if (event.args) { - key += ` ${JSON.stringify(event.args)}` - } return key } @@ -346,6 +345,7 @@ function frameInfoForEvent( return { name: key, key: key, + args: {[(event.ph === 'B') ? 'begin' : 'end']: event.args}, } } @@ -479,6 +479,10 @@ function eventListToProfile( } frameStack.pop() + // Add args from the end event to the frame + if (e.args) { + profileBuilder.updateFrameArgs(bFrameInfo, {end: e.args}) + } profileBuilder.leaveFrame(bFrameInfo, e.ts) } @@ -644,6 +648,9 @@ function eventListToProfileGroup( const partitionedTraceEvents = partitionByPidTid(importableEvents) const profileNamesByPidTid = getProfileNamesFromTraceEvents(events, partitionedTraceEvents) + // Extract metadata + importMetadata(events) + const profilePairs: [string, Profile][] = [] profileNamesByPidTid.forEach((name, profileKey) => { @@ -770,6 +777,15 @@ function isTraceEventWithSamples( ) } +function importMetadata(events: TraceEvent[]) { + const metadata: Metadata[] = [] + for (const event of events) { + if (event.ph !== 'M') continue + metadata.push(event) + } + metadataAtom.set(metadata) +} + export function isTraceEventFormatted(rawProfile: any): rawProfile is Trace { // We're only going to support the JSON formatted profiles for now. // The spec also discusses support for data embedded in ftrace supported data: https://lwn.net/Articles/365835/. diff --git a/src/lib/demangle/demangle.wasm.js b/src/lib/demangle/demangle.wasm.js index 30fb615ba..1665d7d3c 100644 --- a/src/lib/demangle/demangle.wasm.js +++ b/src/lib/demangle/demangle.wasm.js @@ -12,5 +12,4 @@ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise * * This file is only used as --extern-post-js of emcc. */ -module.exports = Module -module.exports.default = Module +export default Module; diff --git a/src/lib/file-format-spec.ts b/src/lib/file-format-spec.ts index 8e7218c0c..192874507 100644 --- a/src/lib/file-format-spec.ts +++ b/src/lib/file-format-spec.ts @@ -1,5 +1,7 @@ // This file contains types which specify the speedscope file format. +import { Metadata } from "../app-state/profile-group" + export namespace FileFormat { export type Profile = EventedProfile | SampledProfile @@ -34,6 +36,9 @@ export namespace FileFormat { // // Added in 0.6.0 exporter?: string + + // List of metadata included in profile + metadata?: Metadata[], } export interface Frame { diff --git a/src/lib/file-format.ts b/src/lib/file-format.ts index 2ec5eee96..4a63e995d 100644 --- a/src/lib/file-format.ts +++ b/src/lib/file-format.ts @@ -9,6 +9,8 @@ import { } from './profile' import {TimeFormatter, ByteFormatter, RawValueFormatter} from './value-formatters' import {FileFormat} from './file-format-spec' +import { metadataAtom } from '../app-state' +import { version } from '../../package.json'; export function exportProfileGroup(profileGroup: ProfileGroup): FileFormat.File { const frames: FileFormat.Frame[] = [] @@ -31,7 +33,7 @@ export function exportProfileGroup(profileGroup: ProfileGroup): FileFormat.File } const file: FileFormat.File = { - exporter: `speedscope@${require('../../package.json').version}`, + exporter: `speedscope@${version}`, name: profileGroup.name, activeProfileIndex: profileGroup.indexToView, $schema: 'https://www.speedscope.app/file-format-schema.json', @@ -39,6 +41,11 @@ export function exportProfileGroup(profileGroup: ProfileGroup): FileFormat.File profiles: [], } + const metadata = metadataAtom.get(); + if (metadata) { + file.metadata = metadata; + } + for (let profile of profileGroup.profiles) { file.profiles.push(exportProfile(profile, getIndexForFrame)) } @@ -156,6 +163,9 @@ function importSpeedscopeProfile( } export function importSpeedscopeProfiles(serialized: FileFormat.File): ProfileGroup { + if (serialized.metadata) { + metadataAtom.set(serialized.metadata); + } return { name: serialized.name || serialized.profiles[0].name || 'profile', indexToView: serialized.activeProfileIndex || 0, diff --git a/src/lib/profile.ts b/src/lib/profile.ts index e34ac5800..18b54ab29 100644 --- a/src/lib/profile.ts +++ b/src/lib/profile.ts @@ -18,6 +18,9 @@ export interface FrameInfo { // Column in the file, 1-based. col?: number + + // Additional data + args?: Object } export type SymbolRemapper = ( @@ -46,7 +49,7 @@ export class HasWeights { } } -export class Frame extends HasWeights { +export class Frame extends HasWeights implements FrameInfo { key: string | number // Name of the frame. May be a method name, e.g. @@ -63,6 +66,9 @@ export class Frame extends HasWeights { // Column in the file col?: number + // Additional data + args?: Object + private constructor(info: FrameInfo) { super() this.key = info.key @@ -70,6 +76,7 @@ export class Frame extends HasWeights { this.file = info.file this.line = info.line this.col = info.col + this.args = info.args } static root = new Frame({ @@ -694,4 +701,9 @@ export class CallTreeProfileBuilder extends Profile { this.sortGroupedCallTree() return this } + + updateFrameArgs(frameInfo: FrameInfo, args: Object) { + const frame = Frame.getOrInsert(this.frames, frameInfo) + frame.args = {...frame.args, ...args} + } } diff --git a/src/lib/text-utils.ts b/src/lib/text-utils.ts index 5fd52a035..0159e706e 100644 --- a/src/lib/text-utils.ts +++ b/src/lib/text-utils.ts @@ -5,12 +5,12 @@ export const ELLIPSIS = '\u2026' // NOTE: This blindly assumes the same result across contexts. const measureTextCache = new Map() -let lastDevicePixelRatio = -1 +let lastDevicePixelRatioForWidth = -1 export function cachedMeasureTextWidth(ctx: CanvasRenderingContext2D, text: string): number { - if (window.devicePixelRatio !== lastDevicePixelRatio) { + if (window.devicePixelRatio !== lastDevicePixelRatioForWidth) { // This cache is no longer valid! measureTextCache.clear() - lastDevicePixelRatio = window.devicePixelRatio + lastDevicePixelRatioForWidth = window.devicePixelRatio } if (!measureTextCache.has(text)) { measureTextCache.set(text, ctx.measureText(text).width) @@ -18,6 +18,22 @@ export function cachedMeasureTextWidth(ctx: CanvasRenderingContext2D, text: stri return measureTextCache.get(text)! } +let _cachedTextHeight: number | null = null +let lastDevicePixelRatioForHeight = -1 +export function cachedTextHeight(ctx: CanvasRenderingContext2D, text: string): number { + if (window.devicePixelRatio !== lastDevicePixelRatioForHeight) { + // This cache is no longer valid! + _cachedTextHeight = null + lastDevicePixelRatioForHeight = window.devicePixelRatio + } + if (!_cachedTextHeight) { + const measurement = ctx.measureText(text) + _cachedTextHeight = measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent + } + return _cachedTextHeight! +} + + interface TrimmedTextResult { trimmedString: string trimmedLength: number diff --git a/src/lib/utils.ts b/src/lib/utils.ts index afa9e2081..2df5974d3 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,3 +1,5 @@ +import { AffineTransform, Vec2 } from "./math" + export function lastOf(ts: T[]): T | null { return ts[ts.length - 1] || null } @@ -232,7 +234,7 @@ export function decodeBase64(encoded: string): Uint8Array { const lookupTable = base64lookupTable() - // 3 byte groups are represented as sequneces of 4 characters. + // 3 byte groups are represented as sequences of 4 characters. // // "The encoding process represents 24-bit groups of input bits as output // strings of 4 encoded characters." @@ -328,3 +330,17 @@ export function decodeBase64(encoded: string): Uint8Array { return bytes } + + +export interface HoveredPoint { + // The timestamp in ms + x: number, + // The relative position of cursor on Y axis + yProc: number, +} + +export const getPosition = (point: HoveredPoint, configToPhysical: AffineTransform) => { + const configSpacePos = point.x * 1000 + const physicalSpacePos = Math.round(configToPhysical.transformPosition(new Vec2(configSpacePos, 0)).x) + return {configSpacePos, physicalSpacePos} +} diff --git a/src/speedscope.tsx b/src/speedscope.tsx index 9f49e5d1a..bec0a9240 100644 --- a/src/speedscope.tsx +++ b/src/speedscope.tsx @@ -4,6 +4,11 @@ import {ThemeProvider} from './views/themes/theme' console.log(`speedscope v${require('../package.json').version}`) +const useFullViewportStyles = { + width: '100vw', + height: '100vh', +} + /* TODO(jlfwong): Fix this declare const module: any @@ -17,9 +22,11 @@ if (module.hot) { */ render( - - - , +
+ + + +
, document.body, document.body.lastElementChild || undefined, ) diff --git a/src/views/application-container.tsx b/src/views/application-container.tsx index 7b57d289d..c79cd0831 100644 --- a/src/views/application-container.tsx +++ b/src/views/application-container.tsx @@ -1,6 +1,6 @@ import {h} from 'preact' import {getCanvasContext} from '../app-state/getters' -import {memo, useMemo} from 'preact/compat' +import {memo, useEffect, useMemo, useRef} from 'preact/compat' import {useActiveProfileState} from '../app-state/active-profile-state' import {useTheme} from './themes/theme' import { @@ -12,6 +12,8 @@ import { loadingAtom, profileGroupAtom, viewModeAtom, + customWelcomeMessagesAtom, + appRefAtom, } from '../app-state' import {useAtom} from '../lib/atom' import {ProfileSearchContextProvider} from './search-view' @@ -24,10 +26,17 @@ export const ApplicationContainer = memo(() => { () => (canvas ? getCanvasContext({theme, canvas}) : null), [theme, canvas], ) + const ref = useRef(); + + useEffect(() => { + if (ref) {appRefAtom.set(ref);} + return () => appRefAtom.set(null); + }) return ( { dragActive={useAtom(dragActiveAtom)} loading={useAtom(loadingAtom)} error={useAtom(errorAtom)} + customWelcomeMessage={useAtom(customWelcomeMessagesAtom)} /> ) diff --git a/src/views/application.tsx b/src/views/application.tsx index be2424200..a7763d8d8 100644 --- a/src/views/application.tsx +++ b/src/views/application.tsx @@ -1,10 +1,10 @@ import '../../assets/reset.css' import '../../assets/source-code-pro.css' -import {h} from 'preact' +import {createRef, h} from 'preact' import {StyleSheet, css} from 'aphrodite' -import {ProfileGroup, SymbolRemapper} from '../lib/profile' +import {CallTreeProfileBuilder, ProfileGroup, SymbolRemapper} from '../lib/profile' import {FontFamily, FontSize, Duration} from './style' import {importEmscriptenSymbolMap as importEmscriptenSymbolRemapper} from '../lib/emscripten' import {saveToFile} from '../lib/file-format' @@ -15,11 +15,12 @@ import {Toolbar} from './toolbar' import {importJavaScriptSourceMapSymbolRemapper} from '../lib/js-source-map' import {Theme, withTheme} from './themes/theme' import {ViewMode} from '../lib/view-mode' -import {canUseXHR} from '../app-state' +import {canUseXHR, CustomWelcomeMessage, metadataAtom, toolbarConfigAtom, metadataOnlyProfileAtom} from '../app-state' import {ProfileGroupState} from '../app-state/profile-group' import {HashParams} from '../lib/hash-params' import {StatelessComponent} from '../lib/preact-helpers' import {SandwichViewContainer} from './sandwich-view' +import { useAtom } from '../lib/atom' const importModule = import('../import') @@ -59,8 +60,7 @@ async function importFromFileSystemDirectoryEntry(entry: FileSystemDirectoryEntr return (await importModule).importFromFileSystemDirectoryEntry(entry) } -declare function require(x: string): any -const exampleProfileURL = require('../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt') +import exampleProfileURL from '../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt' function isFileSystemDirectoryEntry(entry: FileSystemEntry): entry is FileSystemDirectoryEntry { return entry != null && entry.isDirectory @@ -167,9 +167,12 @@ export type ApplicationProps = { loading: boolean glCanvas: HTMLCanvasElement | null error: boolean + customWelcomeMessage: CustomWelcomeMessage } export class Application extends StatelessComponent { + glCanvasRef = createRef() + private async loadProfile(loader: () => Promise) { this.props.setError(false) this.props.setLoading(true) @@ -193,10 +196,21 @@ export class Application extends StatelessComponent { alert('Unrecognized format! See documentation about supported formats.') this.props.setLoading(false) return - } else if (profileGroup.profiles.length === 0) { + } else if (profileGroup.profiles.length === 0 && (metadataAtom.get()?.length ?? 0) === 0) { alert("Successfully imported profile, but it's empty!") this.props.setLoading(false) return + } else if (profileGroup.profiles.length === 0) { + // Profile with only metadata loaded - creates artificial empty profile + const maxTs = Math.max(...(metadataAtom.get()?.map(v => v.ts).filter(Boolean) ?? [1])) + metadataOnlyProfileAtom.set(true); + const p = new CallTreeProfileBuilder(maxTs) + const frameInfo = {key: 'no_trace', name: ''} + p.enterFrame(frameInfo, 0) + p.leaveFrame(frameInfo, maxTs) + profileGroup.profiles.push(p.build()); + } else { + metadataOnlyProfileAtom.set(false); } if (this.props.hashParams.title) { @@ -215,12 +229,24 @@ export class Application extends StatelessComponent { await profile.demangle() } - for (let profile of profileGroup.profiles) { + profileGroup.profiles.forEach((profile, i) => { const title = this.props.hashParams.title || profile.getName() profile.setName(title) - } + // By default select profile named as "main" + if (title.startsWith("main (")) { + profileGroup.indexToView = i; + } + }) console.timeEnd('import') + setTimeout(() => { + if (!this.glCanvasRef.current) { + console.warn("webGL colors will not be updated") + return + } + // Update colors for webGL context, as it does not react on theme change + this.glCanvasRef.current.props.canvasContext?.flamechartColorPassRenderer.updateMaterial(this.glCanvasRef.current.props.canvasContext.gl, this.props.theme) + }) this.props.setProfileGroup(profileGroup) this.props.setLoading(false) @@ -305,17 +331,28 @@ export class Application extends StatelessComponent { }) } + private checkDragImportEnabled = () => { + return toolbarConfigAtom.get().dragImport ?? true; + } + onDrop = (ev: DragEvent) => { + if (!this.checkDragImportEnabled()) { + return; + } this.props.setDragActive(false) ev.preventDefault() - if (!ev.dataTransfer) return + this.loadDropFile(ev); + } + loadDropFile = (ev: DragEvent) => { + if (!ev.dataTransfer) return const firstItem = ev.dataTransfer.items[0] - if ('webkitGetAsEntry' in firstItem) { + if (firstItem && 'webkitGetAsEntry' in firstItem) { const webkitEntry: FileSystemEntry | null = firstItem.webkitGetAsEntry() // Instrument.app file format is actually a directory. + console.log(firstItem, webkitEntry); if ( webkitEntry && isFileSystemDirectoryEntry(webkitEntry) && @@ -328,20 +365,31 @@ export class Application extends StatelessComponent { }) return } + } else if (!firstItem) { + console.warn("Drag&drop has not provided any items"); } let file: File | null = ev.dataTransfer.files.item(0) if (file) { + console.log("importing from file", file); this.loadFromFile(file) + } else { + console.warn("Drag&drop has not provided any files"); } } onDragOver = (ev: DragEvent) => { + if (!this.checkDragImportEnabled()) { + return; + } this.props.setDragActive(true) ev.preventDefault() } onDragLeave = (ev: DragEvent) => { + if (!this.checkDragImportEnabled()) { + return; + } this.props.setDragActive(false) ev.preventDefault() } @@ -369,7 +417,7 @@ export class Application extends StatelessComponent { } } - private saveFile = () => { + saveFile = () => { if (this.props.profileGroup) { const {name, indexToView, profiles} = this.props.profileGroup const profileGroup: ProfileGroup = { @@ -381,7 +429,7 @@ export class Application extends StatelessComponent { } } - private browseForFile = () => { + browseForFile = () => { const input = document.createElement('input') input.type = 'file' input.addEventListener('change', this.onFileSelect) @@ -470,72 +518,83 @@ export class Application extends StatelessComponent { renderLanding() { const style = this.getStyle() + const browseButton = ( +
+ + +
+ ) + return (
-
-

- 👋 Hi there! Welcome to 🔬speedscope, an interactive{' '} - - flamegraph - {' '} - visualizer. Use it to help you make your software faster. -

- {canUseXHR ? ( -

- 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{' '} - - click here - {' '} - to load an example profile. -

- ) : ( -

- 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. -

- )} -
- - -
- -

- See the{' '} - - documentation - {' '} - for information about supported file formats, keyboard shortcuts, and how to navigate - around the profile. -

- -

- speedscope is open source. Please{' '} - - report any issues on GitHub - - . -

-
+ {((this.props.customWelcomeMessage.default) ? + // Use custom welcome message + this.props.customWelcomeMessage.default(css(style.landingMessage), css(style.landingP), css(style.link), browseButton) + : + // Use default welcome message +
+

+ 👋 Hi there! Welcome to 🔬speedscope, an interactive{' '} + + flamegraph + {' '} + visualizer. Use it to help you make your software faster. +

+ {canUseXHR ? ( +

+ 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{' '} + + click here + {' '} + to load an example profile. +

+ ) : ( +

+ 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. +

+ )} + {browseButton} + +

+ See the{' '} + + documentation + {' '} + for information about supported file formats, keyboard shortcuts, and how to navigate + around the profile. +

+ +

+ speedscope is open source. Please{' '} + + report any issues on GitHub + + . +

+
+ ) + }
) } @@ -588,6 +647,7 @@ export class Application extends StatelessComponent { render() { const style = this.getStyle() + const transparent = useAtom(metadataOnlyProfileAtom); return (
{ className={css(style.root, this.props.dragActive && style.dragTargetRoot)} > { />
{this.renderContent()}
{this.props.dragActive &&
} + {transparent &&
+

NO TRACE

+

This TEF does not come with any trace

+
}
) } @@ -615,7 +680,10 @@ export class Application extends StatelessComponent { const getStyle = withTheme(theme => StyleSheet.create({ glCanvasView: { - position: 'absolute', + // WebGL canvas is assumed to be placed at the top of the view + position: 'fixed', + top: 0, + left: 0, width: '100vw', height: '100vh', zIndex: -1, @@ -647,8 +715,8 @@ const getStyle = withTheme(theme => animationDuration: '30s', }, root: { - width: '100vw', - height: '100vh', + width: '100%', + height: '100%', overflow: 'hidden', display: 'flex', flexDirection: 'column', @@ -721,5 +789,30 @@ const getStyle = withTheme(theme => color: theme.selectionSecondaryColor, }, }, + noTraceWatermark: { + backgroundColor: "transparent", + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0, + opacity: 0.5, + display: 'flex', + flexDirection: 'column', + gap: '1.1rem', + justifyContent: 'center', + alignItems: 'center', + textAlign: 'center', + 'user-select': 'none', + '-webki-user-select': 'none', + '-ms-user-select': 'none', + }, + watermarkH1: { + fontSize: '7.5em', + lineHeight: '6rem', + }, + watermarkP: { + fontSize: '1.4em', + }, }), ) diff --git a/src/views/flamechart-minimap-view.tsx b/src/views/flamechart-minimap-view.tsx index 1f4db1948..9a9566bd3 100644 --- a/src/views/flamechart-minimap-view.tsx +++ b/src/views/flamechart-minimap-view.tsx @@ -9,6 +9,8 @@ import {CanvasContext} from '../gl/canvas-context' import {cachedMeasureTextWidth} from '../lib/text-utils' import {Color} from '../lib/color' import {Theme} from './themes/theme' +import {timestampHoveredAtom} from '../app-state' +import {getPosition} from '../lib/utils' interface FlamechartMinimapViewProps { theme: Theme @@ -21,6 +23,8 @@ interface FlamechartMinimapViewProps { transformViewport: (transform: AffineTransform) => void setConfigSpaceViewportRect: (rect: Rect) => void + + enableTimestampPointer: boolean } enum DraggingMode { @@ -159,6 +163,16 @@ export class FlamechartMinimapView extends Component physicalSpacePos || physicalViewSize.x < physicalSpacePos) { return } + + ctx.fillStyle = theme.fgSecondaryColor + ctx.fillRect(physicalSpacePos, physicalViewSpaceFrameHeight, Sizes.TIMESTAMP_INDICATOR_WIDTH, physicalViewSize.y) } onWindowResize = () => { diff --git a/src/views/flamechart-pan-zoom-view.tsx b/src/views/flamechart-pan-zoom-view.tsx index 7777a4b8d..97a9bcfb7 100644 --- a/src/views/flamechart-pan-zoom-view.tsx +++ b/src/views/flamechart-pan-zoom-view.tsx @@ -9,6 +9,7 @@ import { ELLIPSIS, trimTextMid, remapRangesToTrimmedText, + cachedTextHeight, } from '../lib/text-utils' import {getFlamechartStyle} from './flamechart-style' import {h, Component} from 'preact' @@ -17,6 +18,8 @@ import {ProfileSearchResults} from '../lib/profile-search' import {BatchCanvasTextRenderer, BatchCanvasRectRenderer} from '../lib/canvas-2d-batch-renderers' import {Color} from '../lib/color' import {Theme} from './themes/theme' +import {timestampHoveredAtom} from '../app-state' +import {getPosition, HoveredPoint} from '../lib/utils' interface FlamechartFrameLabel { configSpaceBounds: Rect @@ -60,6 +63,8 @@ export interface FlamechartPanZoomViewProps { setLogicalSpaceViewportSize: (size: Vec2) => void searchResults: ProfileSearchResults | null + + enableTimestampPointer: boolean } export class FlamechartPanZoomView extends Component { @@ -422,6 +427,28 @@ export class FlamechartPanZoomView extends Component physicalSpacePos || physicalViewSize.x < physicalSpacePos) { return } + const labelText = this.props.flamechart.formatValue(configSpacePos) + const labelWidth = ctx.measureText(labelText).width + + ctx.fillStyle = theme.fgPrimaryColor + ctx.fillText( + labelText, + // draw text on the right side of the indicator, if there is a space for it, otherwise draw on the left side + (physicalSpacePos + 2 * labelPaddingPx + labelWidth < physicalViewSize.x) + ? physicalSpacePos + labelPaddingPx + : physicalSpacePos - labelWidth - labelPaddingPx, + physicalViewSize.y - labelPaddingPx + - cachedTextHeight(ctx, labelText) - (this.props.selectedNode ? Sizes.DETAIL_VIEW_HEIGHT * window.devicePixelRatio : 0) + ) + ctx.fillStyle = theme.fgSecondaryColor + ctx.fillRect(physicalSpacePos, 0, Sizes.TIMESTAMP_INDICATOR_WIDTH, physicalViewSize.y) } private updateConfigSpaceViewport() { @@ -584,7 +611,7 @@ export class FlamechartPanZoomView extends Component { + if (!this.props.enableTimestampPointer) return + // Unsubscribe, set and subscribe to avoid rerendering canvas multiple time + timestampHoveredAtom.unsubscribe(this.renderCanvas) + timestampHoveredAtom.set(state) + timestampHoveredAtom.subscribe(this.renderCanvas) + } + private onMouseMove = (ev: MouseEvent) => { this.updateCursor() - if (this.lastDragPos) { - ev.preventDefault() - this.onMouseDrag(ev) - return - } const logicalViewSpaceMouse = new Vec2(ev.offsetX, ev.offsetY) const physicalViewSpaceMouse = this.logicalToPhysicalViewSpace().transformPosition(logicalViewSpaceMouse) const configSpaceMouse = this.configSpaceToPhysicalViewSpace().inverseTransformPosition(physicalViewSpaceMouse) + if (configSpaceMouse) { + // Set hovered point (convert timestamp to ms and set y position to 50%) + this.setTimestampHoveredAtom({x: configSpaceMouse.x / 1000, yProc: 0.5}) + } + + if (this.lastDragPos) { + ev.preventDefault() + this.onMouseDrag(ev) + return + } if (!configSpaceMouse) return @@ -687,6 +727,7 @@ export class FlamechartPanZoomView extends Component { this.hoveredLabel = null + this.setTimestampHoveredAtom(null) this.props.onNodeHover(null) this.renderCanvas() } @@ -796,6 +837,10 @@ export class FlamechartPanZoomView extends Component void @@ -63,6 +64,7 @@ export type FlamechartViewProps = { flamechartRenderer: FlamechartRenderer renderInverted: boolean getCSSColorForFrame: (frame: Frame) => string + enableTimestampPointer: boolean } & FlamechartSetters & FlamechartViewState @@ -113,6 +115,7 @@ export interface FlamechartViewContainerProps { export const ChronoFlamechartView = memo((props: FlamechartViewContainerProps) => { const {activeProfileState, glCanvas} = props const {profile, chronoViewState} = activeProfileState + const metadataOnlySt = useAtom(metadataOnlyProfileAtom); const theme = useTheme() @@ -144,6 +147,7 @@ export const ChronoFlamechartView = memo((props: FlamechartViewContainerProps) = flamechartRenderer={flamechartRenderer} canvasContext={canvasContext} getCSSColorForFrame={getCSSColorForFrame} + enableTimestampPointer={!metadataOnlySt} {...chronoViewState} {...setters} /> @@ -208,6 +212,7 @@ export const LeftHeavyFlamechartView = memo((ownProps: FlamechartViewContainerPr flamechartRenderer={flamechartRenderer} canvasContext={canvasContext} getCSSColorForFrame={getCSSColorForFrame} + enableTimestampPointer={false} {...leftHeavyViewState} {...setters} /> diff --git a/src/views/flamechart-view.tsx b/src/views/flamechart-view.tsx index 0ae78547d..f4a3e15a0 100644 --- a/src/views/flamechart-view.tsx +++ b/src/views/flamechart-view.tsx @@ -30,6 +30,8 @@ export class FlamechartView extends StatelessComponent { } private setConfigSpaceViewportRect = (viewportRect: Rect): void => { + if (this.props.configSpaceViewportRect.approxEquals(viewportRect)) {return;} + const configSpaceDetailViewHeight = Sizes.DETAIL_VIEW_HEIGHT / Sizes.FRAME_HEIGHT const configSpaceSize = this.configSpaceSize() @@ -46,7 +48,9 @@ export class FlamechartView extends StatelessComponent { ), ) - this.props.setConfigSpaceViewportRect(new Rect(origin, viewportRect.size.withX(width))) + const newConfigSpace = new Rect(origin, viewportRect.size.withX(width)) + if (this.props.configSpaceViewportRect.approxEquals(newConfigSpace)) {return;} + this.props.setConfigSpaceViewportRect(newConfigSpace) } private setLogicalSpaceViewportSize = (logicalSpaceViewportSize: Vec2): void => { @@ -117,6 +121,7 @@ export class FlamechartView extends StatelessComponent { flamechartRenderer={this.props.flamechartRenderer} canvasContext={this.props.canvasContext} setConfigSpaceViewportRect={this.setConfigSpaceViewportRect} + enableTimestampPointer={this.props.enableTimestampPointer} /> {searchResults => ( @@ -136,6 +141,7 @@ export class FlamechartView extends StatelessComponent { logicalSpaceViewportSize={this.props.logicalSpaceViewportSize} setLogicalSpaceViewportSize={this.setLogicalSpaceViewportSize} searchResults={searchResults} + enableTimestampPointer={this.props.enableTimestampPointer} /> diff --git a/src/views/flamechart-wrapper.tsx b/src/views/flamechart-wrapper.tsx index 409358e30..6d9fa7273 100644 --- a/src/views/flamechart-wrapper.tsx +++ b/src/views/flamechart-wrapper.tsx @@ -90,6 +90,7 @@ export class FlamechartWrapper extends StatelessComponent { logicalSpaceViewportSize={this.props.logicalSpaceViewportSize} setLogicalSpaceViewportSize={this.setLogicalSpaceViewportSize} searchResults={null} + enableTimestampPointer={false} /> {this.renderTooltip()}
diff --git a/src/views/profile-table-view.tsx b/src/views/profile-table-view.tsx index 9a429dcc7..0b7624012 100644 --- a/src/views/profile-table-view.tsx +++ b/src/views/profile-table-view.tsx @@ -392,6 +392,7 @@ const getStyle = withTheme(theme => whiteSpace: 'nowrap', width: '100%', maxWidth: 0, + textAlign: 'start', }, hBarDisplay: { position: 'absolute', diff --git a/src/views/style.ts b/src/views/style.ts index 62d6902f1..d22bbb924 100644 --- a/src/views/style.ts +++ b/src/views/style.ts @@ -19,6 +19,7 @@ export enum Sizes { FRAME_HEIGHT = 20, TOOLBAR_HEIGHT = 20, TOOLBAR_TAB_HEIGHT = TOOLBAR_HEIGHT - SEPARATOR_HEIGHT, + TIMESTAMP_INDICATOR_WIDTH = 3, } export enum Duration { diff --git a/src/views/themes/theme.tsx b/src/views/themes/theme.tsx index cb8a5cd63..a11e4081b 100644 --- a/src/views/themes/theme.tsx +++ b/src/views/themes/theme.tsx @@ -6,6 +6,7 @@ import {Color} from '../../lib/color' import {memoizeByReference} from '../../lib/utils' import {darkTheme} from './dark-theme' import {lightTheme} from './light-theme' +import {metadataOnlyProfileAtom} from '../../app-state' export interface Theme { fgPrimaryColor: string @@ -94,6 +95,13 @@ export function ThemeProvider(props: {children: ComponentChildren}) { }, [matchMediaListener]) const colorScheme = useAtom(colorSchemeAtom) - const theme = getTheme(colorScheme, systemPrefersDarkMode) + let theme = getTheme(colorScheme, systemPrefersDarkMode) + const transparent = useAtom(metadataOnlyProfileAtom) + if (transparent) { + // Copy the theme and override colors for flamegraph + theme = Object.assign({}, theme) + theme.colorForBucket = () => new Color(0, 0, 0, 0) + theme.colorForBucketGLSL = `vec3 colorForBucket(float t) {return vec3(0, 0, 0);}` + } return } diff --git a/src/views/toolbar.tsx b/src/views/toolbar.tsx index a47372ca4..145d3209d 100644 --- a/src/views/toolbar.tsx +++ b/src/views/toolbar.tsx @@ -8,7 +8,7 @@ import {Profile} from '../lib/profile' import {objectsHaveShallowEquality} from '../lib/utils' import {colorSchemeToString, useTheme, withTheme} from './themes/theme' import {ViewMode} from '../lib/view-mode' -import {viewModeAtom} from '../app-state' +import {toolbarConfigAtom, viewModeAtom} from '../app-state' import {ProfileGroupState} from '../app-state/profile-group' import {colorSchemeAtom} from '../app-state/color-scheme' import {useAtom} from '../lib/atom' @@ -153,12 +153,13 @@ function ToolbarCenterContent(props: ToolbarProps): JSX.Element { ) } } - return {'🔬speedscope'} + return {useAtom(toolbarConfigAtom).title ?? '🔬speedscope'} } function ToolbarRightContent(props: ToolbarProps) { const style = getStyle(useTheme()) const colorScheme = useAtom(colorSchemeAtom) + const toolbarConfig = useAtom(toolbarConfigAtom); const exportFile = (
@@ -194,10 +195,10 @@ function ToolbarRightContent(props: ToolbarProps) { return (
- {props.activeProfileState && exportFile} - {importFile} - {colorSchemeToggle} - {help} + {(toolbarConfig.exportButton ?? true) && props.activeProfileState && exportFile} + {(toolbarConfig.importButton ?? true) && importFile} + {(toolbarConfig.themeButton ?? true) && colorSchemeToggle} + {(toolbarConfig.helpButton ?? true) && help}
) }