aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-17 19:37:14 +0000
committerEli Zaretskii2008-10-17 19:37:14 +0000
commit53728487f15e5f324edf550d64894a95ea48aa54 (patch)
tree1d525655bb3b8731c1e912c6414ff9442b2f716d
parent4f77c25dfe39469d9b311533b0fe468a846ed748 (diff)
downloademacs-53728487f15e5f324edf550d64894a95ea48aa54.tar.gz
emacs-53728487f15e5f324edf550d64894a95ea48aa54.zip
(Processor Run Time): Document `emacs-uptime' and `emacs-init-time'.
(Time Parsing): Document `format-seconds'.
-rw-r--r--doc/lispref/ChangeLog2
-rw-r--r--doc/lispref/os.texi76
-rw-r--r--etc/NEWS3
3 files changed, 80 insertions, 1 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index c0e27ea4712..5891f611050 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -5,6 +5,8 @@
5 `window-system-initialization-alist'. Document reading the 5 `window-system-initialization-alist'. Document reading the
6 abbrevs file. Document the call to `server-start' under --daemon. 6 abbrevs file. Document the call to `server-start' under --daemon.
7 Rearrange a bit to be consistent with the code flow. 7 Rearrange a bit to be consistent with the code flow.
8 (Processor Run Time): Document `emacs-uptime' and `emacs-init-time'.
9 (Time Parsing): Document `format-seconds'.
8 10
92008-10-17 Martin Rudalics <rudalics@gmx.at> 112008-10-17 Martin Rudalics <rudalics@gmx.at>
10 12
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index fda4ed2c8a5..7236f0c0e18 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1330,9 +1330,72 @@ seconds since the epoch, to a time value and returns that. To perform
1330the inverse conversion, use @code{float-time}. 1330the inverse conversion, use @code{float-time}.
1331@end defun 1331@end defun
1332 1332
1333@defun format-seconds format-string seconds
1334This function converts its argument @var{seconds} into a string of
1335years, days, hours, etc., according to @var{format-string}. The
1336argument @var{format-string} may contain @samp{%}-sequences which
1337control the conversion. Here is a table of what the
1338@samp{%}-sequences mean:
1339
1340@table @samp
1341@item %y
1342@itemx %Y
1343The number of full 365-day years.
1344@item %d
1345@itemx %D
1346The number of full days.
1347@item %h
1348@itemx %H
1349The number of full hours.
1350@item %m
1351@itemx %M
1352The number of full minutes.
1353@item %s
1354@itemx %S
1355The number of seconds.
1356@item %z
1357Non-printing control flag. When it is used, other specifiers must be
1358given in the order of decreasing size, i.e.@: years before days, hours
1359before minutes, etc. Nothing will be produced in the result string to
1360the left of @samp{%z} until the first non-zero conversion is
1361encountered. For example, the default format used by
1362@code{emacs-uptime} (@pxref{Processor Run Time, emacs-uptime})
1363@w{@code{"%Y, %D, %H, %M, %z%S"}} means that the number of seconds
1364will always be produced, but years, days, hours, and minutes will only
1365be shown if they are non-zero.
1366@item %%
1367Produces a literal @samp{%}.
1368@end table
1369
1370Upper-case format sequences produce the units in addition to the
1371numbers, lower-case formats produce only the numbers.
1372
1373You can also specify the field width by following the @samp{%} with a
1374number; shorter numbers will be padded with blanks. An optional
1375period before the width requests zero-padding instead. For example,
1376@code{"%.3Y"} might produce @code{"004 years"}.
1377
1378@emph{Warning:} This function works only with values of @var{seconds}
1379that don't exceed @code{most-positive-fixnum} (@pxref{Integer Basics,
1380most-positive-fixnum}).
1381@end defun
1382
1333@node Processor Run Time 1383@node Processor Run Time
1334@section Processor Run time 1384@section Processor Run time
1335@cindex processor run time 1385@cindex processor run time
1386@cindex Emacs process run time
1387
1388 Emacs provides several functions and primitives that return time,
1389both elapsed and processor time, used by the Emacs process.
1390
1391@defun emacs-uptime &optional format
1392This function returns a string representing the Emacs
1393@dfn{uptime}---the elapsed wall-clock time this instance of Emacs is
1394running. The string is formatted according to the optional argument
1395@var{format}. For the available format descriptors, see @ref{Time
1396Parsing, format-seconds}. If @var{format} is nil or omitted, it
1397defaults to @code{"%Y, %D, %H, %M, %z%S"}.
1398@end defun
1336 1399
1337@defun get-internal-run-time 1400@defun get-internal-run-time
1338This function returns the processor run time used by Emacs as a list 1401This function returns the processor run time used by Emacs as a list
@@ -1349,8 +1412,19 @@ $high*2^{16}+low$.
1349The third element, @var{microsec}, gives the microseconds (or 0 for 1412The third element, @var{microsec}, gives the microseconds (or 0 for
1350systems that return time with the resolution of only one second). 1413systems that return time with the resolution of only one second).
1351 1414
1415Note that the time returned by this function excludes the time Emacs
1416was not using the processor, and if the Emacs process has several
1417threads, the returned value is the sum of the processor times used up
1418by all Emacs threads.
1419
1352If the system doesn't provide a way to determine the processor run 1420If the system doesn't provide a way to determine the processor run
1353time, get-internal-run-time returns the same time as current-time. 1421time, @code{get-internal-run-time} returns the same time as
1422@code{current-time}.
1423@end defun
1424
1425@defun emacs-init-time
1426This function returns the duration of the Emacs initialization
1427(@pxref{Startup Summary}) in seconds, as a string.
1354@end defun 1428@end defun
1355 1429
1356@node Time Calculations 1430@node Time Calculations
diff --git a/etc/NEWS b/etc/NEWS
index bf6b4622473..58c4388fba2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1212,8 +1212,10 @@ reset transient-mark-mode to the value OLDVAL. The values `only' and
1212*** The new variables `before-init-time' and `after-init-time' record the 1212*** The new variables `before-init-time' and `after-init-time' record the
1213value of `current-time' before and after Emacs loads the init files. 1213value of `current-time' before and after Emacs loads the init files.
1214 1214
1215+++
1215*** The new function `emacs-uptime' returns the uptime of an Emacs instance. 1216*** The new function `emacs-uptime' returns the uptime of an Emacs instance.
1216 1217
1218+++
1217*** The new function `emacs-init-time' returns the duration of the 1219*** The new function `emacs-init-time' returns the duration of the
1218Emacs initialization. 1220Emacs initialization.
1219 1221
@@ -1550,6 +1552,7 @@ times the default column width.
1550 1552
1551** Miscellaneous new functions 1553** Miscellaneous new functions
1552 1554
1555+++
1553*** `format-seconds' converts a number of seconds into a readable 1556*** `format-seconds' converts a number of seconds into a readable
1554string of days, hours, etc. 1557string of days, hours, etc.
1555 1558