diff options
| author | Eli Zaretskii | 2008-10-17 19:37:14 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-10-17 19:37:14 +0000 |
| commit | 53728487f15e5f324edf550d64894a95ea48aa54 (patch) | |
| tree | 1d525655bb3b8731c1e912c6414ff9442b2f716d | |
| parent | 4f77c25dfe39469d9b311533b0fe468a846ed748 (diff) | |
| download | emacs-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/ChangeLog | 2 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 76 | ||||
| -rw-r--r-- | etc/NEWS | 3 |
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 | ||
| 9 | 2008-10-17 Martin Rudalics <rudalics@gmx.at> | 11 | 2008-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 | |||
| 1330 | the inverse conversion, use @code{float-time}. | 1330 | the inverse conversion, use @code{float-time}. |
| 1331 | @end defun | 1331 | @end defun |
| 1332 | 1332 | ||
| 1333 | @defun format-seconds format-string seconds | ||
| 1334 | This function converts its argument @var{seconds} into a string of | ||
| 1335 | years, days, hours, etc., according to @var{format-string}. The | ||
| 1336 | argument @var{format-string} may contain @samp{%}-sequences which | ||
| 1337 | control the conversion. Here is a table of what the | ||
| 1338 | @samp{%}-sequences mean: | ||
| 1339 | |||
| 1340 | @table @samp | ||
| 1341 | @item %y | ||
| 1342 | @itemx %Y | ||
| 1343 | The number of full 365-day years. | ||
| 1344 | @item %d | ||
| 1345 | @itemx %D | ||
| 1346 | The number of full days. | ||
| 1347 | @item %h | ||
| 1348 | @itemx %H | ||
| 1349 | The number of full hours. | ||
| 1350 | @item %m | ||
| 1351 | @itemx %M | ||
| 1352 | The number of full minutes. | ||
| 1353 | @item %s | ||
| 1354 | @itemx %S | ||
| 1355 | The number of seconds. | ||
| 1356 | @item %z | ||
| 1357 | Non-printing control flag. When it is used, other specifiers must be | ||
| 1358 | given in the order of decreasing size, i.e.@: years before days, hours | ||
| 1359 | before minutes, etc. Nothing will be produced in the result string to | ||
| 1360 | the left of @samp{%z} until the first non-zero conversion is | ||
| 1361 | encountered. 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 | ||
| 1364 | will always be produced, but years, days, hours, and minutes will only | ||
| 1365 | be shown if they are non-zero. | ||
| 1366 | @item %% | ||
| 1367 | Produces a literal @samp{%}. | ||
| 1368 | @end table | ||
| 1369 | |||
| 1370 | Upper-case format sequences produce the units in addition to the | ||
| 1371 | numbers, lower-case formats produce only the numbers. | ||
| 1372 | |||
| 1373 | You can also specify the field width by following the @samp{%} with a | ||
| 1374 | number; shorter numbers will be padded with blanks. An optional | ||
| 1375 | period 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} | ||
| 1379 | that don't exceed @code{most-positive-fixnum} (@pxref{Integer Basics, | ||
| 1380 | most-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, | ||
| 1389 | both elapsed and processor time, used by the Emacs process. | ||
| 1390 | |||
| 1391 | @defun emacs-uptime &optional format | ||
| 1392 | This function returns a string representing the Emacs | ||
| 1393 | @dfn{uptime}---the elapsed wall-clock time this instance of Emacs is | ||
| 1394 | running. The string is formatted according to the optional argument | ||
| 1395 | @var{format}. For the available format descriptors, see @ref{Time | ||
| 1396 | Parsing, format-seconds}. If @var{format} is nil or omitted, it | ||
| 1397 | defaults 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 |
| 1338 | This function returns the processor run time used by Emacs as a list | 1401 | This function returns the processor run time used by Emacs as a list |
| @@ -1349,8 +1412,19 @@ $high*2^{16}+low$. | |||
| 1349 | The third element, @var{microsec}, gives the microseconds (or 0 for | 1412 | The third element, @var{microsec}, gives the microseconds (or 0 for |
| 1350 | systems that return time with the resolution of only one second). | 1413 | systems that return time with the resolution of only one second). |
| 1351 | 1414 | ||
| 1415 | Note that the time returned by this function excludes the time Emacs | ||
| 1416 | was not using the processor, and if the Emacs process has several | ||
| 1417 | threads, the returned value is the sum of the processor times used up | ||
| 1418 | by all Emacs threads. | ||
| 1419 | |||
| 1352 | If the system doesn't provide a way to determine the processor run | 1420 | If the system doesn't provide a way to determine the processor run |
| 1353 | time, get-internal-run-time returns the same time as current-time. | 1421 | time, @code{get-internal-run-time} returns the same time as |
| 1422 | @code{current-time}. | ||
| 1423 | @end defun | ||
| 1424 | |||
| 1425 | @defun emacs-init-time | ||
| 1426 | This 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 |
| @@ -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 |
| 1213 | value of `current-time' before and after Emacs loads the init files. | 1213 | value 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 |
| 1218 | Emacs initialization. | 1220 | Emacs 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 |
| 1554 | string of days, hours, etc. | 1557 | string of days, hours, etc. |
| 1555 | 1558 | ||