do not start tagmap lookup counting until everything is initialized / tagmap lookups are now properly shown for each execution when running multiple sets from built-in UI instead of only when exiting MAME completely (nw)

This commit is contained in:
Oliver Stöneberg 2014-09-09 20:29:57 +00:00
parent 111ec37e89
commit 80428c91fc
4 changed files with 21 additions and 8 deletions

View File

@ -292,12 +292,6 @@ int cli_frontend::execute(int argc, char **argv)
_7z_file_cache_clear();
#ifdef MAME_DEBUG
// TODO: this will only be printed when the executable is exited and not when selecting a new set via the internal UI - it needs to be placed somewhere else where it can be printed and reset after each run (check Average Speed location)
if (*(m_options.command()) == 0)
osd_printf_info("%d tagmap lookups\n", g_tagmap_finds);
#endif
return m_result;
}

View File

@ -361,6 +361,12 @@ int running_machine::run(bool firstrun)
// perform a soft reset -- this takes us to the running phase
soft_reset();
#ifdef MAME_DEBUG
g_tagmap_finds = 0;
if (strcmp(config().m_gamedrv.name, "___empty") != 0)
g_tagmap_counter_enabled = true;
#endif
// run the CPUs until a reset or exit
m_hard_reset_pending = false;
while ((!m_hard_reset_pending && !m_exit_pending) || m_saveload_schedule != SLS_NONE)
@ -430,6 +436,15 @@ int running_machine::run(bool firstrun)
error = MAMERR_FATALERROR;
}
#ifdef MAME_DEBUG
if (g_tagmap_counter_enabled)
{
g_tagmap_counter_enabled = false;
if (*(options().command()) == 0)
osd_printf_info("%d tagmap lookups\n", g_tagmap_finds);
}
#endif
// make sure our phase is set properly before cleaning up,
// in case we got here via exception
m_current_phase = MACHINE_PHASE_EXIT;

View File

@ -12,4 +12,5 @@
#ifdef MAME_DEBUG
INT32 g_tagmap_finds = 0;
bool g_tagmap_counter_enabled = false;
#endif

View File

@ -35,6 +35,7 @@ enum tagmap_error
#ifdef MAME_DEBUG
extern INT32 g_tagmap_finds;
extern bool g_tagmap_counter_enabled;
#endif
//**************************************************************************
@ -134,7 +135,8 @@ public:
_ElementType find(const char *tag, UINT32 fullhash) const
{
#ifdef MAME_DEBUG
atomic_increment32(&g_tagmap_finds);
if (g_tagmap_counter_enabled)
atomic_increment32(&g_tagmap_finds);
#endif
for (entry_t *entry = m_table[fullhash % ARRAY_LENGTH(m_table)]; entry != NULL; entry = entry->next())
if (entry->fullhash() == fullhash && entry->tag() == tag)
@ -146,7 +148,8 @@ public:
_ElementType find_hash_only(const char *tag) const
{
#ifdef MAME_DEBUG
atomic_increment32(&g_tagmap_finds);
if (g_tagmap_counter_enabled)
atomic_increment32(&g_tagmap_finds);
#endif
UINT32 fullhash = hash(tag);
for (entry_t *entry = m_table[fullhash % ARRAY_LENGTH(m_table)]; entry != NULL; entry = entry->next())