UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

66 lines (65 loc) 1.87 kB
"use strict"; export class PerformanceNode { constructor(_node) { this._node = _node; this._cooks_count = 0; this._total_cook_time = 0; this._total_inputs_time = 0; this._total_params_time = 0; } update_cook_data(performance_data) { this._cooks_count += 1; this._total_cook_time += performance_data.cookTime; this._total_inputs_time += performance_data.inputsTime; this._total_params_time += performance_data.paramsTime; } total_time() { return this._total_cook_time + this._total_inputs_time + this._total_params_time; } total_cook_time() { return this._total_cook_time; } cook_time_per_iteration() { if (this._cooks_count > 0) { return this._total_cook_time / this._cooks_count; } else { return 0; } } total_inputs_time() { return this._total_inputs_time; } inputs_time_per_iteration() { if (this._cooks_count > 0) { return this._total_inputs_time / this._cooks_count; } else { return 0; } } total_params_time2() { return this._total_params_time; } params_time_per_iteration2() { if (this._cooks_count > 0) { return this._total_params_time / this._cooks_count; } else { return 0; } } cooks_count() { return this._cooks_count; } print_object() { return { fullPath: this._node.path(), cooks_count: this.cooks_count(), total_time: this.total_time(), total_cook_time: this.total_cook_time(), cook_time_per_iteration: this.cook_time_per_iteration(), // cook_time_total_with_inputs: this.cook_time_total_with_inputs, // cook_time_total_with_inputs_per_iteration: this.cook_time_total_with_inputs_per_iteration, inputs_time_per_iteration: this.inputs_time_per_iteration(), params_time_per_iteration: this.params_time_per_iteration2() }; } }