[distcc] Patch?

Eddie Parker eddie at replicon.com
Mon Feb 14 15:11:22 GMT 2005


Hello!

Here's a patch for what I've worked on. Just to reiterate this patch does
the following to distccmon-text:

    1) Add a timestamp to every line from the distccmon-text output
 
    2) Only print the newline after a series of distcc calls have been
displayed

And here's the patch. Any chance this could make it into the official tree?
(I tried submitting using tla, but apparently I don't have access. :) )

-----

* looking for mbp at sourcefrog.net--2004/distcc--devel--2--patch-162 to
compare with
* comparing to mbp at sourcefrog.net--2004/distcc--devel--2--patch-162
M  src/mon-text.c

* modified files

--- orig/src/mon-text.c
+++ mod/src/mon-text.c
@@ -36,7 +36,7 @@
 #include "exitcode.h"
 #include "snprintf.h"
 #include "mon.h"
-
+#include "time.h"
 
 /**
  * @file
@@ -85,25 +85,38 @@
      * other program, so make sure we're always line buffered. */
     setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
 
+    char currentTimeAsString[9];
+
     do {
         struct dcc_task_state *i;
         
         if ((ret = dcc_mon_poll(&list)))
             return ret;
 
+        unsigned int havePrinted = 0;
+
         for (i = list; i; i = i->next) {
-#if 1
+
+            havePrinted = 1;
+
             if (i->curr_phase == DCC_PHASE_DONE)
                 continue;
-#endif
+
+            time_t currentTime;
+            time(&currentTime);
+
+            strftime(currentTimeAsString, 9, "%H:%M:%S",
localtime(&currentTime));
+
             /* Assume 80 cols = */
-            printf("%6ld  %-10.10s  %-30.30s %24.24s[%d]\n",
+            printf("[%8s] %6ld  %-10.10s  %-30.30s %24.24s[%d]\n",
+                    currentTimeAsString,
                    (long) i->cpid,
                    dcc_get_phase_name(i->curr_phase),
                    i->file, i->host, i->slot);
         }
 
-        printf("\n");
+        if(havePrinted)
+            printf("\n");
 
         /* XXX: usleep() is probably not very portable */
         usleep(delay * 1000000);




-----Original Message-----
From: Martin Pool [mailto:mbp at sourcefrog.net] 
Sent: Friday, February 11, 2005 3:02 PM
To: Eddie Parker
Cc: distcc at lists.samba.org
Subject: Re: [distcc] Patch?

On 11 Feb 2005, Eddie Parker <eddie at replicon.com> wrote:
>    Hello!
> 
>     
> 
>    I love distcc, but the default output from the distccmon-text kinda
drives
>    me nuts.
> 
>     
> 
>    I am ready and willing to submit a patch to fix this, but I thought it
>    would be best to ask first if it's OK to do such a thing. J
> 
>    Basically what I want to do is this:
> 
>     
> 
>    1)       Add a timestamp to every line from the distccmon-text output
> 
>    2)       Only print the newline if distccmon-text has encountered a
call
>    to itself.
> 
>    Would this be OK? I find it to be very useful. J

Of course it's OK.  Perhaps there should be a curses monitor instead...

--
Martin




More information about the distcc mailing list