Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
4211ee7d
Commit
4211ee7d
authored
Nov 06, 2004
by
Eli Zaretskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fget_internal_run_time): New function.
(syms_of_data): Defsubr it.
parent
59dede22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
src/editfns.c
src/editfns.c
+46
-0
No files found.
src/editfns.c
View file @
4211ee7d
...
...
@@ -39,6 +39,10 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h>
#endif
#if defined HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <ctype.h>
#include "lisp.h"
...
...
@@ -1375,6 +1379,47 @@ resolution finer than a second. */)
return
Flist
(
3
,
result
);
}
DEFUN
(
"get-internal-run-time"
,
Fget_internal_run_time
,
Sget_internal_run_time
,
0
,
0
,
0
,
doc
:
/* Return the current run time used by Emacs.
The time is returned as a list of three integers. The first has the
most significant 16 bits of the seconds, while the second has the
least significant 16 bits. The third integer gives the microsecond
count.
On systems that can't determine the run time, get-internal-run-time
does the same thing as current-time. The microsecond count is zero on
systems that do not provide resolution finer than a second. */
)
()
{
#ifdef HAVE_GETRUSAGE
struct
rusage
usage
;
Lisp_Object
result
[
3
];
int
secs
,
usecs
;
if
(
getrusage
(
RUSAGE_SELF
,
&
usage
)
<
0
)
/* This shouldn't happen. What action is appropriate? */
Fsignal
(
Qerror
,
Qnil
);
/* Sum up user time and system time. */
secs
=
usage
.
ru_utime
.
tv_sec
+
usage
.
ru_stime
.
tv_sec
;
usecs
=
usage
.
ru_utime
.
tv_usec
+
usage
.
ru_stime
.
tv_usec
;
if
(
usecs
>=
1000000
)
{
usecs
-=
1000000
;
secs
++
;
}
XSETINT
(
result
[
0
],
(
secs
>>
16
)
&
0xffff
);
XSETINT
(
result
[
1
],
(
secs
>>
0
)
&
0xffff
);
XSETINT
(
result
[
2
],
usecs
);
return
Flist
(
3
,
result
);
#else
return
Fcurrent_time
();
#endif
}
int
...
...
@@ -4315,6 +4360,7 @@ functions if all the text being accessed has this property. */);
defsubr
(
&
Suser_full_name
);
defsubr
(
&
Semacs_pid
);
defsubr
(
&
Scurrent_time
);
defsubr
(
&
Sget_internal_run_time
);
defsubr
(
&
Sformat_time_string
);
defsubr
(
&
Sfloat_time
);
defsubr
(
&
Sdecode_time
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment