BitMeter 2 History File Format
This is a brief explanation of the format of the BitmeterHistory.xml file, for anyone that is interested in manually editing it or writing some kind of tool to manipulate it. The file can be edited in any standard text editor, although using one with some kind of XML capability will make your work easier.
Bitmeter holds its historical data in 8 'buffers', each buffer is in
effect an array of integer values with each value representing the
number of bytes uploaded/downloaded in a certain time period. Each
buffer value is held in its own XML element, as follows:
|dlSecondBuffer||Bytes downloaded for the last 1000 seconds|
|ulSecondBuffer||Bytes uploaded for the last 1000 seconds|
|dlMinuteBuffer||Bytes downloaded for the last 300 minutes|
|ulMinuteBuffer||Bytes uploaded for the last 300 minutes|
|dlHourBuffer||Bytes downloaded for the last 300 hours|
|ulHourBuffer||Bytes uploaded for the last 300 hours|
|dlDayBuffer||Bytes downloaded for the last 1000 days|
|ulDayBuffer||Bytes uploaded for the last 1000 days|
To clarify how the values get stored in the buffer, have a look at this example:
<dlSecondBuffer> <buffer> <long>0</long> <long>352</long> <long>476</long> <long>412</long> <long>532</long> <-- C <long>578</long> <-- B <long>0</long> <-- A <long>0</long> ... </buffer> <bufferSize>1000</bufferSize> <bufferPointer>6</bufferPointer> ... </dlSecondBuffer>
The values inside the <long> elements are the buffer's values, in this case since it's the 'dlSecondBuffer' each of these values represents the number of bytes downloaded in 1 second. Initially all these values are set to '0', Bitmeter starts writing values from the top of the buffer and works its way down, when it gets to the end of a buffer it starts again at the beginning overwriting the old values one-by-one. How do we know which second each of these values corresponds to? Well we need to look at the <bufferPointer> value at the bottom of the example - this gives us the position of the NEXT buffer location that will be used (the value labelled 'A' above), working up the buffer from the NEXT location we move back 1 second with each value, so if the current time is 12:00:00 then the 'B' value is the number of bytes downloaded between 11:59:59 and 12:00:00, the value at 'C' is the number of bytes downloaded between 11:59:58 and 11:59:59 and so on.
To check the time that each of the buffers was last updated look at the very top of the BitmeterHistory.xml file for these entries:
<thisSecond>2009-04-22T12:47:47.0001168+01:00</thisSecond> <thisMinute>2009-04-22T12:47:00.0001168+01:00</thisMinute> <thisHour>2009-04-22T12:00:00.0001168+01:00</thisHour> <thisDay>2009-04-22T00:00:00.0001168+01:00</thisDay>
These values show when the interval covered by the next buffer value begins, so for example the hour value above is '2009-04-22T12:00:00.0001168+01:00' which means that the buffer value pointed to the the <bufferPointer> value in the <dlHourBuffer> and <ulHourBuffer> buffers covers the interval from 12:00 to 13:00 on 2009-04-22.