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-21fa
project04
Commits
b3903296
Commit
b3903296
authored
4 years ago
by
Caleb C. Sander
Browse files
Options
Download
Email Patches
Plain Diff
Fix #5
parent
8fe74be2
master
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
driver/fcyc.c
+3
-0
driver/fcyc.c
driver/fcyc.h
+17
-17
driver/fcyc.h
driver/fsecs.c
+3
-0
driver/fsecs.c
driver/fsecs.h
+1
-0
driver/fsecs.h
driver/mdriver.c
+14
-7
driver/mdriver.c
with
38 additions
and
24 deletions
+38
-24
driver/fcyc.c
View file @
b3903296
...
...
@@ -250,6 +250,9 @@ void set_fcyc_epsilon(double epsilon_arg)
epsilon
=
epsilon_arg
;
}
void
deinit_fcyc
(
void
)
{
free
(
cache_buf
);
}
...
...
This diff is collapsed.
Click to expand it.
driver/fcyc.h
View file @
b3903296
...
...
@@ -63,6 +63,6 @@ void set_fcyc_maxsamples(int maxsamples_arg);
*/
void
set_fcyc_epsilon
(
double
epsilon_arg
);
void
deinit_fcyc
(
void
);
This diff is collapsed.
Click to expand it.
driver/fsecs.c
View file @
b3903296
...
...
@@ -54,4 +54,7 @@ double fsecs(fsecs_test_funct f, void *argp)
#endif
}
void
deinit_fsecs
(
void
)
{
deinit_fcyc
();
}
This diff is collapsed.
Click to expand it.
driver/fsecs.h
View file @
b3903296
...
...
@@ -2,3 +2,4 @@ typedef void (*fsecs_test_funct)(void *);
void
init_fsecs
(
void
);
double
fsecs
(
fsecs_test_funct
f
,
void
*
argp
);
void
deinit_fsecs
(
void
);
This diff is collapsed.
Click to expand it.
driver/mdriver.c
View file @
b3903296
...
...
@@ -86,7 +86,6 @@ typedef struct {
*/
typedef
struct
{
trace_t
*
trace
;
range_t
*
ranges
;
}
speed_t
;
/* Summarizes the important stats for some malloc function on some trace */
...
...
@@ -184,9 +183,10 @@ static void app_error(const char *fmt, ...)
num_tracefiles, if there's a timeout) */
static
void
run_tests
(
int
num_tracefiles
,
const
char
*
tracedir
,
char
**
tracefiles
,
stats_t
*
mm_stats
,
range_t
*
ranges
,
speed_t
*
speed_params
)
{
stats_t
*
mm_stats
,
speed_t
*
speed_params
)
{
volatile
int
i
;
range_t
*
ranges
=
NULL
;
/* keeps track of block extents for one trace */
for
(
i
=
0
;
i
<
num_tracefiles
;
i
++
)
{
trace_t
*
trace
;
trace
=
read_trace
(
&
mm_stats
[
i
],
tracedir
,
tracefiles
[
i
]);
...
...
@@ -195,6 +195,7 @@ static void run_tests(int num_tracefiles, const char *tracedir,
if
(
verbose
>
1
)
printf
(
"Checking mm_malloc for correctness, "
);
mm_stats
[
i
].
valid
=
eval_mm_valid
(
trace
,
&
ranges
);
clear_ranges
(
&
ranges
);
if
(
onetime_flag
)
{
free_trace
(
trace
);
...
...
@@ -205,7 +206,6 @@ static void run_tests(int num_tracefiles, const char *tracedir,
printf
(
"efficiency, "
);
mm_stats
[
i
].
util
=
eval_mm_util
(
trace
,
i
);
speed_params
->
trace
=
trace
;
speed_params
->
ranges
=
ranges
;
if
(
verbose
>
1
)
printf
(
"and performance.
\n
"
);
mm_stats
[
i
].
secs
=
fsecs
(
eval_mm_speed
,
speed_params
);
...
...
@@ -224,7 +224,6 @@ int main(int argc, char **argv)
char
**
tracefiles
=
NULL
;
/* null-terminated array of trace file names */
int
num_tracefiles
=
0
;
/* the number of traces in that array */
range_t
*
ranges
=
NULL
;
/* keeps track of block extents for one trace */
stats_t
*
libc_stats
=
NULL
;
/* libc stats for each trace */
stats_t
*
mm_stats
=
NULL
;
/* mm (i.e. student) stats for each trace */
speed_t
speed_params
;
/* input parameters to the xx_speed routines */
...
...
@@ -349,9 +348,10 @@ int main(int argc, char **argv)
/* Initialize the simulated memory system in memlib.c */
mem_init
();
run_tests
(
num_tracefiles
,
tracedir
,
tracefiles
,
mm_stats
,
ranges
,
&
speed_params
);
run_tests
(
num_tracefiles
,
tracedir
,
tracefiles
,
mm_stats
,
&
speed_params
);
mem_deinit
();
deinit_fsecs
();
/* Display the mm results in a compact table */
if
(
verbose
)
{
...
...
@@ -369,6 +369,13 @@ int main(int argc, char **argv)
}
}
if
(
tracefiles
!=
default_tracefiles
)
{
for
(
i
=
0
;
i
<
num_tracefiles
;
i
++
)
{
free
(
tracefiles
[
i
]);
}
free
(
tracefiles
);
}
/*
* Accumulate the aggregate statistics for the student's mm package
*/
...
...
@@ -384,6 +391,7 @@ int main(int argc, char **argv)
if
(
mm_stats
[
i
].
valid
)
numcorrect
++
;
}
free
(
mm_stats
);
if
(
weight
==
0
)
avg_mm_util
=
0
;
else
...
...
@@ -769,7 +777,6 @@ static int eval_mm_valid(trace_t *trace, range_t **ranges)
/* Reset the heap and free any records in the range list */
mem_reset_brk
();
clear_ranges
(
ranges
);
reinit_trace
(
trace
);
/* Call the mm package's init function */
...
...
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