Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs744-project1-final
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Naman Dixit
cs744-project1-final
Commits
a02484f8
Commit
a02484f8
authored
Oct 24, 2019
by
Naman Dixit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forced number of cache sets to be power of 2
parent
c912887b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
README.txt
README.txt
+2
-1
common/aux.h
common/aux.h
+17
-0
server/server.c
server/server.c
+1
-1
No files found.
README.txt
View file @
a02484f8
...
...
@@ -17,7 +17,8 @@ Instructions:
will listen)
2. -threadPoolSize=YYY (number of threads in the
thread pool)
3. -numSetsInCache=ZZZ (number of sets in the cache)
3. -numSetsInCache=ZZZ (number of sets in the cache,
should be a power of 2)
4. -sizeOfSet=AAA (associativity of sets)
Storage: The server stores the data in "${PWD}/data_store/" directory.
...
...
common/aux.h
View file @
a02484f8
...
...
@@ -659,5 +659,22 @@ Size strprefix(Char *pre, Char *str)
}
}
}
header_function
U64
nextPowerOf2
(
U64
v
)
{
v
--
;
v
|=
v
>>
1
;
v
|=
v
>>
2
;
v
|=
v
>>
4
;
v
|=
v
>>
8
;
v
|=
v
>>
16
;
v
|=
v
>>
32
;
v
++
;
return
v
;
}
#define AUX_H_INCLUDE_GUARD
#endif
server/server.c
View file @
a02484f8
...
...
@@ -69,7 +69,7 @@ Sint main (Sint argc, Char *argv[])
}
else
if
((
arg_pos
=
strprefix
(
"-threadPoolSize="
,
argv
[
i
])))
{
thread_pool_size
=
(
Size
)
strtol
(
&
(
argv
[
i
][
arg_pos
]),
NULL
,
0
);
}
else
if
((
arg_pos
=
strprefix
(
"-numSetsInCache="
,
argv
[
i
])))
{
cache_set_count
=
(
Size
)
strtol
(
&
(
argv
[
i
][
arg_pos
]),
NULL
,
0
);
cache_set_count
=
nextPowerOf2
((
Size
)
strtol
(
&
(
argv
[
i
][
arg_pos
]),
NULL
,
0
)
);
}
else
if
((
arg_pos
=
strprefix
(
"-sizeOfSet="
,
argv
[
i
])))
{
cache_associativity
=
(
Size
)
strtol
(
&
(
argv
[
i
][
arg_pos
]),
NULL
,
0
);
}
...
...
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