Implemented Bochs benchmarking mode according to feature request
[ 1799946 ] benchmark mode
This commit is contained in:
parent
f562eed497
commit
c719eecb8d
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.119 2007-04-08 15:02:50 vruppert Exp $
|
||||
// $Id: config.cc,v 1.120 2007-09-22 15:59:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -361,6 +361,14 @@ void bx_init_options()
|
||||
BX_RUN_START,
|
||||
BX_QUICK_START);
|
||||
|
||||
new bx_param_enum_c(menu,
|
||||
"start_mode",
|
||||
"Bochs start types",
|
||||
"Bochs start types",
|
||||
bochs_start_names,
|
||||
BX_RUN_START,
|
||||
BX_QUICK_START);
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
new bx_param_bool_c(menu,
|
||||
"restore",
|
||||
@ -375,6 +383,13 @@ void bx_init_options()
|
||||
BX_PATHNAME_LEN);
|
||||
#endif
|
||||
|
||||
// benchmarking mode, set by command line arg
|
||||
new bx_param_num_c(menu,
|
||||
"benchmark",
|
||||
"benchmark mode",
|
||||
"set benchmark mode",
|
||||
0, BX_MAX_BIT32U, 0);
|
||||
|
||||
// subtree for special menus
|
||||
bx_list_c *special_menus = new bx_list_c(root_param, "menu", "");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.210 2007-08-01 17:09:52 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.211 2007-09-22 15:59:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Intro to siminterface by Bryce Denney:
|
||||
@ -122,6 +122,7 @@ typedef enum {
|
||||
// the old BXP_* enum values, which have been eliminated.
|
||||
#define BXPN_SEL_CONFIG_INTERFACE "general.config_interface"
|
||||
#define BXPN_BOCHS_START "general.start_mode"
|
||||
#define BXPN_BOCHS_BENCHMARK "general.benchmark"
|
||||
#define BXPN_RESTORE_FLAG "general.restore"
|
||||
#define BXPN_RESTORE_PATH "general.restore_path"
|
||||
#define BXPN_DEBUG_RUNNING "general.debug_running"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.355 2007-09-22 12:59:40 sshwarts Exp $
|
||||
// $Id: main.cc,v 1.356 2007-09-22 15:59:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -482,6 +482,7 @@ void print_usage()
|
||||
" -n no configuration file\n"
|
||||
" -f configfile specify configuration file\n"
|
||||
" -q quick start (skip configuration interface)\n"
|
||||
" -benchmark n run bochs in benchmark mode for millions of emulated ticks\n"
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
" -r path restore the Bochs state from path\n"
|
||||
#endif
|
||||
@ -546,6 +547,11 @@ int bx_init_main (int argc, char *argv[])
|
||||
if (++arg >= argc) BX_PANIC(("-qf must be followed by a filename"));
|
||||
else bochsrc_filename = argv[arg];
|
||||
}
|
||||
else if (!strcmp("-benchmark", argv[arg])) {
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
if (++arg >= argc) BX_PANIC(("-benchmark must be followed by a number"));
|
||||
else SIM->get_param_num(BXPN_BOCHS_BENCHMARK)->set(atoi(argv[arg]));
|
||||
}
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
else if (!strcmp("-r", argv[arg])) {
|
||||
if (++arg >= argc) BX_PANIC(("-r must be followed by a path"));
|
||||
@ -1020,6 +1026,16 @@ int bx_init_hardware()
|
||||
BX_ERROR(("No romimage to load. Is your bochsrc file loaded/valid ?"));
|
||||
}
|
||||
|
||||
// set one shot timer for benchmark mode if needed, the timer will fire
|
||||
// once and kill Bochs simulation after predefined amount of emulated
|
||||
// ticks
|
||||
int benchmark_mode = SIM->get_param_num(BXPN_BOCHS_BENCHMARK)->get();
|
||||
if (benchmark_mode) {
|
||||
BX_INFO(("Bochs benchmark mode is ON (~%d millions of ticks)", benchmark_mode));
|
||||
bx_pc_system.register_timer_ticks(&bx_pc_system, bx_pc_system_c::benchmarkTimer,
|
||||
(Bit64u) benchmark_mode * 1000000, 0, 1, "benchmark.timer");
|
||||
}
|
||||
|
||||
// set up memory and CPU objects
|
||||
bx_param_num_c *bxp_memsize = SIM->get_param_num(BXPN_MEM_SIZE);
|
||||
Bit32u memSize = bxp_memsize->get() * 1024*1024;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.cc,v 1.65 2006-09-17 20:37:27 vruppert Exp $
|
||||
// $Id: pc_system.cc,v 1.66 2007-09-22 15:59:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -420,6 +420,13 @@ void bx_pc_system_c::nullTimer(void* this_ptr)
|
||||
#endif
|
||||
}
|
||||
|
||||
void bx_pc_system_c::benchmarkTimer(void* this_ptr)
|
||||
{
|
||||
bx_pc_system_c *class_ptr = (bx_pc_system_c *) this_ptr;
|
||||
class_ptr->kill_bochs_request = 1;
|
||||
bx_user_quit = 1;
|
||||
}
|
||||
|
||||
#if BX_DEBUGGER
|
||||
void bx_pc_system_c::timebp_handler(void* this_ptr)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.h,v 1.39 2006-05-27 15:54:47 sshwarts Exp $
|
||||
// $Id: pc_system.h,v 1.40 2007-09-22 15:59:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -135,7 +135,7 @@ public:
|
||||
#if BX_DEBUGGER
|
||||
static void timebp_handler(void* this_ptr);
|
||||
#endif
|
||||
|
||||
static void benchmarkTimer(void* this_ptr);
|
||||
|
||||
// ===========================
|
||||
// Non-timer oriented features
|
||||
|
Loading…
x
Reference in New Issue
Block a user