bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18607: 24.3.93; Warn user if finding fqdn is too slow


From: Nicolas Richard
Subject: bug#18607: 24.3.93; Warn user if finding fqdn is too slow
Date: Thu, 02 Oct 2014 15:08:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux)

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@yahoo.fr>
+
+       * sysdep.c (init_system_name): Warn if the function takes too much
+       time.
+
 2014-10-01  Jan Djärv  <jan.h.d@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]