rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: danny on June 24, 2020, 12:54:38 PM

Title: FR: average speed
Post by: danny on June 24, 2020, 12:54:38 PM
Feature request:    I would like to access averaged peak speed data via macro. 
Like that ui graph with speed peak. . . average of peaks, if made available by macro, would be so very useful in determining workload/capacity. 
That is the missing piece of data for making pages adaptive to capacity. 
Title: Re: FR: average speed
Post by: rejetto on June 27, 2020, 09:43:04 AM
Feature request:    I would like to access averaged peak speed data via macro. 
Like that ui graph with speed peak. . . average of peaks, if made available by macro, would be so very useful in determining workload/capacity. 
That is the missing piece of data for making pages adaptive to capacity. 

you are not satisfied with just reading %speed-out% ?
maybe you want to make an average over 5 or 10 seconds?
you can make your own calculations by using events. Something like

[every 1 second]
do my calculation based on %speed-out% and store the result in a #global variable


then in your tpl you can just use that variable
It's not super-easy but it can be done.
if you want to average over 5 seconds you may do something like

{.set|#speedIdx|{.calc|({.^speedIdx.}+1)%5.}.}
{.set|#speedArray{.^#speedIdx.}|%speed-out%.}
{.for|i|0|4|{:{.inc|speedSum|0{.^#speedArray{.^i.}.}.}:}.}
{.set|#speedAverage|{.div|{.^speedSum.}|5.}.}

Did not test it any it may be full of bugs.
Commenting the lines
1. calculate where we are now (index)
2. store at that index the current speed
3 and 4. caculate the average of all the recorded speeds. The extra 0 for 'inc' is to avoid having an empty string when the array is empty, causing inc to default to 1 instead of zero.
Title: Re: FR: average speed
Post by: danny on June 27, 2020, 12:01:26 PM
So, actually, top speed was needed--same as shown in the ui, on the graph, upper-right corner of the screen.
Title: Re: FR: average speed
Post by: rejetto on June 27, 2020, 12:56:22 PM
well, that 'top' is not currently offered, apparently.
I can add it to the bunch.
Nonetheless one could make its own, with events.