diff options
author | 2010-01-08 17:18:54 +0000 | |
---|---|---|
committer | 2010-01-08 17:18:54 +0000 | |
commit | a92de5930cef847ffdafd1e6c8e9f2bf03375c39 (patch) | |
tree | e8e5887dfcf861cc77ed1675015267450fc6fc8a /src/emu/profiler.c | |
parent | a0a40f8815e5c16bd2ab8ee333d19bcfe1e6ee55 (diff) |
Extended the astring class wrapper into something useful, and
useable as a stack object. Also designed the interfaces to allow
for chaining operations. And added a casting operator to const
char * for seamless use in most functions that take plain old C
strings.
Changed all uses of astring to use the object directly on the
stack or embedded in objects instead of explicitly allocating
and deallocating it. Removed a lot of annoying memory management
code as a result.
Changed interfaces that accepted/returned an astring * to
use an astring & instead.
Removed auto_alloc_astring(machine). Use
auto_alloc(machine, astring) instead.
Diffstat (limited to 'src/emu/profiler.c')
-rw-r--r-- | src/emu/profiler.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/profiler.c b/src/emu/profiler.c index 0d521e6318c..374afa45478 100644 --- a/src/emu/profiler.c +++ b/src/emu/profiler.c @@ -111,7 +111,7 @@ void _profiler_mark_end(void) in an astring -------------------------------------------------*/ -astring *_profiler_get_text(running_machine *machine, astring *string) +astring &_profiler_get_text(running_machine *machine, astring &string) { static const profile_string names[] = { @@ -161,7 +161,7 @@ astring *_profiler_get_text(running_machine *machine, astring *string) /* this becomes the total; if we end up with 0 for anything, we were just started, so return empty */ total = computed; - astring_reset(string); + string.reset(); if (total == 0 || normalize == 0) goto out; @@ -179,25 +179,25 @@ astring *_profiler_get_text(running_machine *machine, astring *string) int nameindex; /* start with the un-normalized percentage */ - astring_catprintf(string, "%02d%% ", (int)((computed * 100 + total/2) / total)); + string.catprintf("%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)); + string.catprintf("%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); + string.catprintf("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); + string.cat(names[nameindex].string); break; } /* followed by a carriage return */ - astring_catc(string, "\n"); + string.cat("\n"); } } @@ -207,7 +207,7 @@ astring *_profiler_get_text(running_machine *machine, astring *string) 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)); + string.catprintf("%d CPU switches\n", switches / (int) ARRAY_LENGTH(global_profiler.data)); } /* advance to the next dataset and reset it to 0 */ |