summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-10-25 05:08:04 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-10-25 05:08:04 +0000
commita7d62ae961d34e21dcf21c4f746c6435e27d0aab (patch)
treed8cab47fa7d307cca30d1d59f4f4df1def0066e8
parentc96cde525f2a163313939bb10bf36ed0f792343b (diff)
> -----Original Message-----
> From: Christophe Jaillet [mailto:christophe.jaillet@wanadoo.fr] > Sent: Saturday, October 17, 2009 9:02 AM > To: submit@mamedev.org > Subject: Correct 3 unbalanced calls to 'profiler_mark_start' and > improve warning message > > Hi, > > while profiling the game 'silentd', I found some 'FILO overflow' > warning. > > This was linked to 2 different unbalanced 'profiler_mark_start' calls. > > The attached patch does the folowing : > - add a missing 'profiler_mark_end' call in 'drawgfxm.h' > - add a missing 'profiler_mark_end' call in 'video/taito_b.c'. I > think > that this one could probably be completely removed > - add a missing 'profiler_mark_end' call in 'profiler.c'. This one > is > very unlikely to happen. This has been done by rearranging a bit the > code in > order to have only one exit in the function > - add more information about the likely type of profiling data that > has > made the fifo overflow. (This is that information that has help me find > the > two first issues). > > Hope this help. > Best regards, > > CJ
-rw-r--r--src/emu/drawgfxm.h3
-rw-r--r--src/emu/profiler.c9
-rw-r--r--src/mame/video/taito_b.c6
3 files changed, 13 insertions, 5 deletions
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h
index 8f79412527e..e95fcc800e0 100644
--- a/src/emu/drawgfxm.h
+++ b/src/emu/drawgfxm.h
@@ -701,7 +701,10 @@ do { \
/* compute final pixel in Y and exit if we are entirely clipped */ \
destendy = desty + dstheight - 1; \
if (desty > cliprect->max_y || destendy < cliprect->min_y) \
+ { \
+ profiler_mark_end(); \
return; \
+ } \
\
/* apply top clip */ \
srcy = 0; \
diff --git a/src/emu/profiler.c b/src/emu/profiler.c
index a4f6fb9c45c..a54867e547f 100644
--- a/src/emu/profiler.c
+++ b/src/emu/profiler.c
@@ -62,7 +62,7 @@ void _profiler_mark_start(int type)
/* fail if we overflow */
if (index > ARRAY_LENGTH(global_profiler.filo))
- fatalerror("Profiler FILO overflow\n");
+ fatalerror("Profiler FILO overflow (type = %d)\n", type);
/* if we're nested, stop the previous entry */
if (index > 0)
@@ -162,7 +162,7 @@ astring *_profiler_get_text(running_machine *machine, astring *string)
total = computed;
astring_reset(string);
if (total == 0 || normalize == 0)
- return string;
+ goto out;
/* loop over all types and generate the string */
for (curtype = 0; curtype < PROFILER_TOTAL; curtype++)
@@ -209,8 +209,6 @@ astring *_profiler_get_text(running_machine *machine, astring *string)
astring_catprintf(string, "%d CPU switches\n", switches / (int) ARRAY_LENGTH(global_profiler.data));
}
- profiler_mark_end();
-
/* 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]));
@@ -219,5 +217,8 @@ astring *_profiler_get_text(running_machine *machine, astring *string)
if (global_profiler.dataindex == 0)
global_profiler.dataready = TRUE;
+out:
+ profiler_mark_end();
+
return string;
}
diff --git a/src/mame/video/taito_b.c b/src/mame/video/taito_b.c
index 671b4be27f2..f57cda4cb46 100644
--- a/src/mame/video/taito_b.c
+++ b/src/mame/video/taito_b.c
@@ -503,7 +503,11 @@ profiler_mark_start(PROFILER_USER1);
if (video_control & 0x08)
{
- if (priority) return;
+ if (priority)
+ {
+ profiler_mark_end();
+ return;
+ }
if (video_control & 0x10) /*flip screen*/
{