Trace all stream-based loops
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 29 Oct 2009 13:43:56 +0000 (13:43 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 29 Oct 2009 13:43:56 +0000 (13:43 +0000)
commit43cef2fc8a5468162e694a5f40e461fa188b29db
tree8f7fea6529d67c5ba8b125e61665b134e23de53f
parenta525b8fdae4f283ce3af7b2a5f1626571ee9c1b8
Trace all stream-based loops

We extend the stream data type with an additional String which says how the
stream was produced:

  data Stream a = forall s. Stream ... String

Now, whenever we create or transform a stream we record the function that did
it:

  replicateS n x = Stream ... (sNoArgs "replicateS")
  mapS f (Stream ... c) = Stream ... ("mapS" `sArgs` c)

Real loops that actually consume streams pass this string to dtrace. The
somewhat funny sNoArgs/sArgs setup is because I want to use ByteStrings
instead of Strings eventually and hope that GHC will be able to just create
big string literals instead of concatenating lots of small ones.
14 files changed:
dph-base/Data/Array/Parallel/Arr/BUArr.hs
dph-base/Data/Array/Parallel/Stream/Flat.hs
dph-base/Data/Array/Parallel/Stream/Flat/Basics.hs
dph-base/Data/Array/Parallel/Stream/Flat/Combinators.hs
dph-base/Data/Array/Parallel/Stream/Flat/Enum.hs
dph-base/Data/Array/Parallel/Stream/Flat/Random.hs
dph-base/Data/Array/Parallel/Stream/Flat/Search.hs
dph-base/Data/Array/Parallel/Stream/Flat/Stream.hs
dph-base/Data/Array/Parallel/Stream/Segmented.hs
dph-base/dph-base.cabal
dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Flat/Basics.hs
dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Flat/Combinators.hs
dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Flat/Permute.hs
dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Flat/Stream.hs