Closed varenius closed 4 years ago
That tstat?
internal state is kept per runtime
environment and the intent of the code is that that be cleared if a new transfer is started in that runtime (modulo bugs where that doesn't happen). The tstat?
query pays no attention to who is querying - e.g. if multiple users call tstat?
at random, the readings each will get depend critically on the order in which jive5ab
processes the queries.
In the case of twice we're initialised
it could be that the tstat?
state was empty at the first call (e.g. first transfer started since program startup), causing that call to initialize it. If the transfer starting, due to multithread execution, clears the state after that call, then the 2nd call to tstat?
again finds an empty state, initializes it, and informs you about that.
For your purpose, you might look at the tstat=
command in stead. That version does not rely on state inside jive5ab
to return relative values; it always returns the current values of the unix time stamp and defined byte counters. This allows client code to do the state analysis ("what is jive5ab
doing right now") and a differentiation of time/byte counters to estimate the current data rate.
I see. Now I understand that part of the documentation, thanks!
Forgive my stupidity here, but trying to do the monitor-calculation using tstat= (as suggested in the documentation) it seems I am still missing something. To compare, I run both tstat= and tstat? as
202028616:46:12 2020-10-12 14:46:12.94: Processing command 'tstat='
202028616:46:12 2020-10-12 14:46:12.94: Reply: !tstat= 0 : 1602513972.941 : vbsrecord : UdpsNorRead : 1031700096 : FIFOLength : 0;
202028616:46:12 2020-10-12 14:46:12.94: Processing command 'tstat?'
202028616:46:12 2020-10-12 14:46:12.94: Reply: !tstat? 0 : 79.48s : vbsrecord : UdpsNorRead -207.628Mbps : F 0.0% ;
202028616:46:14 2020-10-12 14:46:14.94: Processing command 'tstat='
202028616:46:14 2020-10-12 14:46:14.94: Reply: !tstat= 0 : 1602513974.945 : vbsrecord : UdpsNorRead : 3094375872 : FIFOLength : 0;
202028616:46:14 2020-10-12 14:46:14.94: Processing command 'tstat?'
202028616:46:14 2020-10-12 14:46:14.94: Reply: !tstat? 0 : 2.00s : vbsrecord : UdpsNorRead 8.23161Gbps : F 0.0% ;
The "tstat?" result is 8.2Gbps, as it should be. But trying to use tstat= I put the numbers together as
bytediff = 3094375872-1031700096
timediff = 1602513974.945-1602513972.941
rate = 8*bytediff / (timediff * 1024**3) = 7.67 Gbps
I would expect these numbers to agree, i.e. 8 Gbps both ways. Any idea what I am missing? (It is monday afternoon after all...)
>>> bytediff = 3094375872-1031700096
>>> timediff = 1602513974.945-1602513972.941
>>> rate = 8*bytediff / timediff
>>> rate
8234234846.332349
>>> rate / 1000**3
8.234234846332349
>>>
It would seem that the Gbps
should really be Gibps
; jive5ab may actually predate the common use of "gibibytes and bits" vs "gigabytes and bits". The use of Gbps
is misleading here. You could submit an issue report to have this fixed ... ;-)
Aha!
Allright - might as well :). I have now created #7 so I'm closing this ticket.
I usually record 30 seconds of test-data before an experiment to verify that everything works. I have a script, initially developed by Simon Casey I think (with some changes by me) which sends the record=on, off commands and checks that the data rate is correct. The script uses the "tstat?" command for jive5ab to get the data rate. Sometimes this fails. This seems to be when after a tstat? question jive5ab answers "Reply: !tstat? 1 : Retry - we're initialized now : vbsrecord ;" instead of e.g. "Reply: !tstat? 0 : 1.00s : vbsrecord : UdpsNorRead 8.23231Gbps : F 0.0% ;". I haven't been able to understand when the "we're initialized now" reply occurs.
First I thought it was the first time after starting up jive5ab, but that's not true - I have got the reply twice in a row. Then I thought I must send it once to initialise, then wait some time (1 sec) and then send it again. But even so, I still get "we're initialised now" twice sometimes. Example log segment:
In contrast, here is a log segments taken a bit later where the "tstat?" commands ro return some numbers:
I have read the jiveab documentation, and the "we're initialised" is not mentioned there. Am I missing something here, or is the tstat behaviour unpredictable (although perhaps by design)? It would be good to know what is required to ensure tstat will return the UdpsNorRead rate. I am perfectly happy to run some commands, run them a number of times, wait some specific time etc. I just need to ensure how I get a valid number from tstat, so that my test-script won't fail.