Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
7e3a6be6
Commit
7e3a6be6
authored
31 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Fixed getrusage stub to correctly compute the microseconds.
parent
9c184a64
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lisp/hpux-os.c
+31
-17
31 additions, 17 deletions
lisp/hpux-os.c
with
31 additions
and
17 deletions
lisp/hpux-os.c
+
31
−
17
View file @
7e3a6be6
/*
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.
3
1993/
08/0
2 20:
20:35 hallgren
Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.
4
1993/
11/1
2 20:
08:22 wlott
Exp $
*
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
* OS-independent interface to the operating system VM facilities.
...
@@ -39,6 +39,7 @@ the particular section in.
...
@@ -39,6 +39,7 @@ the particular section in.
#include
"interrupt.h"
#include
"interrupt.h"
#include
<netdb.h>
#include
<netdb.h>
#include
<sys/times.h>
#include
<sys/times.h>
#include
<errno.h>
os_vm_size_t
os_vm_page_size
=
(
-
1
);
os_vm_size_t
os_vm_page_size
=
(
-
1
);
...
@@ -306,28 +307,41 @@ os_reallocate(os_vm_address_t addr, os_vm_size_t old_len,
...
@@ -306,28 +307,41 @@ os_reallocate(os_vm_address_t addr, os_vm_size_t old_len,
return
addr
;
return
addr
;
}
}
void
int
getrusage
(
int
who
,
struct
rusage
*
rusage
)
getrusage
(
int
who
,
struct
rusage
*
rusage
)
{
{
long
clk_tck
;
static
long
ticks_per_sec
=
0
;
static
long
usec_per_tick
=
0
;
struct
tms
buf
;
struct
tms
buf
;
clock_t
uticks
,
sticks
;
bzero
(
rusage
,
sizeof
(
struct
rusage
));
bzero
(
rusage
,
sizeof
(
struct
rusage
));
clk_tck
=
sysconf
(
_SC_CLK_TCK
);
if
(
ticks_per_sec
==
0
)
{
if
(
times
(
&
buf
)
==
-
1
)
{
ticks_per_sec
=
sysconf
(
_SC_CLK_TCK
);
perror
(
"times"
);
usec_per_tick
=
1000000
/
ticks_per_sec
;
return
;
}
}
if
(
times
(
&
buf
)
==
-
1
)
return
-
1
;
if
(
who
==
RUSAGE_SELF
)
{
if
(
who
==
RUSAGE_SELF
)
{
rusage
->
ru_utime
.
tv_sec
=
buf
.
tms_utime
/
clk_tck
;
uticks
=
buf
.
tms_utime
;
rusage
->
ru_utime
.
tv_usec
=
(
buf
.
tms_utime
%
clk_tck
)
*
100000
;
sticks
=
buf
.
tms_stime
;
rusage
->
ru_stime
.
tv_sec
=
buf
.
tms_stime
/
clk_tck
;
rusage
->
ru_stime
.
tv_usec
=
(
buf
.
tms_stime
%
clk_tck
)
*
100000
;
}
else
if
(
who
==
RUSAGE_CHILDREN
)
{
rusage
->
ru_utime
.
tv_sec
=
buf
.
tms_cutime
/
clk_tck
;
rusage
->
ru_utime
.
tv_usec
=
(
buf
.
tms_cutime
%
clk_tck
)
*
100000
;
rusage
->
ru_stime
.
tv_sec
=
buf
.
tms_cstime
/
clk_tck
;
rusage
->
ru_stime
.
tv_usec
=
(
buf
.
tms_cstime
%
clk_tck
)
*
100000
;
}
}
else
if
(
who
==
RUSAGE_CHILDREN
)
{
uticks
=
buf
.
tms_utime
;
sticks
=
buf
.
tms_stime
;
}
else
{
errno
=
EINVAL
;
return
-
1
;
}
rusage
->
ru_utime
.
tv_sec
=
uticks
/
ticks_per_sec
;
rusage
->
ru_utime
.
tv_usec
=
(
uticks
%
ticks_per_sec
)
*
usec_per_tick
;
rusage
->
ru_stime
.
tv_sec
=
sticks
/
ticks_per_sec
;
rusage
->
ru_stime
.
tv_usec
=
(
sticks
%
ticks_per_sec
)
*
usec_per_tick
;
return
0
;
}
}
int
int
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment