Commit b2fcdedd authored by Michael Hanus 's avatar Michael Hanus

profiling package updated

parent 64a93032
......@@ -17,7 +17,7 @@ rev (x:xs) = append (rev xs) [x]
nrev :: Int -> IO ()
nrev n = do
let xs = [1 .. n]
const done $!! xs
const (return ()) $!! xs
profileSpaceNF (rev xs)
-- LIPS = (n+1)*(n+2)/2/exec.time
......@@ -25,11 +25,11 @@ nrev n = do
nrevLIPS :: Int -> IO ()
nrevLIPS n = do
let xs = [1 .. n]
const done $!! xs
const (return ()) $!! xs
garbageCollect
garbageCollectorOff
pi1 <- getProcessInfos
const done $!! (rev xs)
const (return ()) $!! (rev xs)
pi2 <- getProcessInfos
garbageCollectorOn
let rtime = maybe 0 id (lookup RunTime pi2)
......@@ -58,17 +58,20 @@ main = nrevLIPS 4000
-- Result on a Linux-PC Intel Core i7-4790 / 3.6Ghz (belair, Sicstus 4.3/JIT):
-- 13.45 MLIPS for (nrev 4000)
-- Result on a Linux-PC Intel Core i7-7700 / 4.2Ghz (lascombes, Sicstus 4.4):
-- 16.14 MLIPS for (nrev 4000)
-- as nrev but double evaluation
nrev2 :: Int -> IO ()
nrev2 n = do
let xs = [1 .. n]
const done $!! xs
const (return ()) $!! xs
profileSpaceNF (rev xs, rev xs)
-- as nrev2 but with test equality instead of unification:
nrev3 :: Int -> IO ()
nrev3 n = do
let xs = [1 .. n]
const done $!! xs
const (return ()) $!! xs
profileSpaceNF (rev xs == rev xs)
......@@ -10,8 +10,8 @@
"base" : ">= 3.0.0, < 4.0.0"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
"pakcs": ">= 3.0.0, < 4.0.0",
"kics2": ">= 3.0.0, < 4.0.0"
},
"exportedModules": [ "Debug.Profile" ],
"source": {
......
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="getProcessInfos" arity="0">
<library>prim_profile</library>
<entry>prim_getProcessInfos</entry>
</primitive>
<primitive name="garbageCollectorOn" arity="0">
<library>prim_profile</library>
<entry>prim_garbageCollectorOn</entry>
</primitive>
<primitive name="garbageCollectorOff" arity="0">
<library>prim_profile</library>
<entry>prim_garbageCollectorOff</entry>
</primitive>
<primitive name="garbageCollect" arity="0">
<library>prim_profile</library>
<entry>prim_garbageCollect</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definitions of builtins of module Debug.Profile:
%
% return statistics about the PAKCS process:
'Debug.Profile.getProcessInfos'(Infos) :-
(getCurrentGCs(GCs)
-> I1=['Prelude.(,)'('Debug.Profile.GarbageCollections',GCs)] ; I1=[]),
(getCurrentChoiceSize(Choice)
-> I2=['Prelude.(,)'('Debug.Profile.Choices',Choice)|I1] ; I2=I1),
(getCurrentHeapSize(Heap)
-> I3=['Prelude.(,)'('Debug.Profile.Heap',Heap)|I2] ; I3=I2),
(getCurrentStackSize(Stack)
-> I4=['Prelude.(,)'('Debug.Profile.Stack',Stack)|I3] ; I4=I3),
(getCurrentCodeSize(Code)
-> I5=['Prelude.(,)'('Debug.Profile.Code',Code)|I4] ; I5=I4),
(getCurrentMemorySize(Mem)
-> I6=['Prelude.(,)'('Debug.Profile.Memory',Mem)|I5] ; I6=I5),
(getElapsedTime(ETime)
-> I7=['Prelude.(,)'('Debug.Profile.ElapsedTime',ETime)|I6] ; I7=I6),
(getRunTime(RTime)
-> I8=['Prelude.(,)'('Debug.Profile.RunTime',RTime)|I7] ; I8=I7),
Infos = I8.
% turn on garbage collector:
'Debug.Profile.garbageCollectorOn'('Prelude.()') :- garbageCollectorOn.
% turn off garbage collector:
'Debug.Profile.garbageCollectorOff'('Prelude.()') :- garbageCollectorOff.
% turn off garbage collector:
'Debug.Profile.garbageCollect'('Prelude.()') :- garbageCollect.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment