7171
7272 .controls-grid {
7373 display : grid;
74- grid-template-columns : 1fr 220px 200 px ;
74+ grid-template-columns : 1fr 220px ;
7575 gap : 12px ;
7676 }
7777
@@ -257,14 +257,6 @@ <h1>FastTimerService Resources Difference</h1>
257257 < option value ="dealloc "> Dealloc Memory</ option >
258258 </ select >
259259 </ div >
260- < div >
261- < label for ="aggregationSelect "> Aggregation</ label >
262- < select id ="aggregationSelect ">
263- < option value ="max " selected > max</ option >
264- < option value ="min "> min</ option >
265- < option value ="abs-max "> abs(max)</ option >
266- </ select >
267- </ div >
268260 </ div >
269261 </ div >
270262
@@ -370,25 +362,17 @@ <h1>FastTimerService Resources Difference</h1>
370362 { key : "events" , label : "Events" , metricKey : "events" , valueType : "value" , decimals : 0 }
371363 ] ;
372364
373- const AGGREGATION_OPTIONS = [
374- { key : "max" , label : "max" } ,
375- { key : "min" , label : "min" } ,
376- { key : "abs-max" , label : "abs(max)" }
377- ] ;
378-
379365 const state = {
380366 payload : null ,
381367 filter : "" ,
382368 sortKey : "diff-desc" ,
383369 selectedMetricKey : "cpu-frac" ,
384- selectedAggregationKey : "max" ,
385370 expandedModules : new Set ( )
386371 } ;
387372
388373 const el = {
389374 filterInput : document . getElementById ( "filterInput" ) ,
390375 valueSelect : document . getElementById ( "valueSelect" ) ,
391- aggregationSelect : document . getElementById ( "aggregationSelect" ) ,
392376 legendBar : document . getElementById ( "legendBar" ) ,
393377 totalsTitle : document . getElementById ( "totalsTitle" ) ,
394378 totalBody : document . getElementById ( "totalBody" ) ,
@@ -409,58 +393,10 @@ <h1>FastTimerService Resources Difference</h1>
409393 return SELECTABLE_METRICS . find ( ( option ) => option . key === key ) || SELECTABLE_METRICS [ 0 ] ;
410394 }
411395
412- function getAggregationOption ( key ) {
413- return AGGREGATION_OPTIONS . find ( ( option ) => option . key === key ) || AGGREGATION_OPTIONS [ 0 ] ;
414- }
415-
416- function valueFromCandidates ( candidates ) {
417- const values = candidates
418- . map ( ( candidate ) => Number ( candidate ) )
419- . filter ( ( value ) => Number . isFinite ( value ) ) ;
420- if ( ! values . length ) return NaN ;
421-
422- switch ( state . selectedAggregationKey ) {
423- case "min" :
424- return Math . min ( ...values ) ;
425- case "abs-max" : {
426- const absMax = Math . max ( ...values . map ( ( value ) => Math . abs ( value ) ) ) ;
427- return Number . isFinite ( absMax ) ? absMax : NaN ;
428- }
429- case "max" :
430- default :
431- return Math . max ( ...values ) ;
432- }
433- }
434-
435- function metricFieldCandidates ( metric , baseKey ) {
436- if ( ! metric || typeof metric !== "object" ) return [ ] ;
437-
438- const candidates = [ ] ;
439- const direct = metric [ baseKey ] ;
440- if ( Array . isArray ( direct ) ) {
441- candidates . push ( ...direct ) ;
442- } else if ( direct && typeof direct === "object" ) {
443- candidates . push ( direct . max , direct . min , direct . abs_max , direct . absMax ) ;
444- } else {
445- candidates . push ( direct ) ;
446- }
447-
448- candidates . push (
449- metric [ `${ baseKey } _max` ] ,
450- metric [ `${ baseKey } _min` ] ,
451- metric [ `${ baseKey } _abs_max` ] ,
452- metric [ `${ baseKey } _absMax` ]
453- ) ;
454-
455- return candidates ;
456- }
457-
458396 function metricValue ( metric , option , variant ) {
459397 if ( ! metric ) return NaN ;
460- const baseKey = option . valueType === "percent" ? `frac_${ variant } ` : variant ;
461- const aggregated = valueFromCandidates ( metricFieldCandidates ( metric , baseKey ) ) ;
462- if ( ! Number . isNaN ( aggregated ) ) return aggregated ;
463- return Number ( metric [ baseKey ] ) ;
398+ if ( option . valueType === "percent" ) return metric [ `frac_${ variant } ` ] ;
399+ return metric [ variant ] ;
464400 }
465401
466402 function formatMetricValue ( metric , option , variant ) {
@@ -511,13 +447,6 @@ <h1>FastTimerService Resources Difference</h1>
511447 renderModulesTable ( ) ;
512448 }
513449
514- function setSelectedAggregation ( aggregationKey ) {
515- state . selectedAggregationKey = aggregationKey ;
516- el . aggregationSelect . value = aggregationKey ;
517- renderTotals ( ) ;
518- renderModulesTable ( ) ;
519- }
520-
521450 function selectedMetricValue ( module , variant , option ) {
522451 const selectedOption = option || getMetricOption ( state . selectedMetricKey ) ;
523452 return asNumber ( metricValue ( module [ selectedOption . metricKey ] , selectedOption , variant ) ) ;
@@ -599,10 +528,9 @@ <h1>FastTimerService Resources Difference</h1>
599528 const total = state . payload . total ;
600529 const expanded = state . expandedModules . has ( "__total__" ) ;
601530 const selectedOption = getMetricOption ( state . selectedMetricKey ) ;
602- const aggregationOption = getAggregationOption ( state . selectedAggregationKey ) ;
603531 const selectedMetric = total [ selectedOption . metricKey ] ;
604532 el . totalBody . innerHTML = "" ;
605- el . totalsTitle . textContent = `Totals (${ selectedOption . label } , ${ aggregationOption . label } )` ;
533+ el . totalsTitle . textContent = `Totals (${ selectedOption . label } )` ;
606534 const row = document . createElement ( "tr" ) ;
607535 row . innerHTML = `
608536 <td><button class="expand-btn" data-key="__total__">${ expanded ? "▼" : "▶" } </button></td>
@@ -721,9 +649,6 @@ <h1>FastTimerService Resources Difference</h1>
721649 el . valueSelect . addEventListener ( "change" , ( ) => {
722650 setSelectedMetric ( el . valueSelect . value ) ;
723651 } ) ;
724- el . aggregationSelect . addEventListener ( "change" , ( ) => {
725- setSelectedAggregation ( el . aggregationSelect . value ) ;
726- } ) ;
727652 }
728653
729654 function loadFromObject ( data , sourceLabel ) {
0 commit comments