From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5474 invoked by alias); 16 Mar 2006 23:41:02 -0000 Received: (qmail 5461 invoked by uid 22791); 16 Mar 2006 23:41:01 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Mar 2006 23:41:00 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k2GNewSi032594 for ; Thu, 16 Mar 2006 18:40:58 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k2GNew124397 for ; Thu, 16 Mar 2006 18:40:58 -0500 Received: from localhost.localdomain (vpn50-81.rdu.redhat.com [172.16.50.81]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id k2GNevGx012454 for ; Thu, 16 Mar 2006 18:40:57 -0500 Received: from ironwood.lan (ironwood.lan [192.168.64.8]) by localhost.localdomain (8.12.11/8.12.10) with ESMTP id k2GNhu7U009964 for ; Thu, 16 Mar 2006 16:43:56 -0700 Date: Thu, 16 Mar 2006 23:41:00 -0000 From: Kevin Buettner To: rda@sources.redhat.com Subject: [commit] Change polling granularity from seconds to milliseconds Message-ID: <20060316164056.2a2df15a@ironwood.lan> Organization: Red Hat X-Mailer: Sylpheed-Claws 2.0.0 (GTK+ 2.6.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact rda-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00000.txt.bz2 I've just committed the patch below. It improves RDA's response time when debugging certain types of multithreaded applications. Kevin ChangeLog: * include/gdbloop.h (gdbloop, gdbloop_poll): Revise comments to indicate that timeout granulatiry is now in milliseconds rather than seconds. * lib/gdbloop.c (poll_gdbsocket): Change ``timeout'' granulatiry from seconds to milliseconds. unix/ChangeLog: * server.c (main): Change polling interval for gdbloop_poll() from one second to ten milliseconds. win32/ChangeLog: * server.c (main): Revise comment to indicate that polling granularity is milliseconds. Index: include/gdbloop.h =================================================================== RCS file: /cvs/src/src/rda/include/gdbloop.h,v retrieving revision 1.1 diff -u -p -r1.1 gdbloop.h --- include/gdbloop.h 28 Aug 2002 01:22:27 -0000 1.1 +++ include/gdbloop.h 16 Mar 2006 22:52:30 -0000 @@ -34,13 +34,17 @@ extern "C" { /* Really simple minded event-loop. Assumes that the target is using both gdbsocket* and gdbsched* to implement things. If TIMEOUT is - negative, block infinitely. If TIMEOUT is zero, don't block. */ + negative, block infinitely. If TIMEOUT is zero, don't block. + Otherwise, a positive timeout represents the time in milliseconds + to wait. */ void gdbloop (long current_time, int timeout); -/* Even more simple minded event-loop. Assumes that everything is in - units of one second. Calls gdbloop() above, using time() for - CURRENT_TIME. */ +/* An even more simple minded event-loop. Calls gdbloop() + above, using time() for CURRENT_TIME. TIMEOUT is as above + in which a negative TIMEOUT will block indefinitely, a zero + timeout won't block at all, and a positive TIMEOUT will + block for (at most) the specified number of milliseconds. */ void gdbloop_poll (int timeout); Index: lib/gdbloop.c =================================================================== RCS file: /cvs/src/src/rda/lib/gdbloop.c,v retrieving revision 1.1 diff -u -p -r1.1 gdbloop.c --- lib/gdbloop.c 28 Aug 2002 01:22:28 -0000 1.1 +++ lib/gdbloop.c 16 Mar 2006 22:52:30 -0000 @@ -86,7 +86,7 @@ fds_isset (int fd, void *context, enum g } static void -poll_gdbsocket (long timeout) +poll_gdbsocket (long timeout /* in milliseconds */) { int s; struct fds fds; @@ -103,8 +103,8 @@ poll_gdbsocket (long timeout) if (timeout >= 0) { struct timeval timeval; - timeval.tv_sec = timeout; - timeval.tv_usec = 0; + timeval.tv_sec = timeout / 1000; + timeval.tv_usec = (timeout % 1000) * 1000; s = select (fds.nr, &fds.read, &fds.write, NULL, &timeval); } else Index: unix/server.c =================================================================== RCS file: /cvs/src/src/rda/unix/server.c,v retrieving revision 1.10 diff -u -p -r1.10 server.c --- unix/server.c 10 Mar 2005 23:50:47 -0000 1.10 +++ unix/server.c 16 Mar 2006 22:52:30 -0000 @@ -413,7 +413,7 @@ main (int argc, char **argv) /* Poll for socket traffic. */ while (! server_quit_p) { - gdbloop_poll (1 /* second */); + gdbloop_poll (10 /* milliseconds */); if (! server_quit_p) { if (gdbserver.check_child_state (process)) Index: win32/server.cc =================================================================== RCS file: /cvs/src/src/rda/win32/server.cc,v retrieving revision 1.1 diff -u -p -r1.1 server.cc --- win32/server.cc 28 Aug 2002 01:22:29 -0000 1.1 +++ win32/server.cc 16 Mar 2006 22:52:30 -0000 @@ -120,7 +120,7 @@ main (int argc, char **argv) /* Poll for socket traffic. */ while (! process->quit_server ()) { - gdbloop_poll (0 /* second */); + gdbloop_poll (0 /* milliseconds */); if (process->check_state ()) { switch (process->status ())