rejetto forum

FR: average speed

0 Members and 1 Guest are viewing this topic.

Offline danny

  • Tireless poster
  • ****
    • Posts: 192
    • View Profile
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. 


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
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.
« Last Edit: June 27, 2020, 09:57:48 AM by rejetto »


Offline danny

  • Tireless poster
  • ****
    • Posts: 192
    • View Profile
So, actually, top speed was needed--same as shown in the ui, on the graph, upper-right corner of the screen.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
well, that 'top' is not currently offered, apparently.
I can add it to the bunch.
Nonetheless one could make its own, with events.
« Last Edit: June 27, 2020, 01:00:59 PM by rejetto »