From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: uptime.el Date: Thu, 14 Feb 2008 22:56:59 +0200 Organization: JURTA Message-ID: <87ir0rcknh.fsf@jurta.org> References: <87lk5ppxj4.fsf@jurta.org> <8g4pcb9aen.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203023297 11222 80.91.229.12 (14 Feb 2008 21:08:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Feb 2008 21:08:17 +0000 (UTC) Cc: rocher@member.fsf.org, emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 14 22:08:41 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JPlJw-0001bR-9Y for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 22:08:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPlJS-0007PH-BM for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 16:08:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPlJ5-0007HU-W6 for emacs-devel@gnu.org; Thu, 14 Feb 2008 16:07:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPlJ4-0007Gr-C8 for emacs-devel@gnu.org; Thu, 14 Feb 2008 16:07:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPlJ4-0007Gn-8j for emacs-devel@gnu.org; Thu, 14 Feb 2008 16:07:46 -0500 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JPlJ0-0002Em-Du; Thu, 14 Feb 2008 16:07:42 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JPlIx-0006V4-0N; Thu, 14 Feb 2008 23:07:39 +0200 In-Reply-To: <8g4pcb9aen.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu, 14 Feb 2008 04:04:16 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Scanner-Signature: 33ca3efb02d57e4381ef3dfbedf9ea6a X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2239 [Feb 14 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 11 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89101 Archived-At: > 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/