11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst { 41cb0ef41Sopenharmony_ci ObjectSetPrototypeOf, 51cb0ef41Sopenharmony_ci Symbol, 61cb0ef41Sopenharmony_ci} = primordials; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst { 91cb0ef41Sopenharmony_ci codes: { 101cb0ef41Sopenharmony_ci ERR_ILLEGAL_CONSTRUCTOR, 111cb0ef41Sopenharmony_ci }, 121cb0ef41Sopenharmony_ci} = require('internal/errors'); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciconst { 151cb0ef41Sopenharmony_ci customInspectSymbol: kInspect, 161cb0ef41Sopenharmony_ci} = require('internal/util'); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciconst { inspect } = require('util'); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciconst kName = Symbol('kName'); 211cb0ef41Sopenharmony_ciconst kType = Symbol('kType'); 221cb0ef41Sopenharmony_ciconst kStart = Symbol('kStart'); 231cb0ef41Sopenharmony_ciconst kDuration = Symbol('kDuration'); 241cb0ef41Sopenharmony_ciconst kDetail = Symbol('kDetail'); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_cifunction isPerformanceEntry(obj) { 271cb0ef41Sopenharmony_ci return obj?.[kName] !== undefined; 281cb0ef41Sopenharmony_ci} 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ciclass PerformanceEntry { 311cb0ef41Sopenharmony_ci constructor() { 321cb0ef41Sopenharmony_ci throw new ERR_ILLEGAL_CONSTRUCTOR(); 331cb0ef41Sopenharmony_ci } 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci get name() { return this[kName]; } 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci get entryType() { return this[kType]; } 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci get startTime() { return this[kStart]; } 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci get duration() { return this[kDuration]; } 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci get detail() { return this[kDetail]; } 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci [kInspect](depth, options) { 461cb0ef41Sopenharmony_ci if (depth < 0) return this; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci const opts = { 491cb0ef41Sopenharmony_ci ...options, 501cb0ef41Sopenharmony_ci depth: options.depth == null ? null : options.depth - 1, 511cb0ef41Sopenharmony_ci }; 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci return `${this.constructor.name} ${inspect(this.toJSON(), opts)}`; 541cb0ef41Sopenharmony_ci } 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci toJSON() { 571cb0ef41Sopenharmony_ci return { 581cb0ef41Sopenharmony_ci name: this.name, 591cb0ef41Sopenharmony_ci entryType: this.entryType, 601cb0ef41Sopenharmony_ci startTime: this.startTime, 611cb0ef41Sopenharmony_ci duration: this.duration, 621cb0ef41Sopenharmony_ci detail: this.detail, 631cb0ef41Sopenharmony_ci }; 641cb0ef41Sopenharmony_ci } 651cb0ef41Sopenharmony_ci} 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ciclass InternalPerformanceEntry { 681cb0ef41Sopenharmony_ci constructor(name, type, start, duration, detail) { 691cb0ef41Sopenharmony_ci this[kName] = name; 701cb0ef41Sopenharmony_ci this[kType] = type; 711cb0ef41Sopenharmony_ci this[kStart] = start; 721cb0ef41Sopenharmony_ci this[kDuration] = duration; 731cb0ef41Sopenharmony_ci this[kDetail] = detail; 741cb0ef41Sopenharmony_ci } 751cb0ef41Sopenharmony_ci} 761cb0ef41Sopenharmony_ci 771cb0ef41Sopenharmony_ciInternalPerformanceEntry.prototype.constructor = PerformanceEntry; 781cb0ef41Sopenharmony_ciObjectSetPrototypeOf( 791cb0ef41Sopenharmony_ci InternalPerformanceEntry.prototype, 801cb0ef41Sopenharmony_ci PerformanceEntry.prototype); 811cb0ef41Sopenharmony_ci 821cb0ef41Sopenharmony_cimodule.exports = { 831cb0ef41Sopenharmony_ci InternalPerformanceEntry, 841cb0ef41Sopenharmony_ci PerformanceEntry, 851cb0ef41Sopenharmony_ci isPerformanceEntry, 861cb0ef41Sopenharmony_ci}; 87