Kim already said it and I do agree that this is a most interesting question and I will give my two cents as I perceive the picture.
First point I want you to clear for us: How strict is the requirement of bandwidth measurement? I need to elaborate on how I see this small detail. Measuring true bandwidth usage would involve keeping track of all current transfers of all users in a specified time interval. To have some reasonable update interval the measurement interval will have to be a certain TBD length. Counting the sizes of all transfers in such an interval is not trivial as some transmissions will have started before the start of the measurement interval and some transmissions will end after the measurement interval has already ended.
That means figuring out how much data was actually transfered during that time interval is quite convoluted. Why, I hear you say now, don't I just measure each user in his own time interval, so that all transmissions will start and end in that interval?
The reason is twofold:
- One user can have many parallel data transfers so it might even be possible that a measurement interval would have to extend to the whole session period.
- The second reason is that having a fixed measurement interval for all users will give you better statistics. The total bandwidth measurement for all users can only be given correctly if all user tranfers are measured during one and the same interval.
Second point worth thinking about is how exactly do you define user? Is user in your terminology a client that is using a connection to you server with his windows account? Or is it just the client PC identified by its IP. Then again you could be talking about certain applications that are using your server.
Please change your question to reflect your exact requirements.
Best regards,
-MRB