Add an example of how to use SCCs to the user guide
authorIan Lynagh <igloo@earth.li>
Fri, 26 Sep 2008 20:38:32 +0000 (20:38 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 26 Sep 2008 20:38:32 +0000 (20:38 +0000)
docs/users_guide/Makefile
docs/users_guide/prof_scc.png [new file with mode: 0644]
docs/users_guide/profiling.xml

index 0657f4a..86504b3 100644 (file)
@@ -7,3 +7,7 @@ INSTALL_XML_DOC = users_guide
 include $(TOP)/mk/bindist.mk
 
 include $(TOP)/mk/target.mk
+
+html::
+       cp prof_scc.png users_guide/
+
diff --git a/docs/users_guide/prof_scc.png b/docs/users_guide/prof_scc.png
new file mode 100644 (file)
index 0000000..5e4157d
Binary files /dev/null and b/docs/users_guide/prof_scc.png differ
index 51ae6f7..f0d96ba 100644 (file)
@@ -266,6 +266,22 @@ MAIN                     MAIN             0    0.0   0.0    100.0 100.0
       far to the right as possible when parsing. (SCC stands for "Set
       Cost Centre").</para>
 
+      <para>Here is an example of a program with a couple of SCCs:</para>
+
+<programlisting>
+main :: IO ()
+main = do let xs = {-# SCC "X" #-} [1..1000000]
+          let ys = {-# SCC "Y" #-} [1..2000000]
+          print $ last xs
+          print $ last $ init xs
+          print $ last ys
+          print $ last $ init ys
+</programlisting>
+
+      <para>which gives this heap profile when run:</para>
+
+      <imagedata fileref="prof_scc.png"/>
+
     </sect2>
 
     <sect2 id="prof-rules">