public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: rda@sources.redhat.com
Subject: [commit] Change polling granularity from seconds to milliseconds
Date: Thu, 16 Mar 2006 23:41:00 -0000	[thread overview]
Message-ID: <20060316164056.2a2df15a@ironwood.lan> (raw)

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 ())

                 reply	other threads:[~2006-03-16 23:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060316164056.2a2df15a@ironwood.lan \
    --to=kevinb@redhat.com \
    --cc=rda@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).