From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 396DDBB83 for ; Fri, 7 Jul 2006 01:50:29 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k66NoUHQ014332 for ; Fri, 7 Jul 2006 01:50:30 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA20957 for ; Fri, 7 Jul 2006 01:50:29 +0200 (MET DST) Received: from mz3.forethought.net (mzpi5.forethought.net [216.241.36.14]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k66NoR5s017472 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 7 Jul 2006 01:50:29 +0200 Received: from [216.241.35.41] (helo=[10.0.0.2]) by mz3.forethought.net with esmtp (Exim 4.51) id 1Fydbr-0007PN-PD for caml-list@inria.fr; Thu, 06 Jul 2006 17:50:17 -0600 Message-ID: <44ADA1E9.7070106@gushee.net> Date: Thu, 06 Jul 2006 17:51:05 -0600 From: Matt Gushee User-Agent: Thunderbird 1.5.0.4 (X11/20060615) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] LablGTK app maxes out CPU References: <44AAB3B3.6000807@gushee.net> <20060704191216.GA15888@localhost> <44AAC8EE.1060805@gushee.net> <20060704202117.GB15987@localhost> <44AC4A46.3070105@gushee.net> <20060706165121.GA4165@strontium.pps.jussieu.fr> In-Reply-To: <20060706165121.GA4165@strontium.pps.jussieu.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44ADA1C6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44ADA1C3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lablgtk:01 vouillon:01 strace:01 strace:01 gtk:01 ioctl:01 ioctl:01 util:01 omitted:01 gmain:01 widget:01 continuously:98 0.25:98 wrote:01 caml-list:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Jerome Vouillon wrote: > You should try to run your program with the strace program, which > traces system calls. This will tell you why your program runs > continuously rather than waiting for I/Os. Okay, I've done the strace. I found something that appears to be significant, but I don't really understand it. After the GUI is displayed, there are a number of GTK library calls, and then some searches for various resources--locale files, fonts, icons--and then this: poll([{fd=3, events=POLLIN}], 1, 0) = 0 write(3, "\1\30\r\0\3\0\340\0D\0\0\0\0\0\0\0\251\0\244\1\0\0\1\0"..., 2132) = 2132 ioctl(3, FIONREAD, [1184]) = 0 read(3, "\34\317N\0\3\0\340\0\31\1\0\0\376\331]E\0\330]Ex\202\37"..., 1184) = 1184 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 ioctl(3, FIONREAD, [0]) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 ioctl(3, FIONREAD, [0]) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 write(3, "5\30\4\0&\0\340\0\36\0\340\0\245\0\20\0\230\4\5\0\'\0\340"..., 13780) = 13780 ioctl(3, FIONREAD, [0]) = 0 poll([{fd=3, events=POLLIN}], 1, 0) = 0 ioctl(3, FIONREAD, [0]) = 0 poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN, revents=POLLHUP}], 2, -1) = 1 The last two lines are then repeated around 18000 times (identically each time, as far as I can see), until the 'quit' command is received. This takes place over a span of perhaps 30 seconds of real time. So pretty clearly this is the CPU-eating behavior, but I still can't see what is triggering it. By the way, FD #7 is my FIFO. Well, based on the above, I tried adding a second watch function: let hup_watcher _ = Util.sleep 0.25; true in (* ... unrelated code omitted ... *) ignore (GMain.Io.add_watch ~cond:[`HUP] ~callback:hup_watcher chan) Finally, this produces a change in behavior--but not quite what I need. CPU usage is under control, but now the GUI fails to display completely: the main window appears, with the outine of the TreeView widget it is supposed to have, but the contents are never displayed. -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :