struct[] servervolumes()
Returns download volume statistics per news-server.
This method returns an array of structures with following fields:
NOTE: The first record (serverid=0) are totals for all servers.
Contains an array of structs with following fields:
These slots are arrays of fixed sizes (60, 60 and 24) which contain data for the last 60 seconds, 60 minutes and 24 hours. For example if current time “16:00:21” when the current slots would be:
Element 21 of BytesPerSeconds contains the amount of data downloaded in current second. Element 20 - in the previous second and element 22 - data downloaded 59 seconds ago.
Similarly for minutes (BytesPerMinutes) and hours (BytesPerHours) arrays.
Daily slots are counted from the installation date, more precisely - from the date the program was used the first time after the installation. Or the first time it was used after deleting of statistics data, which is stored in directory pointed by option QueueDir.
Therefore the first element of BytesPerDays array contains the amount of data downloaded at the first day of program usage. The second element - on the second day. The sub-sequential slots are created for each day, regardless of the fact if the program was running on this day or not.
Field DaySlot shows into which day slot the data is currently being written.
To find out the day slot for a specific day:
24*60*60=86400
), take the integral part.For example, if the program was just installed and today is “17 March 2017” the field FirstDay will have value 17242
(timestamp 1489788000 divided by 86400). To find out the slot for “17 March 2017” we take the timestamp for any second of this day (for example 1489788000) and divide it by 86400 and subtract value of FirstDay (17242). We get number “0”, indicating slot 0. For “18 March 2017” the formula gives slot number 1
(which BTW doesn’t exist on 17 March yet).
You need to calculate the slot numbers for the first and the last days of a certain month, year or any other period and then sum the data from all slots belonging to the period. As an example see the source code of web-interface in file status.js
.
As you see this method returns the raw data from the statistics meter and you have to perform calculations to represent the data in a user friendly format such as: downloaded today, yesterday, this or previous week or month etc.