GNU bug report logs - #18607
24.3.93; Warn user if finding fqdn is too slow

Previous Next

Package: emacs;

Reported by: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>

Date: Thu, 2 Oct 2014 13:11:01 UTC

Severity: wishlist

Merged with 18142

Found in version 24.3.93

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: 18607 <at> debbugs.gnu.org
Subject: bug#18607: 24.3.93; Warn user if finding fqdn is too slow
Date: Thu, 02 Oct 2014 15:08:28 +0200
Severity: wishlist

Context :

Sometimes we encounter the known problem "Emacs startup on GNU/Linux
systems [...] is slow." (see e.g. #1492, #9291) and the only visible
effect is that emacs is slow.

The fact that emacs being slow at startup is sometimes considered normal
means that the above problem might be overlooked. (That's exactly what
happened to me the last few weeks, I'm happily generalizing this to
everyone.)

Hence I suggest to warn the user about the situation.

As I know absolutely nothing about C, I googled and came up with the,
possibly horrid, patch below.

diff --git a/src/ChangeLog b/src/ChangeLog
index 00a10f2..20b4e72 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-02  Nicolas Richard  <theonewiththeevillook <at> yahoo.fr>
+
+	* sysdep.c (init_system_name): Warn if the function takes too much
+	time.
+
 2014-10-01  Jan Djärv  <jan.h.d <at> swipnet.se>
 
 	* xfaces.c (Finternal_set_lisp_face_attribute): Don't try to
diff --git a/src/sysdep.c b/src/sysdep.c
index 3870b8d..5495370 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1341,6 +1341,9 @@ extern int h_errno;
 void
 init_system_name (void)
 {
+  time_t start, end;
+  double dif;
+  time (&start);
 #ifndef HAVE_GETHOSTNAME
   struct utsname uts;
   uname (&uts);
@@ -1471,6 +1474,11 @@ init_system_name (void)
       if (*p == ' ' || *p == '\t')
 	*p = '-';
   }
+  time (&end);
+  dif = difftime (end, start);
+  if (dif > 4) {
+    fprintf (stderr, "It was very long to init system name. See etc/PROBLEMS via C-h C-p\n");
+  }
 }
 
 sigset_t empty_mask;

-- 
Nicolas Richard




This bug report was last modified 7 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.