Re: [twsocket] Bandwidth counter for MT HTTP Server--what's the fastestway?

2006-10-28 Thread Francois PIETTE
 I know the question seems obvious. One way would be creting a critical
 section protected variable in the server listener thread and add every
 packet sent and check and reset every second, right? But let's
 consider we have 1000 clients downloading. Each second the critical
 section would be acquired and released at least 2000 times! I believe
 it would create a bottlenect just for the sake of drawing a chart of
 bandwidth transferred! What other method would you suggest?

Use InterlockedExchangeAdd API function. It is a hardware assisted API and 
is the fastest possible.
Another solution is to count each client individually and do the sum only 
when needed.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Bandwidth counter for MT HTTP Server--what's the fastestway?

2006-10-28 Thread Fastream Technologies
Here is an idea I have come up with:

Since there are 32 clients/thread, in the client connection thread I
will setup a non-protected variable. Then each of these thread
instances will have a timer that will every 1 sec post the value to
the main thread and then reset the variable. Then in the server
listener thread, we would have to do the same thing once again: add up
the posted values, record every sec and reset. So this would use
ttimers. Would the handle of these timers collide with ICSV6
TWndHandler? And what do you think overall?

Best Regards,

SZ

On 10/28/06, Francois PIETTE [EMAIL PROTECTED] wrote:
  I know the question seems obvious. One way would be creting a critical
  section protected variable in the server listener thread and add every
  packet sent and check and reset every second, right? But let's
  consider we have 1000 clients downloading. Each second the critical
  section would be acquired and released at least 2000 times! I believe
  it would create a bottlenect just for the sake of drawing a chart of
  bandwidth transferred! What other method would you suggest?

 Use InterlockedExchangeAdd API function. It is a hardware assisted API and
 is the fastest possible.
 Another solution is to count each client individually and do the sum only
 when needed.

 --
 Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be


 --
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://www.elists.org/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be



-- 
Fastream Technologies
Software IQ: Innovation  Quality
www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be