astring *image_info_astring(running_machine *machine, astring *string) { device_image_interface *image = NULL; astring_printf(string, "%s\n\n", machine->gamedrv->description); #if 0 if (mess_ram_size > 0) { char buf2[RAM_STRING_BUFLEN]; astring_catprintf(string, "RAM: %s\n\n", ram_string(buf2, mess_ram_size)); } #endif for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) { const char *name = image->filename(); if (name != NULL) { const char *base_filename; const char *info; char *base_filename_noextension; base_filename = image->basename(); base_filename_noextension = strip_extension(base_filename); /* display device type and filename */ astring_catprintf(string, "%s: %s\n", image->image_config().devconfig().name(), base_filename); /* display long filename, if present and doesn't correspond to name */ info = image->longname(); if (info && (!base_filename_noextension || mame_stricmp(info, base_filename_noextension))) astring_catprintf(string, "%s\n", info); /* display manufacturer, if available */ info = image->manufacturer(); if (info != NULL) { astring_catprintf(string, "%s", info); info = stripspace(image->year()); if (info && *info) astring_catprintf(string, ", %s", info); astring_catprintf(string,"\n"); } /* display playable information, if available */ info = image->playable(); if (info != NULL) astring_catprintf(string, "%s\n", info); if (base_filename_noextension != NULL) free(base_filename_noextension); } else { astring_catprintf(string, "%s: ---\n", image->image_config().devconfig().name()); } } return string; }
astring *_profiler_get_text(running_machine *machine, astring *string) { static const profile_string names[] = { { PROFILER_MEMREAD, "Memory Read" }, { PROFILER_MEMWRITE, "Memory Write" }, { PROFILER_VIDEO, "Video Update" }, { PROFILER_DRAWGFX, "drawgfx" }, { PROFILER_COPYBITMAP, "copybitmap" }, { PROFILER_TILEMAP_DRAW, "Tilemap Draw" }, { PROFILER_TILEMAP_DRAW_ROZ, "Tilemap ROZ Draw" }, { PROFILER_TILEMAP_UPDATE, "Tilemap Update" }, { PROFILER_BLIT, "OSD Blitting" }, { PROFILER_SOUND, "Sound Generation" }, { PROFILER_TIMER_CALLBACK, "Timer Callbacks" }, { PROFILER_INPUT, "Input Processing" }, { PROFILER_MOVIE_REC, "Movie Recording" }, { PROFILER_LOGERROR, "Error Logging" }, { PROFILER_EXTRA, "Unaccounted/Overhead" }, { PROFILER_USER1, "User 1" }, { PROFILER_USER2, "User 2" }, { PROFILER_USER3, "User 3" }, { PROFILER_USER4, "User 4" }, { PROFILER_USER5, "User 5" }, { PROFILER_USER6, "User 6" }, { PROFILER_USER7, "User 7" }, { PROFILER_USER8, "User 8" }, { PROFILER_PROFILER, "Profiler" }, { PROFILER_IDLE, "Idle" } }; UINT64 computed, normalize, total; int curtype, curmem, switches; profiler_mark_start(PROFILER_PROFILER); /* compute the total time for all bits, not including profiler or idle */ computed = 0; for (curtype = 0; curtype < PROFILER_PROFILER; curtype++) for (curmem = 0; curmem < ARRAY_LENGTH(global_profiler.data); curmem++) computed += global_profiler.data[curmem].duration[curtype]; /* save that result in normalize, and continue adding the rest */ normalize = computed; for ( ; curtype < PROFILER_TOTAL; curtype++) for (curmem = 0; curmem < ARRAY_LENGTH(global_profiler.data); curmem++) computed += global_profiler.data[curmem].duration[curtype]; /* this becomes the total; if we end up with 0 for anything, we were just started, so return empty */ total = computed; astring_reset(string); if (total == 0 || normalize == 0) goto out; /* loop over all types and generate the string */ for (curtype = 0; curtype < PROFILER_TOTAL; curtype++) { /* determine the accumulated time for this type */ computed = 0; for (curmem = 0; curmem < ARRAY_LENGTH(global_profiler.data); curmem++) computed += global_profiler.data[curmem].duration[curtype]; /* if we have non-zero data and we're ready to display, do it */ if (global_profiler.dataready && computed != 0) { int nameindex; /* start with the un-normalized percentage */ astring_catprintf(string, "%02d%% ", (int)((computed * 100 + total/2) / total)); /* followed by the normalized percentage for everything but profiler and idle */ if (curtype < PROFILER_PROFILER) astring_catprintf(string, "%02d%% ", (int)((computed * 100 + normalize/2) / normalize)); /* and then the text */ if (curtype >= PROFILER_CPU_FIRST && curtype <= PROFILER_CPU_MAX) astring_catprintf(string, "CPU '%s'", device_list_find_by_index(machine->config->devicelist, CPU, curtype - PROFILER_CPU_FIRST)->tag); else for (nameindex = 0; nameindex < ARRAY_LENGTH(names); nameindex++) if (names[nameindex].type == curtype) { astring_catc(string, names[nameindex].string); break; } /* followed by a carriage return */ astring_catc(string, "\n"); } } /* followed by context switches */ if (global_profiler.dataready) { switches = 0; for (curmem = 0; curmem < ARRAY_LENGTH(global_profiler.data); curmem++) switches += global_profiler.data[curmem].context_switches; astring_catprintf(string, "%d CPU switches\n", switches / (int) ARRAY_LENGTH(global_profiler.data)); } /* advance to the next dataset and reset it to 0 */ global_profiler.dataindex = (global_profiler.dataindex + 1) % ARRAY_LENGTH(global_profiler.data); memset(&global_profiler.data[global_profiler.dataindex], 0, sizeof(global_profiler.data[global_profiler.dataindex])); /* we are ready once we have wrapped around */ if (global_profiler.dataindex == 0) global_profiler.dataready = TRUE; out: profiler_mark_end(); return string; }
astring *image_info_astring(running_machine &machine, astring *string) { device_image_interface *image = NULL; astring_printf(string, "%s\n\n", machine.system().description); #if 0 if (mess_ram_size > 0) { char buf2[RAM_STRING_BUFLEN]; astring_catprintf(string, "RAM: %s\n\n", ram_string(buf2, mess_ram_size)); } #endif for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image)) { const char *name = image->filename(); if (name != NULL) { const char *base_filename; const char *info; char *base_filename_noextension; base_filename = image->basename(); base_filename_noextension = strip_extension(base_filename); /* display device type and filename */ astring_catprintf(string, "%s: %s\n", image->device().name(), base_filename); /* display long filename, if present and doesn't correspond to name */ info = image->longname(); if (info && (!base_filename_noextension || mame_stricmp(info, base_filename_noextension))) astring_catprintf(string, "%s\n", info); /* display manufacturer, if available */ info = image->manufacturer(); if (info != NULL) { astring_catprintf(string, "%s", info); info = stripspace(image->year()); if (info && *info) astring_catprintf(string, ", %s", info); astring_catprintf(string,"\n"); } /* display supported information, if available */ switch(image->supported()) { case SOFTWARE_SUPPORTED_NO : astring_catprintf(string, "Not supported\n"); break; case SOFTWARE_SUPPORTED_PARTIAL : astring_catprintf(string, "Partialy supported\n"); break; default : break; } if (base_filename_noextension != NULL) free(base_filename_noextension); } else { astring_catprintf(string, "%s: ---\n", image->device().name()); } } return string; }