Using the same formula, i still only end up with 479GH/s
Duration: 11847
Total difficulty of accepted shares: 1322000.0
Calculated hash rate: Diff * 2^32 / Time = 1322000 * 2^32 / 11847 = 479GH/s
I guess a better one-to-one question would be are the total accepted share reported by cgminer matching what you can see for the entire time period.
If that matches, it takes us up from 95% to 98%, but still a little off.
I'll have another one running to a unique worker for 24hr to get a better sampling of data.
Yep 661 shares in total - all 2000.0 Diff - for the single clientid, matched in the logs.
I've not looked at your code, but I can guess there might be an overestimate due to a number of possibilities:
Firstly, from the old icarus driver that Xiangfu wrote, then I redesigned it quite extensively for timing and minimising I/O, there's the issue of aborting work every time and thus you can't include the end of the hash cycle. Not sure if you've still done that with the BM chips.
But in any case, any aborted work should be estimated down based on the abort time vs full expected hash time.
Secondly, the BM FPGA return shares at a given Difficulty, so counting hashes can only be done assuming Diff*2^32 for each nonce.
I'm not sure where that is, in the chip or in the FPGA, so counting hashes for that in BM miners isn't hashes, but should be that Diff*2^32
Nextly, for AB, the chip clearly DOES NOT do a full hash cycle for all shares.
So really all this ends up with, is saying that the most accurate comparable hash rate between miners is the internal work Diff per nonce that comes back to cgminer, and then to get the current preferred (fake) hash rate, multiply that by 2^32
Lastly, the whole H/s design of all miners is now a complete fallacy.
Chips never did a full hash before anyway, so the hash counting is IMO incorrect.
Bitcoin should move away for H/s and use PD/s (Proof of Work Diff) since the actual number of hashes done is well below the numbers all AB miners report, and as mentioned, no miner since the GPU days ever did a full hash anyway.
But this all, hopefully, may help you find where the difference is
