max duration profiler measure

This commit is contained in:
Jan Prochazka
2022-12-18 16:18:56 +01:00
parent 2e37788471
commit 3bbdc56309
4 changed files with 10 additions and 10 deletions

View File

@@ -214,6 +214,7 @@
tabComponent: 'ProfilerTab', tabComponent: 'ProfilerTab',
props: { props: {
jslid: `archive://${data.folderName}/${data.fileName}`, jslid: `archive://${data.folderName}/${data.fileName}`,
// engine: eng.engine,
profilerFormatterFunction: eng.profilerFormatterFunction, profilerFormatterFunction: eng.profilerFormatterFunction,
profilerTimestampFunction: eng.profilerTimestampFunction, profilerTimestampFunction: eng.profilerTimestampFunction,
profilerChartAggregateFunction: eng.profilerChartAggregateFunction, profilerChartAggregateFunction: eng.profilerChartAggregateFunction,

View File

@@ -70,7 +70,7 @@
let chartData; let chartData;
$: connection = useConnectionInfo({ conid }); $: connection = useConnectionInfo({ conid });
$: engine = findEngineDriver($connection, $extensions); $: driver = findEngineDriver($connection, $extensions);
onMount(() => { onMount(() => {
intervalId = setInterval(() => { intervalId = setInterval(() => {
@@ -123,15 +123,15 @@
isLoadingChart = true; isLoadingChart = true;
const colors = randomcolor({ const colors = randomcolor({
count: (profilerChartMeasures || engine.profilerChartMeasures).length, count: (profilerChartMeasures || driver.profilerChartMeasures).length,
seed: 5, seed: 5,
}); });
const data = await apiCall('jsldata/extract-timeline-chart', { const data = await apiCall('jsldata/extract-timeline-chart', {
jslid, jslid,
timestampFunction: profilerTimestampFunction || engine.profilerTimestampFunction, timestampFunction: profilerTimestampFunction || driver.profilerTimestampFunction,
aggregateFunction: profilerChartAggregateFunction || engine.profilerChartAggregateFunction, aggregateFunction: profilerChartAggregateFunction || driver.profilerChartAggregateFunction,
measures: profilerChartMeasures || engine.profilerChartMeasures, measures: profilerChartMeasures || driver.profilerChartMeasures,
}); });
chartData = { chartData = {
...data, ...data,
@@ -202,7 +202,7 @@
<JslDataGrid <JslDataGrid
{jslid} {jslid}
listenInitializeFile listenInitializeFile
formatterFunction={profilerFormatterFunction || engine?.profilerFormatterFunction} formatterFunction={profilerFormatterFunction || driver?.profilerFormatterFunction}
/> />
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="2"> <svelte:fragment slot="2">

View File

@@ -40,10 +40,7 @@ const driver = {
profilerChartMeasures: [ profilerChartMeasures: [
{ label: 'Req count/s', field: 'countPerSec' }, { label: 'Req count/s', field: 'countPerSec' },
{ label: 'Avg duration', field: 'avgDuration' }, { label: 'Avg duration', field: 'avgDuration' },
{ label: 'Max duration', field: 'maxDuration' },
// { label: 'Req count/s', field: 'countPerSec', perSecond: true },
// { field: 'countAll', hidden: true },
// { label: 'Avg duration', field: 'millis', perField: 'countAll' },
], ],
databaseUrlPlaceholder: 'e.g. mongodb://username:password@mongodb.mydomain.net/dbname', databaseUrlPlaceholder: 'e.g. mongodb://username:password@mongodb.mydomain.net/dbname',

View File

@@ -78,12 +78,14 @@ function aggregateProfileChartEntry(aggr, obj, stepDuration) {
const countAll = (aggr.countAll || 0) + 1; const countAll = (aggr.countAll || 0) + 1;
const sumMillis = (aggr.sumMillis || 0) + obj.millis; const sumMillis = (aggr.sumMillis || 0) + obj.millis;
const maxDuration = obj.millis > (aggr.maxDuration || 0) ? obj.millis : aggr.maxDuration || 0;
return { return {
countAll, countAll,
sumMillis, sumMillis,
countPerSec: (countAll / stepDuration) * 1000, countPerSec: (countAll / stepDuration) * 1000,
avgDuration: sumMillis / countAll, avgDuration: sumMillis / countAll,
maxDuration,
}; };
// return { // return {