Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
toki
components
freertos-plus
Commits
e278a67b
Commit
e278a67b
authored
Jun 04, 2018
by
Dorel Coman
Committed by
Oliver Horst
Aug 14, 2020
Browse files
memguard: improved benchmark print, in order to be able to extract data easier from the results.
parent
f0c72121
Changes
1
Show whitespace changes
Inline
Side-by-side
src/memguard/benchmark/benchmark.c
View file @
e278a67b
...
...
@@ -28,7 +28,7 @@ uint64_t read_cycle_counter(void)
#define printf xil_printf
#define QEMU
1
#define QEMU
0
#define MASTER_CORE_ID 0U
...
...
@@ -76,7 +76,7 @@ volatile uint64_t bus_accesses;
volatile
uint64_t
instructions
;
/* It keeps track of how many reset window routines are ocurring during the execution of a benchmark */
volatile
uint
32
_t
window_count
;
volatile
uint
64
_t
window
s
_count
;
/* stores the core id */
uint32_t
core_id
;
...
...
@@ -147,15 +147,16 @@ void init_benchmark()
#endif
}
void
start_benchmarks
()
{
void
start_benchmarks
()
{
uint64_t
data
[
17
][
6
]
=
{
0
};
/* setting the random function, used for getting random indexes in array */
srand
(
pmu_read_cyclecount
());
printf
(
"
\n\r
start benchmark
\n\r
"
);
/* Iterating over all benchmarks and measuring each of them for 10s */
for
(
int
i
=
0
;
i
<
NUMBER_OF_BENCHMARKS
;
i
++
){
for
(
int
i
=
0
;
i
<
NUMBER_OF_BENCHMARKS
;
i
++
)
{
for
(
int
j
=
0
;
j
<
ARRAY_SIZE
;
++
j
)
{
a
[
j
]
=
CONST
;
...
...
@@ -163,7 +164,7 @@ void start_benchmarks()
c
[
j
]
=
CONST
;
}
for
(
int
j
=
0
;
j
<
TIME_FRAMES_IN_ARRAY
;
j
++
)
for
(
int
j
=
0
;
j
<
TIME_FRAMES_IN_ARRAY
;
j
++
)
trace_arr
[
j
]
=
0
;
/* variable used for stoping the loop when the timer has counted 10 seconds */
...
...
@@ -175,7 +176,7 @@ void start_benchmarks()
bus_accesses
=
0
;
instructions
=
0
;
memguard_cycle_usage
=
0
;
window_count
=
0
;
window
s
_count
=
0
;
#if(QEMU == 0)
{
...
...
@@ -183,50 +184,69 @@ void start_benchmarks()
}
#endif
if
(
core_id
==
MASTER_CORE_ID
){
printf
(
"ID: %u bench: %d
\n\r
"
,
core_id
,
i
);
if
(
core_id
==
MASTER_CORE_ID
)
{
XTtcPs_ResetCounterValue
(
&
benchmark_timer
);
XTtcPs_Start
(
&
benchmark_timer
);
while
(
not_stop_timer
){
(
*
bench_arr
[
i
])();
while
(
not_stop_timer
)
{
(
*
bench_arr
[
i
])();
}
}
else
{
while
(
not_stop_timer
){
while
(
not_stop_timer
)
{
//(* bench_arr[15])();
}
}
if
(
core_id
==
MASTER_CORE_ID
){
int
val
=
0
;
for
(
int
j
=
0
;
j
<
1000000
;
j
++
)
val
=
j
;
// if (core_id == MASTER_CORE_ID) {
// int val = 0;
// for (int j = 0; j < 1000000; j++)
// val = j;
// }
data
[
i
][
0
]
=
instructions
;
data
[
i
][
1
]
=
window_cycle_count
;
data
[
i
][
2
]
=
bus_accesses
;
data
[
i
][
3
]
=
memguard_cycle_usage
;
data
[
i
][
4
]
=
windows_count
;
}
double
ipc
=
(
double
)
instructions
/
(
double
)
window_cycle_count
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_BENCHMARKS
;
i
++
)
{
instructions
=
data
[
i
][
0
];
window_cycle_count
=
data
[
i
][
1
];
bus_accesses
=
data
[
i
][
2
];
memguard_cycle_usage
=
data
[
i
][
3
];
windows_count
=
data
[
i
][
4
];
double
ipc
=
(
double
)
instructions
/
(
double
)
window_cycle_count
;
uint32_t
ipc_whole
=
(
uint32_t
)
ipc
;
uint32_t
ipc_decimal
=
(
uint32_t
)
((
ipc
-
ipc_whole
)
*
1000
);
uint64_t
bandwidth
=
bus_accesses
/
10
*
SIZE_MEM_READ
/
MB_IN_BYTE
;
printf
(
"
\n\r
ID: %u bench: %d bus accesses: %llu IPC: %u.%u B/W %u MB/s
\n\r
"
,
core_id
,
(
i
+
1
),
bus_accesses
,
ipc_whole
,
ipc_decimal
,
bandwidth
);
core_id
,
(
i
+
1
),
bus_accesses
,
ipc_whole
,
ipc_decimal
,
bandwidth
);
double
overhead
=
(
double
)
memguard_cycle_usage
/
(
double
)
window_cycle_count
;
double
overhead
=
(
double
)
memguard_cycle_usage
/
(
double
)
window_cycle_count
;
uint32_t
overhead_whole
=
(
uint32_t
)
overhead
;
uint32_t
overhead_decimal
=
(
uint32_t
)
((
overhead
-
overhead_whole
)
*
1000
);
printf
(
"Tot us: %llu - memg us: %llu Overhead: %u.%u windows: %u
\n\r
"
,
window_cycle_count
,
memguard_cycle_usage
,
overhead_whole
,
overhead_decimal
,
window_count
);
printf
(
"Tot us: %llu - memg us: %llu Overhead: %u.%u windows: %llu
\n\r
"
,
window_cycle_count
,
memguard_cycle_usage
,
overhead_whole
,
overhead_decimal
,
windows_count
);
}
// if(core_id == MASTER_CORE_ID){
//
// for (int j=7500; j < 8000; j++)
// printf("%u ", trace_arr[j]);
// printf("\n\r");
// }
printf
(
"IPC:
\n\r
"
);
for
(
int
i
=
0
;
i
<
NUMBER_OF_BENCHMARKS
;
i
++
)
{
instructions
=
data
[
i
][
0
];
window_cycle_count
=
data
[
i
][
1
];
double
ipc
=
(
double
)
instructions
/
(
double
)
window_cycle_count
;
uint32_t
ipc_whole
=
(
uint32_t
)
ipc
;
uint32_t
ipc_decimal
=
(
uint32_t
)
((
ipc
-
ipc_whole
)
*
1000
);
printf
(
"%u.%u
\n\r
"
,
ipc_whole
,
ipc_decimal
);
}
}
/****************************
* Tracing functions
****************************/
...
...
@@ -234,10 +254,10 @@ void start_benchmarks()
void
memguard_trace_tick
(
uint32_t
bandwidth_used
)
{
uint
32
_t
window
=
window_count
;
uint
64
_t
window
=
window
s
_count
;
trace_arr
[
window_count
]
=
bandwidth_used
;
window_count
++
;
trace_arr
[
window
s
_count
]
=
bandwidth_used
;
window
s
_count
++
;
}
void
start_benchmark_trace
()
...
...
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