Print timestamps feature for performance measurements

If enabled (in .bochsrc) + --enable-show-ips=1 Bochs will print IPS + time data every second
This commit is contained in:
Stanislav Shwartsman 2007-11-20 18:36:26 +00:00
parent 1af7010e50
commit a9ea644c5c
3 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.214 2007-11-01 18:03:48 sshwarts Exp $
// $Id: bochs.h,v 1.215 2007-11-20 18:36:26 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -443,6 +443,7 @@ typedef struct {
bx_bool unsupported_io;
bx_bool serial;
bx_bool cdrom;
bx_bool print_timestamps;
#if BX_MAGIC_BREAKPOINT
bx_bool magic_break_enabled;
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.123 2007-10-24 23:27:39 sshwarts Exp $
// $Id: config.cc,v 1.124 2007-11-20 18:36:26 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -2837,6 +2837,20 @@ static Bit32s parse_line_formatted(const char *context, int num_params, char *pa
}
}
#endif
else if (!strcmp(params[0], "print_timestamps")) {
if (num_params != 2) {
PARSE_ERR(("%s: print_timestamps directive: wrong # args.", context));
}
if (strncmp(params[1], "enabled=", 8)) {
PARSE_ERR(("%s: print_timestamps directive malformed.", context));
}
if (params[1][8] == '0' || params[1][8] == '1') {
bx_dbg.print_timestamps = params[1][8] - '0';
}
else {
PARSE_ERR(("%s: print_timestamps directive malformed.", context));
}
}
else if (!strcmp(params[0], "ne2k")) {
int tmp[6];
char tmpchar[6];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.367 2007-11-18 21:09:09 sshwarts Exp $
// $Id: main.cc,v 1.368 2007-11-20 18:36:26 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1234,8 +1234,10 @@ void bx_signal_handler(int signum)
bx_gui->show_ips((Bit32u) ips_count);
ticks_count = bx_pc_system.time_ticks();
counts++;
// printf("MIPS: %u\tticks/counts = %u\t\t(%us)\n",
// (unsigned) ips_count, (unsigned) (ticks_count/counts), (unsigned) counts);
if (bx_dbg.print_timestamps) {
printf("IPS: %u\taverage = %u\t\t(%us)\n",
(unsigned) ips_count, (unsigned) (ticks_count/counts), (unsigned) counts);
}
}
#if !defined(__MINGW32__) && !defined(_MSC_VER)
signal(SIGALRM, bx_signal_handler);