🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #12219

Innd patch for logwatchers

#12219
From: Per Hedeland
Date: Sun, 10 Nov 1996 00:00
68 lines
3158 bytes
If you've never looked at the "news" log file to see how fast the
articles are *really* arriving, this patch is not for you. I've done
that on occasion though, and found that with streaming inbound feeds,
the timestamps get rather silly - a dozen or so articles arriving at the
same millisecond, and then seconds before the next bunch arrives, at
another millisecond.

What the patch (relative to 1.4unoff4) does is waste some number of CPU
microseconds per article to get a more "realistic" timestamp - perhaps
someone else finds it useful...:-)

--Per Hedeland
per@erix.ericsson.se

*** innd/art.c.ORIG	Mon Mar  4 17:21:48 1996
--- innd/art.c	Thu Sep 12 10:09:59 1996
***************
*** 1031,1049 ****
  {
      int			i;
      BOOL		Done;
  
      /* We could be a bit faster by not dividing Now.usec by 1000,
       * but who really wants to log at the Microsec level? */
      Done = code == ART_ACCEPT || code == ART_JUNK;
      if (text)
  	i = fprintf(Log, "%.15s.%03.3d %c %s %s %s%s",
! 		ctime(&Now.time) + 4, (int)(Now.usec / 1000),
  		code, Data->Feedsite,
  		Data->MessageID == NULL ? "(null)" : Data->MessageID,
  		text, Done ? "" : "\n");
      else
  	i = fprintf(Log, "%.15s.%03.3d %c %s %s%s",
! 		ctime(&Now.time) + 4, (int)(Now.usec / 1000),
  		code, Data->Feedsite,
  		Data->MessageID == NULL ? "(null)" : Data->MessageID,
  		Done ? "" : "\n");
--- 1031,1057 ----
  {
      int			i;
      BOOL		Done;
+     TIMEINFO		ReallyNow;
  
      /* We could be a bit faster by not dividing Now.usec by 1000,
       * but who really wants to log at the Microsec level? */
+     /* Indeed, however streaming makes even the millisecs pointless
+        as Now is updated too seldom - let's give that expensive CPU
+        something to do while it is waiting for disk I/O. Of course
+        this means that the time logged is when the article was written
+        to disk rather than when it arrived on the NNTP port.:-) */
+     if (GetTimeInfo(&ReallyNow) < 0)
+ 	syslog(L_ERROR, "%s cant gettimeinfo %m", LogName);
      Done = code == ART_ACCEPT || code == ART_JUNK;
      if (text)
  	i = fprintf(Log, "%.15s.%03.3d %c %s %s %s%s",
! 		ctime(&ReallyNow.time) + 4, (int)(ReallyNow.usec / 1000),
  		code, Data->Feedsite,
  		Data->MessageID == NULL ? "(null)" : Data->MessageID,
  		text, Done ? "" : "\n");
      else
  	i = fprintf(Log, "%.15s.%03.3d %c %s %s%s",
! 		ctime(&ReallyNow.time) + 4, (int)(ReallyNow.usec / 1000),
  		code, Data->Feedsite,
  		Data->MessageID == NULL ? "(null)" : Data->MessageID,
  		Done ? "" : "\n");

Technical Details
Message-ID: <565g6h$qp1@news.du.etx.ericsson.se>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <565g6h$qp1@news.du.etx.ericsson.se>
Subject: Innd patch for logwatchers
Date: Sun, 10 Nov 1996 00:00:00 +0000
From: per@erix.ericsson.se (Per Hedeland)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 195689145
Organization: Ericsson Telecom, Stockholm, Sweden
Nntp-posting-user: per
Newsgroups: news.software.nntp