Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Gesh
GHC
Commits
a88d6139
Commit
a88d6139
authored
26 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1999-02-23 12:02:57 by simonm]
Print time spent collecting each generation.
parent
b8886039
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/rts/Stats.c
+32
-20
32 additions, 20 deletions
ghc/rts/Stats.c
with
32 additions
and
20 deletions
ghc/rts/Stats.c
+
32
−
20
View file @
a88d6139
/* -----------------------------------------------------------------------------
* $Id: Stats.c,v 1.
7
1999/02/
09
12:
49:23
simonm Exp $
* $Id: Stats.c,v 1.
8
1999/02/
23
12:
02:57
simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -78,27 +78,29 @@
/* huh? */
#define BIG_STRING_LEN 512
static
StgD
ouble
ElapsedTimeStart
=
0
.
0
;
static
StgD
ouble
TicksPerSecond
=
0
.
0
;
static
d
ouble
ElapsedTimeStart
=
0
.
0
;
static
d
ouble
TicksPerSecond
=
0
.
0
;
static
StgD
ouble
InitUserTime
=
0
.
0
;
static
StgD
ouble
InitElapsedTime
=
0
.
0
;
static
d
ouble
InitUserTime
=
0
.
0
;
static
d
ouble
InitElapsedTime
=
0
.
0
;
static
ullong
GC_tot_alloc
=
0
;
static
StgD
ouble
GC_start_time
,
GC_tot_time
=
0
;
/* User GC Time */
static
StgD
ouble
GCe_start_time
,
GCe_tot_time
=
0
;
/* Elapsed GC time */
static
d
ouble
GC_start_time
,
GC_tot_time
=
0
;
/* User GC Time */
static
d
ouble
GCe_start_time
,
GCe_tot_time
=
0
;
/* Elapsed GC time */
lnat
MaxResidency
=
0
;
/* in words; for stats only */
lnat
ResidencySamples
=
0
;
/* for stats only */
static
lnat
GC_start_faults
=
0
,
GC_end_faults
=
0
;
static
double
*
GC_coll_times
;
/* ToDo: convert this to use integers? --SDM */
/* elapsedtime() -- The current elapsed time in seconds */
StgD
ouble
d
ouble
elapsedtime
(
void
)
{
#if ! (defined(HAVE_TIMES) || defined(HAVE_FTIME))
...
...
@@ -118,7 +120,7 @@ elapsedtime(void)
struct
tms
t
;
clock_t
r
=
times
(
&
t
);
return
(((
StgD
ouble
)
r
)
/
TicksPerSecond
-
ElapsedTimeStart
);
return
(((
d
ouble
)
r
)
/
TicksPerSecond
-
ElapsedTimeStart
);
# else
/* HAVE_FTIME */
struct
timeb
t
;
...
...
@@ -156,11 +158,11 @@ start_time(void)
fprintf
(
stderr
,
"stat_init: bad call to 'sysconf'!
\n
"
);
stg_exit
(
EXIT_FAILURE
);
}
TicksPerSecond
=
(
StgD
ouble
)
ticks
;
TicksPerSecond
=
(
d
ouble
)
ticks
;
#else
/* no "sysconf"; had better guess */
# ifdef HZ
TicksPerSecond
=
(
StgD
ouble
)
(
HZ
);
TicksPerSecond
=
(
d
ouble
)
(
HZ
);
# else
/* had better guess wildly */
/* We will #ifdef around the fprintf for machines
...
...
@@ -178,16 +180,24 @@ start_time(void)
void
initStats
(
void
)
{
nat
i
;
FILE
*
sf
=
RtsFlags
.
GcFlags
.
statsFile
;
if
(
RtsFlags
.
GcFlags
.
giveStats
)
{
fprintf
(
sf
,
" Alloc Collect Live GC GC TOT TOT Page Flts
\n
"
);
fprintf
(
sf
,
" bytes bytes bytes user elap user elap
\n
"
);
}
GC_coll_times
=
(
double
*
)
stgMallocBytes
(
sizeof
(
double
)
*
RtsFlags
.
GcFlags
.
generations
,
"initStats"
);
for
(
i
=
0
;
i
<
RtsFlags
.
GcFlags
.
generations
;
i
++
)
{
GC_coll_times
[
i
]
=
0
.
0
;
}
}
StgD
ouble
d
ouble
usertime
(
void
)
{
#if ! (defined(HAVE_GETRUSAGE) || defined(HAVE_TIMES))
...
...
@@ -203,7 +213,7 @@ usertime(void)
struct
tms
t
;
times
(
&
t
);
return
(((
StgD
ouble
)(
t
.
tms_utime
))
/
TicksPerSecond
);
return
(((
d
ouble
)(
t
.
tms_utime
))
/
TicksPerSecond
);
#else
/* HAVE_GETRUSAGE */
struct
rusage
t
;
...
...
@@ -266,8 +276,8 @@ stat_endGC(lnat alloc, lnat collect, lnat live, lnat gen)
FILE
*
sf
=
RtsFlags
.
GcFlags
.
statsFile
;
if
(
sf
!=
NULL
)
{
StgD
ouble
time
=
usertime
();
StgD
ouble
etime
=
elapsedtime
();
d
ouble
time
=
usertime
();
d
ouble
etime
=
elapsedtime
();
if
(
RtsFlags
.
GcFlags
.
giveStats
)
{
nat
faults
=
pagefaults
();
...
...
@@ -287,6 +297,8 @@ stat_endGC(lnat alloc, lnat collect, lnat live, lnat gen)
fflush
(
sf
);
}
GC_coll_times
[
gen
]
+=
time
-
GC_start_time
;
GC_tot_alloc
+=
(
ullong
)
alloc
;
GC_tot_time
+=
time
-
GC_start_time
;
GCe_tot_time
+=
etime
-
GCe_start_time
;
...
...
@@ -320,9 +332,9 @@ stat_exit(int alloc)
if
(
sf
!=
NULL
){
char
temp
[
BIG_STRING_LEN
];
StgD
ouble
time
=
usertime
();
StgD
ouble
etime
=
elapsedtime
();
StgD
ouble
MutTime
,
MutElapsedTime
;
d
ouble
time
=
usertime
();
d
ouble
etime
=
elapsedtime
();
d
ouble
MutTime
,
MutElapsedTime
;
/* avoid divide by zero if time is measured as 0.00 seconds -- SDM */
if
(
time
==
0
.
0
)
time
=
0
.
0001
;
...
...
@@ -349,8 +361,8 @@ stat_exit(int alloc)
{
/* Count garbage collections */
nat
g
;
for
(
g
=
0
;
g
<
RtsFlags
.
GcFlags
.
generations
;
g
++
)
{
fprintf
(
sf
,
"%11d collections in generation %d
\n
"
,
generations
[
g
].
collections
,
g
);
fprintf
(
sf
,
"%11d collections in generation %d
(%6.2fs)
\n
"
,
generations
[
g
].
collections
,
g
,
GC_coll_times
[
g
]
);
}
}
fprintf
(
sf
,
"
\n
%11ld Mb total memory in use
\n\n
"
,
...
...
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