id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
7190,GHC's -fprof-auto does not work with LINE pragmas,timthelion,,"Please note the difference between the two .prof files created. The ""profnopragma"" one contains a ""main"" and the ""profpragma"" one doesn't.  I came across this problem profiling a much larger source. In that case, ghc failed to profile anything within my source code at all!

{{{
[timothy@timothy haskell]$ cat profpragma.hs
f=""hi""{-# LINE 1 ""hi.hs"" #-}
main :: IO (){-# LINE 2 ""hi.hs"" #-}
main = print f{-# LINE 3 ""hi.hs"" #-}
[timothy@timothy haskell]$ cat profnopragma.hs
f=""hi""
main :: IO ()
main = print f
[timothy@timothy haskell]$ ghc profpragma.hs -prof -fprof-auto
[timothy@timothy haskell]$ ghc profnopragma.hs -prof -fprof-auto
[timothy@timothy haskell]$ ./profpragma +RTS -p
""hi""
[timothy@timothy haskell]$ ./profnopragma +RTS -p
""hi""
[timothy@timothy haskell]$ cat profpragma.prof 
	Sun Aug 26 20:30 2012 Time and Allocation Profiling Report  (Final)

	   profpragma +RTS -p -RTS

	total time  =        0.00 secs   (0 ticks @ 1000 us, 1 processor)
	total alloc =      49,704 bytes  (excludes profiling overheads)

COST CENTRE MODULE           %time %alloc

CAF         GHC.IO.Encoding    0.0    5.6
CAF         GHC.IO.Handle.FD   0.0   69.8
CAF         GHC.Conc.Signal    0.0    1.4
CAF         Main               0.0   21.7


                                                      individual     inherited
COST CENTRE MODULE                  no.     entries  %time %alloc   %time %alloc

MAIN        MAIN                     46           0    0.0    0.7     0.0  100.0
 CAF        Main                     91           0    0.0   21.7     0.0   22.1
  f         Main                     92           1    0.0    0.3     0.0    0.3
 CAF        GHC.Conc.Signal          87           0    0.0    1.4     0.0    1.4
 CAF        GHC.IO.Handle.FD         85           0    0.0   69.8     0.0   69.8
 CAF        GHC.IO.Encoding          80           0    0.0    5.6     0.0    5.6
 CAF        GHC.IO.Encoding.Iconv    66           0    0.0    0.5     0.0    0.5
[timothy@timothy haskell]$ cat profnopragma.prof 
	Sun Aug 26 20:30 2012 Time and Allocation Profiling Report  (Final)

	   profnopragma +RTS -p -RTS

	total time  =        0.00 secs   (0 ticks @ 1000 us, 1 processor)
	total alloc =      49,704 bytes  (excludes profiling overheads)

COST CENTRE MODULE           %time %alloc

CAF         GHC.IO.Encoding    0.0    5.6
CAF         GHC.IO.Handle.FD   0.0   69.8
CAF         GHC.Conc.Signal    0.0    1.4
main        Main               0.0   20.8


                                                      individual     inherited
COST CENTRE MODULE                  no.     entries  %time %alloc   %time %alloc

MAIN        MAIN                     46           0    0.0    0.7     0.0  100.0
 CAF        Main                     91           0    0.0    0.9     0.0   22.1
  f         Main                     93           1    0.0    0.3     0.0    0.3
  main      Main                     92           1    0.0   20.8     0.0   20.8
 CAF        GHC.Conc.Signal          87           0    0.0    1.4     0.0    1.4
 CAF        GHC.IO.Handle.FD         85           0    0.0   69.8     0.0   69.8
 CAF        GHC.IO.Encoding          80           0    0.0    5.6     0.0    5.6
 CAF        GHC.IO.Encoding.Iconv    66           0    0.0    0.5     0.0    0.5

}}}
",bug,new,normal,7.8.1,Profiling,7.4.2,,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,Unknown,,,,
