mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mldonkey-users] MLDonkey stable high cpu usage


From: Roland Arendes
Subject: Re: [Mldonkey-users] MLDonkey stable high cpu usage
Date: Wed, 26 Nov 2003 10:22:07 +0100 (CET)
User-agent: SquirrelMail/1.4.2

Hi

> I walked a bit in the mldonkey sources and I found this around line 383 of
> src/utils/net/basicSocket.ml:
>   while true do
>     try
>       let time = update_time () in
> Without knowledge of ocaml (nice lang, im going to learn it) I supposed
> that this loop regulates the socket polling in mldonkey, as everyone can
> see this loop has no delay.
> A momentary solution can be to place a delay in this loop, so I added:

This reduced the cpu usage of one of my test mldonkeys from 15% to 1.9%.
Nice work. I keep looking at the effects, but it seems to have no impact
on sharing-performance.

Should be applied!



--- src/utils/net/basicSocket.ml_orig   2003-11-26 09:58:36.000000000 +0100
+++ src/utils/net/basicSocket.ml        2003-11-26 10:00:06.000000000 +0100
@@ -20,6 +20,7 @@
 open Printf2
 open Options

+external usleep: int -> unit = "usleep" ;;
 let debug = ref false

 (* Try to better display the errors related to connections *)
@@ -380,6 +381,7 @@
 let loop () =
   while true do
     try
+      usleep(50000);
       let time = update_time () in
       exec_tasks !fd_tasks;
       exec_hooks !after_select_hooks;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]