Commit 630b8955 authored by Simon Marlow's avatar Simon Marlow
Browse files

Cost centre names are now in UTF-8 (#5559)

So the .prof file will be UTF-8.  This is mostly ok, except that the
RTS doesn't calculate the column widths correctly (it assumes bytes =
chars).

hp2ps doesn't do anything sensible with Unicode strings, it just dumps
the bytes into the .ps file.
parent 1ece7b27
......@@ -162,9 +162,11 @@ emitCostCentreDecl
:: CostCentre
-> Code
emitCostCentreDecl cc = do
{ label <- newStringCLit (costCentreUserName cc)
; modl <- newStringCLit (Module.moduleNameString
(Module.moduleName (cc_mod cc)))
-- NB. bytesFS: we want the UTF-8 bytes here (#5559)
{ label <- newByteStringCLit (bytesFS $ costCentreUserNameFS cc)
; modl <- newByteStringCLit (bytesFS $ Module.moduleNameFS
$ Module.moduleName
$ cc_mod cc)
-- All cost centres will be in the main package, since we
-- don't normally use -auto-all or add SCCs to other packages.
-- Hence don't emit the package name in the module here.
......
......@@ -213,9 +213,11 @@ initCostCentres (local_CCs, ___extern_CCs, singleton_CCSs)
emitCostCentreDecl :: CostCentre -> FCode ()
emitCostCentreDecl cc = do
{ label <- newStringCLit (costCentreUserName cc)
; modl <- newStringCLit (Module.moduleNameString
(Module.moduleName (cc_mod cc)))
-- NB. bytesFS: we want the UTF-8 bytes here (#5559)
{ label <- newByteStringCLit (bytesFS $ costCentreUserNameFS cc)
; modl <- newByteStringCLit (bytesFS $ Module.moduleNameFS
$ Module.moduleName
$ cc_mod cc)
-- All cost centres will be in the main package, since we
-- don't normally use -auto-all or add SCCs to other packages.
-- Hence don't emit the package name in the module here.
......
......@@ -24,7 +24,7 @@ module CostCentre (
isCafCCS, isCafCC, isSccCountCC, sccAbleCC, ccFromThisModule,
pprCostCentreCore,
costCentreUserName,
costCentreUserName, costCentreUserNameFS,
cmpCostCentre -- used for removing dups in a list
) where
......@@ -280,9 +280,13 @@ ppCostCentreLbl (NormalCC {cc_name = n, cc_mod = m, cc_is_caf = is_caf})
-- This is the name to go in the user-displayed string,
-- recorded in the cost centre declaration
costCentreUserName :: CostCentre -> String
costCentreUserName (NoCostCentre) = "NO_CC"
costCentreUserName (AllCafsCC {}) = "CAF"
costCentreUserName (NormalCC {cc_name = name, cc_is_caf = is_caf})
= case is_caf of { CafCC -> "CAF:"; _ -> "" } ++ unpackFS name
costCentreUserName = unpackFS . costCentreUserNameFS
costCentreUserNameFS :: CostCentre -> FastString
costCentreUserNameFS (NoCostCentre) = mkFastString "NO_CC"
costCentreUserNameFS (AllCafsCC {}) = mkFastString "CAF"
costCentreUserNameFS (NormalCC {cc_name = name, cc_is_caf = is_caf})
= case is_caf of
CafCC -> mkFastString "CAF:" `appendFS` name
_ -> name
\end{code}
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