Emacs provides several functions and primitives that return time, both elapsed and processor time, used by the Emacs process.
This function returns a string representing the Emacs uptime—the elapsed wall-clock time this instance of Emacs is running. The string is formatted by
format-secondsaccording to the optional argument format. For the available format descriptors, see format-seconds. If format is
nilor omitted, it defaults to
"%Y, %D, %H, %M, %z%S".
When called interactively, it prints the uptime in the echo area.
This function returns the processor run time used by Emacs as a list of four integers:
(sec-high sec-low microsec picosec
), using the same format as
current-time(see Time of Day).
Note that the time returned by this function excludes the time Emacs was not using the processor, and if the Emacs process has several threads, the returned value is the sum of the processor times used up by all Emacs threads.
If the system doesn't provide a way to determine the processor run time,
get-internal-run-timereturns the same time as
This function returns the duration of the Emacs initialization (see Startup Summary) in seconds, as a string. When called interactively, it prints the duration in the echo area.