Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BinderDavid
hpc
Commits
12c369b3
Commit
12c369b3
authored
11 years ago
by
Herbert Valerio Riedel
Browse files
Options
Downloads
Patches
Plain Diff
`M-x untabify` & `M-x delete-trailing-whitespaces`
Signed-off-by:
Herbert Valerio Riedel
<
hvr@gnu.org
>
parent
8e228faf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Trace/Hpc/Tix.hs
+19
-20
19 additions, 20 deletions
Trace/Hpc/Tix.hs
Trace/Hpc/Util.hs
+15
-16
15 additions, 16 deletions
Trace/Hpc/Util.hs
with
34 additions
and
36 deletions
Trace/Hpc/Tix.hs
+
19
−
20
View file @
12c369b3
...
...
@@ -6,11 +6,11 @@
-- Andy Gill and Colin Runciman, June 2006
------------------------------------------------------------
-- | Datatypes and file-access routines for the tick data file
-- | Datatypes and file-access routines for the tick data file
-- used by HPC. (.tix)
module
Trace.Hpc.Tix
(
Tix
(
..
),
TixModule
(
..
),
tixModuleName
,
tixModuleHash
,
tixModuleTixs
,
readTix
,
writeTix
,
getTixFileName
)
where
module
Trace.Hpc.Tix
(
Tix
(
..
),
TixModule
(
..
),
tixModuleName
,
tixModuleHash
,
tixModuleTixs
,
readTix
,
writeTix
,
getTixFileName
)
where
import
Data.List
(
isSuffixOf
)
import
Trace.Hpc.Util
(
Hash
,
catchIO
)
...
...
@@ -18,14 +18,14 @@ import Trace.Hpc.Util (Hash, catchIO)
-- 'Tix ' is the storage format for our dynamic imformation about what
-- boxes are ticked.
data
Tix
=
Tix
[
TixModule
]
deriving
(
Read
,
Show
,
Eq
)
deriving
(
Read
,
Show
,
Eq
)
data
TixModule
=
TixModule
String
-- module name
Hash
-- hash number
Int
-- length of tix list (allows pre-allocation at parse time).
[
Integer
]
-- actual ticks
deriving
(
Read
,
Show
,
Eq
)
data
TixModule
=
TixModule
String
-- module name
Hash
-- hash number
Int
-- length of tix list (allows pre-allocation at parse time).
[
Integer
]
-- actual ticks
deriving
(
Read
,
Show
,
Eq
)
tixModuleName
::
TixModule
->
String
tixModuleName
(
TixModule
nm
_
_
_
)
=
nm
...
...
@@ -45,10 +45,10 @@ readTix tix_filename =
(
\
_
->
return
$
Nothing
)
-- write a Tix File.
writeTix
::
String
->
Tix
->
IO
()
writeTix
name
tix
=
writeTix
::
String
->
Tix
->
IO
()
writeTix
name
tix
=
writeFile
name
(
show
tix
)
{-
...
...
@@ -59,8 +59,7 @@ tixName name = name ++ ".tix"
-- getTixFullName takes a binary or .tix-file name,
-- and normalizes it into a .tix-file name.
getTixFileName
::
String
->
String
getTixFileName
str
|
".tix"
`
isSuffixOf
`
str
=
str
|
otherwise
=
str
++
".tix"
getTixFileName
str
|
".tix"
`
isSuffixOf
`
str
=
str
|
otherwise
=
str
++
".tix"
This diff is collapsed.
Click to expand it.
Trace/Hpc/Util.hs
+
15
−
16
View file @
12c369b3
...
...
@@ -22,9 +22,9 @@ import qualified Control.Exception as Exception
import
Data.List
(
foldl'
)
import
Data.Char
(
ord
)
import
Data.Bits
(
xor
)
import
Data.Word
import
Data.Word
-- | 'HpcPos' is an Hpc local rendition of a Span.
-- | 'HpcPos' is an Hpc local rendition of a Span.
data
HpcPos
=
P
!
Int
!
Int
!
Int
!
Int
deriving
(
Eq
,
Ord
)
-- | 'fromHpcPos' explodes the HpcPos into line:column-line:colunm
...
...
@@ -37,11 +37,11 @@ toHpcPos (l1,c1,l2,c2) = P l1 c1 l2 c2
-- | asks the question, is the first argument inside the second argument.
insideHpcPos
::
HpcPos
->
HpcPos
->
Bool
insideHpcPos
small
big
=
sl1
>=
bl1
&&
(
sl1
/=
bl1
||
sc1
>=
bc1
)
&&
sl2
<=
bl2
&&
(
sl2
/=
bl2
||
sc2
<=
bc2
)
insideHpcPos
small
big
=
sl1
>=
bl1
&&
(
sl1
/=
bl1
||
sc1
>=
bc1
)
&&
sl2
<=
bl2
&&
(
sl2
/=
bl2
||
sc2
<=
bc2
)
where
(
sl1
,
sc1
,
sl2
,
sc2
)
=
fromHpcPos
small
(
bl1
,
bc1
,
bl2
,
bc2
)
=
fromHpcPos
big
...
...
@@ -53,11 +53,11 @@ instance Read HpcPos where
where
(
before
,
after
)
=
span
(
/=
','
)
pos
(
lhs0
,
rhs0
)
=
case
span
(
/=
'-'
)
before
of
(
lhs
,
'-'
:
rhs
)
->
(
lhs
,
rhs
)
(
lhs
,
""
)
->
(
lhs
,
lhs
)
_
->
error
"bad parse"
(
l1
,
':'
:
c1
)
=
span
(
/=
':'
)
lhs0
(
l2
,
':'
:
c2
)
=
span
(
/=
':'
)
rhs0
(
lhs
,
'-'
:
rhs
)
->
(
lhs
,
rhs
)
(
lhs
,
""
)
->
(
lhs
,
lhs
)
_
->
error
"bad parse"
(
l1
,
':'
:
c1
)
=
span
(
/=
':'
)
lhs0
(
l2
,
':'
:
c2
)
=
span
(
/=
':'
)
rhs0
------------------------------------------------------------------------------
...
...
@@ -69,9 +69,9 @@ class HpcHash a where
newtype
Hash
=
Hash
Word32
deriving
(
Eq
)
instance
Read
Hash
where
readsPrec
p
n
=
[
(
Hash
v
,
rest
)
|
(
v
,
rest
)
<-
readsPrec
p
n
]
readsPrec
p
n
=
[
(
Hash
v
,
rest
)
|
(
v
,
rest
)
<-
readsPrec
p
n
]
instance
Show
Hash
where
showsPrec
p
(
Hash
n
)
=
showsPrec
p
n
...
...
@@ -112,4 +112,3 @@ hxor (Hash x) (Hash y) = Hash $ x `xor` y
catchIO
::
IO
a
->
(
Exception
.
IOException
->
IO
a
)
->
IO
a
catchIO
=
Exception
.
catch
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment