... | ... | @@ -6,7 +6,7 @@ Error: HttpError (HttpExceptionRequest Request { |
|
|
secure = True
|
|
|
requestHeaders = []
|
|
|
path = "/trac/ghc/wiki/Commentary/Hpc"
|
|
|
queryString = "?version=4"
|
|
|
queryString = "?version=5"
|
|
|
method = "GET"
|
|
|
proxy = Nothing
|
|
|
rawBody = False
|
... | ... | @@ -14,7 +14,7 @@ Error: HttpError (HttpExceptionRequest Request { |
|
|
responseTimeout = ResponseTimeoutDefault
|
|
|
requestVersion = HTTP/1.1
|
|
|
}
|
|
|
(StatusCodeException (Response {responseStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Sun, 10 Mar 2019 06:59:44 GMT"),("Server","Apache/2.2.22 (Debian)"),("Strict-Transport-Security","max-age=63072000; includeSubDomains"),("Vary","Accept-Encoding"),("Content-Encoding","gzip"),("Content-Length","253"),("Content-Type","text/html; charset=iso-8859-1")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access /trac/ghc/wiki/Commentary/Hpc\non this server.</p>\n<hr>\n<address>Apache/2.2.22 (Debian) Server at ghc.haskell.org Port 443</address>\n</body></html>\n"))
|
|
|
(StatusCodeException (Response {responseStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Sun, 10 Mar 2019 06:59:58 GMT"),("Server","Apache/2.2.22 (Debian)"),("Strict-Transport-Security","max-age=63072000; includeSubDomains"),("Vary","Accept-Encoding"),("Content-Encoding","gzip"),("Content-Length","253"),("Content-Type","text/html; charset=iso-8859-1")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access /trac/ghc/wiki/Commentary/Hpc\non this server.</p>\n<hr>\n<address>Apache/2.2.22 (Debian) Server at ghc.haskell.org Port 443</address>\n</body></html>\n"))
|
|
|
|
|
|
Original source:
|
|
|
|
... | ... | @@ -27,7 +27,7 @@ The basic idea is this |
|
|
* For each (sub)expression in the Haskell Syntax, write the (sub)expression in a
|
|
|
`HsTick`
|
|
|
* Each `HsTick` has a module local index number.
|
|
|
* There is a table (The Mix datastructure) that maps this index number to original source location.
|
|
|
* There is a table (The Mix data structure) that maps this index number to original source location.
|
|
|
* Each `HsTick` is mapped in the Desugar pass with:
|
|
|
{{{
|
|
|
dsExpr (HsTick n e) = case tick<modname,n> of DEFAULT -> e
|
... | ... | @@ -40,20 +40,48 @@ The basic idea is this |
|
|
* The semantics are tick if-and-when-and-as you enter the `DEFAULT` case. But a chain of consecutive ticks can be executed in any order.
|
|
|
* The !CoreToStg Pass translates the ticks into `StgTick`
|
|
|
{{{
|
|
|
.. (case tick<m,n> of DEFAULT -> e) = .. StgTick m n (... e)
|
|
|
coreToStgExpr (case tick<m,n> of DEFAULT -> e) = StgTick m n (coreToStgExpr e)
|
|
|
}}}
|
|
|
* The `Cmm` code generate translates `StgTick` to a 64 bit increment.
|
|
|
* The `Cmm` code generator translates `StgTick` to a 64 bit increment.
|
|
|
|
|
|
TO BE CONTINUED.
|
|
|
Other details
|
|
|
* A executable startup time, we perform a depth first traversal some module
|
|
|
specific code, gathering a list of all Hpc registered modules, and the
|
|
|
module specific tick table.
|
|
|
* There is one table per module, so we can link the increment statically,
|
|
|
without needing to know the global tick number.
|
|
|
* The module Hpc.c in the RTS handles all the reading of these table.
|
|
|
* At startup, if a .tix file is found, Hpc.c checks that this is the same
|
|
|
binary as generated the .tix file, and if so, pre-loads all the tick counts
|
|
|
in the module specific locations.
|
|
|
* (I am looking for a good way of checking the binaries for sameness)
|
|
|
* At shutdown, we write back out the .tix files, from the module-local tables.
|
|
|
|
|
|
=== Binary Tick Boxes ===
|
|
|
|
|
|
The reason we do not translate tick boxes using.
|
|
|
There is also the concept of a binary tick box. This is a syntactical boolean, like a guard or conditional for an if.
|
|
|
We use tick boxes to record the result of the boolean, to check for coverage over True and False.
|
|
|
|
|
|
* Each `HsBinaryTick` is mapped in the Desugar pass with:
|
|
|
{{{
|
|
|
if e then (tick a True) else (tick b False)
|
|
|
dsExpr (HsBinaryTick t f e) = case e of
|
|
|
{ True -> case tick<modname,t> of DEFAULT -> True
|
|
|
; False -> case tick<modname,f> of DEFAULT -> False }
|
|
|
|
|
|
}}}
|
|
|
is that `tick<a> True` is a CAF, and gets lifted to top level. This maintain the coverage information, but does not allow for entry counting. If the if/then/else is called 100 times, and no exceptions were thrown, then you would expect the binary tick count to add up to 100. We hope to use Hpc to do path optimization in the future, so real numbers are important.
|
|
|
|
|
|
Also, we translate the tick late to allow case-of-case to work, allowing unboxed compares to work without generating boolean intermediates. We still need to push one optimization into the simplifier for this to work well.
|
|
|
* After desugaring, there is no longer any special code for binary tick box.
|
|
|
|
|
|
== Tracer Mode ==
|
|
|
|
|
|
There is a mode '-fhpc-tracer', which compiles code which outputs .rix files; a record
|
|
|
of everywhere the program goes.
|
|
|
|
|
|
* by default, the -fhpc-tracer program does exactly the same as a -fhpc compiled program.
|
|
|
* setting the env var HPCRIX causes an additional action, at each tick (and a few other important events),
|
|
|
the global tick number is written into the file named in HPCRIX.
|
|
|
* Typically, HPCRIX would point to a named pipe.
|
|
|
|
|
|
There is a Hpc tracer which sets up both the named pipe, and the HPCRIX variable exactly for dynamically
|
|
|
interacting with the tracer output.
|
|
|
|
|
|
``` |