Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-22fa
project03
Commits
953e3065
Commit
953e3065
authored
4 years ago
by
Caleb C. Sander
Browse files
Options
Download
Email Patches
Plain Diff
Fix #2
parent
b3903296
master
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
.gitignore
Makefile
+20
-7
Makefile
driver/fcyc.c
+46
-49
driver/fcyc.c
with
67 additions
and
56 deletions
+67
-56
.gitignore
View file @
953e3065
bin/*
out/*
.debug
This diff is collapsed.
Click to expand it.
Makefile
View file @
953e3065
#
# Makefile for the malloc lab driver
#
CC
=
clang
CFLAGS
=
-Werror
-Wall
-Wextra
-O3
-g
all
:
bin/mdriver-implicit bin/mdriver-explicit
CLEAN_COMMAND
=
rm
-f
out/
*
bin/
*
ifdef
DEBUG
CC
=
clang-with-asan
CFLAGS
=
-Werror
-Wall
-Wextra
ifeq
($(wildcard .debug),)
$(shell
$(CLEAN_COMMAND))
$(shell
touch
.debug)
endif
else
CC
=
clang
CFLAGS
=
-Werror
-Wall
-Wextra
-O3
-g
ifneq
($(wildcard .debug),)
$(shell
$(CLEAN_COMMAND)
.debug)
endif
endif
bin/mdriver-implicit
:
out/mdriver-implicit.o out/mm-implicit.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o out/ftimer.o
$(CC)
$(CFLAGS)
$^
-o
$@
all
:
bin/mdriver-implicit bin/mdriver-explicit
bin/mdriver-
explicit
:
out/mdriver-
explicit
.o out/mm-
explicit
.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o
out/ftimer.o
bin/mdriver-
%
:
out/mdriver-
%
.o out/mm-
%
.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o
$(CC)
$(CFLAGS)
$^
-o
$@
out/mdriver-implicit.o
:
driver/mdriver.c
...
...
@@ -25,4 +36,6 @@ out/%.o: driver/%.c
$(CC)
$(CFLAGS)
-c
$^
-o
$@
clean
:
rm
-f
out/
*
bin/
*
$(CLEAN_COMMAND)
.PRECIOUS
:
bin/mdriver-% out/mdriver-implicit.o out/mdriver-explicit.o out/%.o
This diff is collapsed.
Click to expand it.
driver/fcyc.c
View file @
953e3065
...
...
@@ -93,11 +93,9 @@ static int has_converged()
/*
* clear - Code to clear cache
*/
static
volatile
int
sink
=
0
;
static
void
clear
()
{
int
x
=
sink
;
int
*
cptr
,
*
cend
;
int
incr
=
cache_block
/
sizeof
(
int
);
if
(
!
cache_buf
)
{
...
...
@@ -110,10 +108,9 @@ static void clear()
cptr
=
(
int
*
)
cache_buf
;
cend
=
cptr
+
cache_bytes
/
sizeof
(
int
);
while
(
cptr
<
cend
)
{
x
+=
*
cptr
;
*
(
volatile
int
*
)
cptr
;
cptr
+=
incr
;
}
sink
=
x
;
}
/*
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help