@gnsx/three 0.185.12 → 0.185.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/three.cjs CHANGED
@@ -59992,6 +59992,7 @@ class TextureUtils {
59992
59992
  * // play for a few seconds
59993
59993
  * __gnsx_profiler.report() // sorted console.table (aggregated stats)
59994
59994
  * __gnsx_profiler.downloadTrace() // download gnsx-trace.json for Speedscope / Perfetto
59995
+ * __gnsx_profiler.downloadTrace('gnsx-trace.json', 0.05) // omit spans < 0.05 ms
59995
59996
  * __gnsx_profiler.reset() // clear samples and trace
59996
59997
  * __gnsx_profiler.disable()
59997
59998
  *
@@ -61198,11 +61199,16 @@ class ProfilerServiceClass {
61198
61199
  }
61199
61200
 
61200
61201
  /**
61202
+ * @param {number} [minDurationMs=0] Omit complete spans shorter than this duration (ms). Capture is unaffected.
61201
61203
  * @return {import('./ProfilerService.js').ChromeTrace}
61202
61204
  */
61203
- exportChromeTrace() {
61205
+ exportChromeTrace( minDurationMs = 0 ) {
61204
61206
 
61205
- const slices = [ ...this.traceEvents ];
61207
+ const thresholdMs = Number.isFinite( minDurationMs ) && minDurationMs > 0 ? minDurationMs : 0;
61208
+ const minDurUs = thresholdMs * 1000;
61209
+ const slices = minDurUs > 0
61210
+ ? this.traceEvents.filter( e => ( e.dur ?? 0 ) >= minDurUs )
61211
+ : [ ...this.traceEvents ];
61206
61212
  slices.sort( ( a, b ) => {
61207
61213
 
61208
61214
  if ( a.ts !== b.ts ) return a.ts - b.ts;
@@ -61280,8 +61286,9 @@ class ProfilerServiceClass {
61280
61286
 
61281
61287
  /**
61282
61288
  * @param {string} [filename='gnsx-trace.json']
61289
+ * @param {number} [minDurationMs=0] Omit complete spans shorter than this duration (ms).
61283
61290
  */
61284
- downloadTrace( filename = 'gnsx-trace.json' ) {
61291
+ downloadTrace( filename = 'gnsx-trace.json', minDurationMs = 0 ) {
61285
61292
 
61286
61293
  if ( typeof document === 'undefined' ) {
61287
61294
 
@@ -61304,7 +61311,10 @@ class ProfilerServiceClass {
61304
61311
 
61305
61312
  }
61306
61313
 
61307
- const json = JSON.stringify( this.exportChromeTrace() );
61314
+ const thresholdMs = Number.isFinite( minDurationMs ) && minDurationMs > 0 ? minDurationMs : 0;
61315
+ const trace = this.exportChromeTrace( thresholdMs );
61316
+ const eventCount = trace.traceEvents.filter( e => e.ph === 'X' ).length;
61317
+ const json = JSON.stringify( trace );
61308
61318
  const blob = new Blob( [ json ], { type: 'application/json' } );
61309
61319
  const url = URL.createObjectURL( blob );
61310
61320
  const a = document.createElement( 'a' );
@@ -61312,7 +61322,10 @@ class ProfilerServiceClass {
61312
61322
  a.download = filename;
61313
61323
  a.click();
61314
61324
  URL.revokeObjectURL( url );
61315
- console.log( `[ProfilerService] Trace downloaded: ${filename} (${this.traceEvents.length} events)` );
61325
+ const thresholdNote = thresholdMs > 0
61326
+ ? ` (filtered ${this.traceEvents.length - eventCount} spans < ${thresholdMs} ms)`
61327
+ : '';
61328
+ console.log( `[ProfilerService] Trace downloaded: ${filename} (${eventCount} events${thresholdNote})` );
61316
61329
 
61317
61330
  }
61318
61331
 
@@ -60012,6 +60012,7 @@ class TextureUtils {
60012
60012
  * // play for a few seconds
60013
60013
  * __gnsx_profiler.report() // sorted console.table (aggregated stats)
60014
60014
  * __gnsx_profiler.downloadTrace() // download gnsx-trace.json for Speedscope / Perfetto
60015
+ * __gnsx_profiler.downloadTrace('gnsx-trace.json', 0.05) // omit spans < 0.05 ms
60015
60016
  * __gnsx_profiler.reset() // clear samples and trace
60016
60017
  * __gnsx_profiler.disable()
60017
60018
  *
@@ -61218,11 +61219,16 @@ class ProfilerServiceClass {
61218
61219
  }
61219
61220
 
61220
61221
  /**
61222
+ * @param {number} [minDurationMs=0] Omit complete spans shorter than this duration (ms). Capture is unaffected.
61221
61223
  * @return {import('./ProfilerService.js').ChromeTrace}
61222
61224
  */
61223
- exportChromeTrace() {
61225
+ exportChromeTrace( minDurationMs = 0 ) {
61224
61226
 
61225
- const slices = [ ...this.traceEvents ];
61227
+ const thresholdMs = Number.isFinite( minDurationMs ) && minDurationMs > 0 ? minDurationMs : 0;
61228
+ const minDurUs = thresholdMs * 1000;
61229
+ const slices = minDurUs > 0
61230
+ ? this.traceEvents.filter( e => ( e.dur ?? 0 ) >= minDurUs )
61231
+ : [ ...this.traceEvents ];
61226
61232
  slices.sort( ( a, b ) => {
61227
61233
 
61228
61234
  if ( a.ts !== b.ts ) return a.ts - b.ts;
@@ -61300,8 +61306,9 @@ class ProfilerServiceClass {
61300
61306
 
61301
61307
  /**
61302
61308
  * @param {string} [filename='gnsx-trace.json']
61309
+ * @param {number} [minDurationMs=0] Omit complete spans shorter than this duration (ms).
61303
61310
  */
61304
- downloadTrace( filename = 'gnsx-trace.json' ) {
61311
+ downloadTrace( filename = 'gnsx-trace.json', minDurationMs = 0 ) {
61305
61312
 
61306
61313
  if ( typeof document === 'undefined' ) {
61307
61314
 
@@ -61324,7 +61331,10 @@ class ProfilerServiceClass {
61324
61331
 
61325
61332
  }
61326
61333
 
61327
- const json = JSON.stringify( this.exportChromeTrace() );
61334
+ const thresholdMs = Number.isFinite( minDurationMs ) && minDurationMs > 0 ? minDurationMs : 0;
61335
+ const trace = this.exportChromeTrace( thresholdMs );
61336
+ const eventCount = trace.traceEvents.filter( e => e.ph === 'X' ).length;
61337
+ const json = JSON.stringify( trace );
61328
61338
  const blob = new Blob( [ json ], { type: 'application/json' } );
61329
61339
  const url = URL.createObjectURL( blob );
61330
61340
  const a = document.createElement( 'a' );
@@ -61332,7 +61342,10 @@ class ProfilerServiceClass {
61332
61342
  a.download = filename;
61333
61343
  a.click();
61334
61344
  URL.revokeObjectURL( url );
61335
- console.log( `[ProfilerService] Trace downloaded: ${filename} (${this.traceEvents.length} events)` );
61345
+ const thresholdNote = thresholdMs > 0
61346
+ ? ` (filtered ${this.traceEvents.length - eventCount} spans < ${thresholdMs} ms)`
61347
+ : '';
61348
+ console.log( `[ProfilerService] Trace downloaded: ${filename} (${eventCount} events${thresholdNote})` );
61336
61349
 
61337
61350
  }
61338
61351