From: Juri Linkov <juri@jurta.org>
To: Glenn Morris <rgm@gnu.org>
Cc: rocher@member.fsf.org, emacs-devel@gnu.org
Subject: Re: uptime.el
Date: Thu, 14 Feb 2008 22:56:59 +0200 [thread overview]
Message-ID: <87ir0rcknh.fsf@jurta.org> (raw)
In-Reply-To: <8g4pcb9aen.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu, 14 Feb 2008 04:04:16 -0500")
> Juri Linkov wrote:
>
>> Maybe `emacs-uptime' should display (and insert) both how long emacs
>> has been running and the time when it was started up.
>>
>> As for `emacs-startup-time', I think it would be useful if it displayed
>> how long the startup itself takes.
>
> I don't have much of an opinion. Feel free to make whatever changes
> you like.
Like below. I think the second time should be recorded just before running
`after-init-hook' to allow users putting in .emacs:
(add-hook 'after-init-hook (lambda () (message "%s" (emacs-startup-time))) t)
Index: lisp/startup.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/startup.el,v
retrieving revision 1.477
diff -c -r1.477 startup.el
*** lisp/startup.el 12 Feb 2008 23:41:08 -0000 1.477
--- lisp/startup.el 14 Feb 2008 20:55:10 -0000
***************
*** 197,202 ****
--- 197,205 ----
(defvar emacs-startup-time nil
"Value of `current-time' when Emacs was started.")
+ (defvar emacs-startup-time-after-init nil
+ "Value of `current-time' after loading init files.")
+
(defvar emacs-startup-hook nil
"Normal hook run after loading init files and handling the command line.")
***************
*** 1097,1102 ****
--- 1100,1107 ----
(eq face-ignored-fonts old-face-ignored-fonts))
(clear-face-cache)))
+ (setq emacs-startup-time-after-init (current-time))
+
(run-hooks 'after-init-hook)
;; Decode all default-directory.
Index: lisp/time.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/time.el,v
retrieving revision 1.101
diff -c -r1.101 time.el
*** lisp/time.el 8 Jan 2008 20:44:42 -0000 1.101
--- lisp/time.el 14 Feb 2008 20:54:51 -0000
***************
*** 548,553 ****
--- 548,567 ----
(when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
(cancel-timer elt)))))))
+ ;;;###autoload
+ (defun emacs-startup-time ()
+ "Return a string giving the Emacs startup time."
+ (interactive)
+ (let ((str
+ (format-seconds "Startup time: %Y, %D, %H, %M, %S"
+ (time-to-seconds
+ (time-subtract emacs-startup-time-after-init
+ emacs-startup-time))
+ t)))
+ (if (interactive-p)
+ (message "%s" str)
+ str)))
+
(provide 'time)
;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2008-02-14 20:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 23:03 uptime.el Francesc Rocher
2008-02-12 5:54 ` uptime.el Glenn Morris
2008-02-12 23:35 ` uptime.el Juri Linkov
2008-02-14 9:04 ` uptime.el Glenn Morris
2008-02-14 20:56 ` Juri Linkov [this message]
2008-02-15 8:02 ` uptime.el Glenn Morris
2008-02-16 0:27 ` uptime.el Juri Linkov
2008-02-16 3:35 ` uptime.el Glenn Morris
2008-02-16 19:14 ` uptime.el Juri Linkov
2008-02-16 22:22 ` uptime.el Glenn Morris
2008-02-16 23:18 ` uptime.el Juri Linkov
2008-02-17 0:19 ` uptime.el Glenn Morris
2008-02-17 0:45 ` uptime.el Juri Linkov
2008-02-17 22:55 ` uptime.el Glenn Morris
2008-02-17 23:11 ` uptime.el Juri Linkov
2008-02-16 2:00 ` uptime.el Xavier Maillard
-- strict thread matches above, loose matches on Subject: below --
2007-12-19 10:12 uptime.el Richard Stallman
2007-12-19 10:33 ` uptime.el Leo
2007-12-23 2:26 ` uptime.el Ævar Arnfjörð Bjarmason
2007-12-23 21:11 ` uptime.el Richard Stallman
2007-12-23 17:48 ` uptime.el Juri Linkov
2007-12-24 13:31 ` uptime.el Richard Stallman
2007-12-24 21:59 ` uptime.el Juri Linkov
2007-12-25 21:13 ` uptime.el Richard Stallman
2008-02-11 0:34 ` uptime.el Glenn Morris
2008-02-12 0:14 ` uptime.el Juri Linkov
2008-02-12 5:50 ` uptime.el Glenn Morris
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ir0rcknh.fsf@jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.org \
--cc=rgm@gnu.org \
--cc=rocher@member.fsf.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).