Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
d2a09365
Commit
d2a09365
authored
May 27, 2004
by
simonmar
Browse files
[project @ 2004-05-27 09:29:28 by simonmar]
Make getAllocations() return an Int64 to avoid Int overflow.
parent
dc9ffb20
Changes
3
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/ghci/InteractiveUI.hs
View file @
d2a09365
{-# OPTIONS -#include "Linker.h" #-}
-----------------------------------------------------------------------------
-- $Id: InteractiveUI.hs,v 1.16
5
2004/0
4/05 11:14:30
simon
pj
Exp $
-- $Id: InteractiveUI.hs,v 1.16
6
2004/0
5/27 09:29:29
simon
mar
Exp $
--
-- GHC Interactive User Interface
--
-- (c) The GHC Team 200
0
-- (c) The GHC Team 200
4
--
-----------------------------------------------------------------------------
module
InteractiveUI
(
...
...
@@ -57,6 +57,7 @@ import Control.Concurrent
import
Numeric
import
Data.List
import
Data.Int
(
Int64
)
import
System.Cmd
import
System.CPUTime
import
System.Environment
...
...
@@ -1018,18 +1019,20 @@ timeIt action
a
<-
action
allocs2
<-
io
$
getAllocations
time2
<-
io
$
getCPUTime
io
$
printTimes
(
allocs2
-
allocs1
)
(
time2
-
time1
)
io
$
printTimes
(
fromIntegral
(
allocs2
-
allocs1
))
(
time2
-
time1
)
return
a
foreign
import
ccall
"getAllocations"
getAllocations
::
IO
Int
foreign
import
ccall
unsafe
"getAllocations"
getAllocations
::
IO
Int64
-- defined in ghc/rts/Stats.c
printTimes
::
Int
->
Integer
->
IO
()
printTimes
::
Int
eger
->
Integer
->
IO
()
printTimes
allocs
psecs
=
do
let
secs
=
(
fromIntegral
psecs
/
(
10
^
12
))
::
Float
secs_str
=
showFFloat
(
Just
2
)
secs
putStrLn
(
showSDoc
(
parens
(
text
(
secs_str
""
)
<+>
text
"secs"
<>
comma
<+>
int
allocs
<+>
text
"bytes"
)))
text
(
show
allocs
)
<+>
text
"bytes"
)))
-----------------------------------------------------------------------------
-- reverting CAFs
...
...
ghc/rts/Stats.c
View file @
d2a09365
/* -----------------------------------------------------------------------------
* $Id: Stats.c,v 1.4
6
200
2
/0
8/19 16:02
:2
6
simonmar Exp $
* $Id: Stats.c,v 1.4
7
200
4
/0
5/27 09:29
:2
8
simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -821,5 +821,5 @@ statDescribeGens(void)
each compilation and expression evaluation.
-------------------------------------------------------------------------- */
extern
HsInt
getAllocations
(
void
)
{
return
(
HsInt
)
(
total_allocated
*
sizeof
(
W_
)
)
;
}
extern
HsInt
64
getAllocations
(
void
)
{
return
(
HsInt
64
)
total_allocated
*
sizeof
(
W_
);
}
ghc/rts/Stats.h
View file @
d2a09365
/* -----------------------------------------------------------------------------
* $Id: Stats.h,v 1.1
7
200
2
/0
2/06
0
1
:2
1:41 sof
Exp $
* $Id: Stats.h,v 1.1
8
200
4
/0
5/27
0
9
:2
9:29 simonmar
Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -45,7 +45,7 @@ extern double mut_user_time_during_heap_census(void);
#endif // PROFILING
extern
void
statDescribeGens
(
void
);
extern
HsInt
getAllocations
(
void
);
extern
HsInt
64
getAllocations
(
void
);
#if defined(SMP)
extern
long
int
stat_getElapsedTime
(
void
);
...
...
Write
Preview
Supports
Markdown
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