Fixes #110 Make cpu_test also print out the emulated cpu speed

This commit is contained in:
Stefan Arentz 2016-12-30 14:53:54 -05:00
parent e734f65473
commit 8c49fdc3f8

View File

@ -20,9 +20,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <time.h> #include <time.h>
#include "cpu.h" #include "cpu.h"
@ -75,7 +77,7 @@ int test(int model, uint16_t start_addr, uint16_t success_addr, char *rom_path)
double duration = (double) duration_ns / 1000000000.0; double duration = (double) duration_ns / 1000000000.0;
double mhz = (double) cpu.counter * (1.0 / duration) / 1000000.0; double mhz = (double) cpu.counter * (1.0 / duration) / 1000000.0;
fprintf(stderr, "TEST Success; executed %lu cycles in %.4f at %.4f MHz\n", fprintf(stderr, "TEST Success; executed %" PRIu64 " cycles in %.4f at %.4f MHz\n",
cpu.counter, duration, mhz); cpu.counter, duration, mhz);
return 0; return 0;