Should it be not done on each block?
Reasonable
So some are 10 xiro and others are 9.5 xiro on block find.
Please explain how that happens with code
The calculation of the current circulating is done on a time scheduled regulary for a simple reason: (Performances).
The process about the block reward and the dev fee is also simple, you can see it on the transaction explorer. You have one transaction for the block reward who provide 9.5 XIRO and another transaction who provide 0.5 XIRO it's very easy to understand.
When you see 10 XIRO in pending, this is just the calculation of 9.5 XIRO (the block reward after the dev fee calculation) + the amount of coin get from the dev fee. And when you see 9.5 in pending, that is mean the dev fee has been take in count just before the calculation of the current circulating.