Fixed printf format types, and don't act like a test.
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sim65.h>
|
#include <sim65.h>
|
||||||
|
|
||||||
static uint32_t timestamp(void)
|
static uint32_t timestamp(void)
|
||||||
@@ -67,8 +66,8 @@ int main(void)
|
|||||||
{
|
{
|
||||||
unsigned max_term;
|
unsigned max_term;
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
uint32_t t1, t2, overhead, duration;
|
uint32_t t1, t2, overhead;
|
||||||
int32_t d0, d1;
|
int32_t d0, d1, duration;
|
||||||
int32_t predicted_duration;
|
int32_t predicted_duration;
|
||||||
|
|
||||||
/* Calibration measurement of zero clock cycles, to determine the overhead. */
|
/* Calibration measurement of zero clock cycles, to determine the overhead. */
|
||||||
@@ -101,9 +100,11 @@ int main(void)
|
|||||||
max_term = 10000;
|
max_term = 10000;
|
||||||
predicted_duration = d0 + max_term * (d1 - d0);
|
predicted_duration = d0 + max_term * (d1 - d0);
|
||||||
|
|
||||||
printf("predicted duration for max_term = %u: %lu\n", max_term, predicted_duration);
|
printf("predicted duration for max_term = %u: %ld\n", max_term, predicted_duration);
|
||||||
|
|
||||||
/* Do the actual measurement for max_term = 10000. */
|
/* Do the actual measurement for max_term = 10000.
|
||||||
|
* Note: equality between the prediction and the measurement is only achieved if we compile with -O.
|
||||||
|
*/
|
||||||
|
|
||||||
t1 = timestamp();
|
t1 = timestamp();
|
||||||
result = calc_sum_terms(max_term);
|
result = calc_sum_terms(max_term);
|
||||||
@@ -111,7 +112,6 @@ int main(void)
|
|||||||
duration = (t2 - t1) - overhead;
|
duration = (t2 - t1) - overhead;
|
||||||
printf("max_term = %u -> result = %lu; duration = %ld\n", max_term, result, duration);
|
printf("max_term = %u -> result = %lu; duration = %ld\n", max_term, result, duration);
|
||||||
|
|
||||||
/* Report success or failure. */
|
|
||||||
|
|
||||||
return (duration == predicted_duration) ? EXIT_SUCCESS : EXIT_FAILURE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user