Author

Topic: bitcoinj network (low level) statistics (Read 1193 times)

legendary
Activity: 1526
Merit: 1134
September 24, 2013, 10:36:04 AM
#6
Android offers data usage monitoring at the OS level. Most clients just show number of connected peers. But sure, you could show such data if you wanted to.
member
Activity: 66
Merit: 16
bitcoin core contributor
September 24, 2013, 08:18:18 AM
#5
Sounds good. I first need to check the sources to get a plan about it.

I developing a tiny mac app with goals...
... very easy to use (dumb end user capable)
... low mem / cpu footprint
... take at less UI space as possible (status bar).

Simple screenshot of early dev status:


I would like to integrate a bandwidth statistics as well as a small network graph into the app. So user can prove what goes over the network. And this would also be a psychological sign for the user, that the wallet/bitcoin network is alive.
More and more user are also connected over 3G/4G over iPhone/Android tethering and might be concerned about bandwidth usage.

--
legendary
Activity: 1526
Merit: 1134
September 24, 2013, 07:50:40 AM
#4
You can see his changes here:

https://code.google.com/r/hearn-bitcoinj/source/detail?r=63309f5706f1918ef5b5ec29e35d4bc7fb9abeca&name=nonetty

I did a review this morning. It's looking pretty reasonable, but isn't quite mergeable yet. Hopefully soon, once we get some real world testing and address my comments. I'm going to keep it rebased at any rate. So I'd suggest building on top of that branch.

I think the best way to implement it post-nonetty is modifying PeerSocketHandler to record stats in the receiveBytes and sendMessage calls. Then you could make PeerGroup accumulate the statistics.

It looks like it isn't possible to do that in an easily pluggable way because PeerGroup always directly instantiates Peer. We could introduce a PeerFactory type glue point and then API users could customize the Peer objects that are in use, but bandwidth stats might be generally useful for everyone.

What is it you want to do with the data?
member
Activity: 66
Merit: 16
bitcoin core contributor
September 24, 2013, 07:01:32 AM
#3
Thanks.

Is there any plan when matt's changes (own framework) will be implemented?
(to decide where to implement)
legendary
Activity: 1526
Merit: 1134
September 23, 2013, 09:22:42 AM
#2
It's not implemented. Matt Corallo rewrote the networking layer, it's here:

https://code.google.com/r/bluemattme-bitcoinj/source/list?name=nonetty

His changes remove netty and replace it with a home grown framework. I'm slowly working through code review, but you could grab it and try it out to see how it looks. If it seems good then adding stats collection would be a nice improvement. Alternatively, adding hooks in the right place so stats collection can easily be plugged in would be even better.

In the current framework you can attach an onPreMessageReceived handler to get all inbound messages and calculate bytes used from that, but for outbound messages you'd need to modify the code itself.
member
Activity: 66
Merit: 16
bitcoin core contributor
September 23, 2013, 07:08:27 AM
#1
Hi

I'd like to get some low level network statistics for all traffic done by bitcoinj.
Goal should be to count/cumulate total bytes in / bytes out as well as the current traffic bandwidth.

Is there already something implemented?
If not, where could i start implementing a such thing?

Thanks
---
Jump to: