Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-orbit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Katerina Roukounaki
cloud-orbit
Commits
97b708ab
Commit
97b708ab
authored
Nov 14, 2014
by
Aggelos Giantsios
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set a type alias for the statistics
parent
36650a70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Sequential.hs
Sequential.hs
+3
-3
Table.hs
Table.hs
+5
-3
No files found.
Sequential.hs
View file @
97b708ab
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
--
--
module
Sequential
(
orbit
)
where
module
Sequential
(
orbit
)
where
import
Table
(
Freq
,
VTable
,
Vertex
,
get_freq
,
freq_to_stat
,
is_member
,
insert
,
new
,
to_list
)
import
Table
(
Freq
,
Stats
,
VTable
,
Vertex
,
get_freq
,
freq_to_stat
,
is_member
,
insert
,
new
,
to_list
)
import
Data.Hashable
(
hash
)
import
Data.Hashable
(
hash
)
import
Data.Dequeue
(
BankersDequeue
,
fromList
,
popFront
,
pushBack
)
import
Data.Dequeue
(
BankersDequeue
,
fromList
,
popFront
,
pushBack
)
import
OrbitUtils
(
now
)
import
OrbitUtils
(
now
)
...
@@ -24,7 +24,7 @@ type Conf = ([Vertex -> Vertex], Int)
...
@@ -24,7 +24,7 @@ type Conf = ([Vertex -> Vertex], Int)
-- where the hash table is of size TableSize.
-- where the hash table is of size TableSize.
-- The function returns a pair consisting of the computed orbit and a singleton
-- The function returns a pair consisting of the computed orbit and a singleton
-- list of statistics (mainly runtime and fill degree of the table).
-- list of statistics (mainly runtime and fill degree of the table).
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
Int
->
([
Vertex
],
[
[(
String
,
String
)]
])
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
Int
->
([
Vertex
],
[
Stats
])
orbit
gs
xs
tableSize
=
(
orbit
,
[
stat
])
orbit
gs
xs
tableSize
=
(
orbit
,
[
stat
])
-- assemble static configuration
-- assemble static configuration
where
staticMachConf
=
mk_static_mach_conf
gs
tableSize
where
staticMachConf
=
mk_static_mach_conf
gs
tableSize
...
@@ -91,7 +91,7 @@ get_table_size :: Conf -> Int
...
@@ -91,7 +91,7 @@ get_table_size :: Conf -> Int
get_table_size
staticMachConf
=
snd
staticMachConf
get_table_size
staticMachConf
=
snd
staticMachConf
-- produce readable statistics
-- produce readable statistics
seq_stats
::
Int
->
Freq
->
Int
->
[(
String
,
String
)]
seq_stats
::
Int
->
Freq
->
Int
->
Stats
seq_stats
elapsedTime
frequency
vertsRecvd
=
seq_stats
elapsedTime
frequency
vertsRecvd
=
(
"wall_time"
,
show
elapsedTime
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
freq_to_stat
frequency
(
"wall_time"
,
show
elapsedTime
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
freq_to_stat
frequency
Table.hs
View file @
97b708ab
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
-- orbit-int hash table (storing vertices on a worker)
-- orbit-int hash table (storing vertices on a worker)
--
--
module
Table
(
Freq
module
Table
(
Freq
,
Stats
,
VTable
,
VTable
,
Vertex
,
Vertex
,
new
,
new
...
@@ -23,9 +24,10 @@ module Table( Freq
...
@@ -23,9 +24,10 @@ module Table( Freq
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
type
Freq
=
[
Int
]
type
Freq
=
[
Int
]
type
Vertex
=
Int
type
Vertex
=
Int
type
VTable
=
Array
Int
[
Vertex
]
type
VTable
=
Array
Int
[
Vertex
]
type
Stats
=
[(
String
,
String
)]
-- Note: Hash tables have a fixed number of slots but each slot can store
-- Note: Hash tables have a fixed number of slots but each slot can store
-- a list of vertices. The functions is_member/3 and insert/3
-- a list of vertices. The functions is_member/3 and insert/3
...
@@ -101,7 +103,7 @@ sum_freqs fs = foldl (flip sum_freqs2) [] fs
...
@@ -101,7 +103,7 @@ sum_freqs fs = foldl (flip sum_freqs2) [] fs
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- the input frequency F is itself part of the statistics
-- the input frequency F is itself part of the statistics
freq_to_stat
::
Freq
->
[(
String
,
String
)]
freq_to_stat
::
Freq
->
Stats
freq_to_stat
frequency
=
[
(
"freq"
,
show
frequency
)
freq_to_stat
frequency
=
[
(
"freq"
,
show
frequency
)
,
(
"size"
,
show
$
freq_to_vertices
frequency
)
,
(
"size"
,
show
$
freq_to_vertices
frequency
)
,
(
"slots"
,
show
$
freq_to_slots
frequency
)
,
(
"slots"
,
show
$
freq_to_slots
frequency
)
...
@@ -116,7 +118,7 @@ freq_to_stat frequency = [ ("freq", show frequency)
...
@@ -116,7 +118,7 @@ freq_to_stat frequency = [ ("freq", show frequency)
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
freq_from_stat
::
[(
String
,
String
)]
->
Freq
freq_from_stat
::
Stats
->
Freq
freq_from_stat
stat
=
freq_from_stat
stat
=
case
"freq"
`
lookup
`
stat
of
case
"freq"
`
lookup
`
stat
of
Just
val
->
read
val
::
[
Int
]
Just
val
->
read
val
::
[
Int
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment