summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-09-06 23:30:26 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-09-06 23:30:26 +0000
commitf60bbef0707457417c73569c6f24851601692248 (patch)
tree7e8ac34521b14f41d9b4dc7e5afbdb2109dfbe8d /src
parentc01df88b6dd6d75bdeb432288336b59404e7c734 (diff)
Rename osd_profiling_ticks() to get_profile_ticks(). Moved implemention into
inline functions in eminline.h and the ei* functions. [couriersud, Aaron Giles]
Diffstat (limited to 'src')
-rw-r--r--src/emu/eigccppc.h20
-rw-r--r--src/emu/eigccx86.h24
-rw-r--r--src/emu/eminline.h20
-rw-r--r--src/emu/profiler.c4
-rw-r--r--src/emu/sound/discrete.c4
-rw-r--r--src/emu/validity.c46
-rw-r--r--src/emu/video/poly.c4
-rw-r--r--src/osd/osdcore.h30
-rw-r--r--src/osd/osdmini/minitime.c4
-rw-r--r--src/osd/windows/eivcx86.h41
-rw-r--r--src/osd/windows/wintime.c50
-rw-r--r--src/osd/windows/winwork.c4
12 files changed, 138 insertions, 113 deletions
diff --git a/src/emu/eigccppc.h b/src/emu/eigccppc.h
index 31814a23e72..268853cce55 100644
--- a/src/emu/eigccppc.h
+++ b/src/emu/eigccppc.h
@@ -470,4 +470,24 @@ _atomic_decrement32(INT32 volatile *ptr)
return result;
}
+
+
+/***************************************************************************
+ INLINE TIMING FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
+ get_profile_ticks - return a tick counter
+ from the processor that can be used for
+ profiling. It does not need to run at any
+ particular rate.
+-------------------------------------------------*/
+
+#define get_profile_ticks _get_profile_ticks
+INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
+{
+ // fix me - should use the time base
+ return osd_ticks();
+}
+
#endif /* __EIGCCPPC__ */
diff --git a/src/emu/eigccx86.h b/src/emu/eigccx86.h
index 4be2f3ee474..2d9107c55d8 100644
--- a/src/emu/eigccx86.h
+++ b/src/emu/eigccx86.h
@@ -644,4 +644,28 @@ _atomic_decrement32(INT32 volatile *ptr)
return result - 1;
}
+
+
+/***************************************************************************
+ INLINE TIMING FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
+ get_profile_ticks - return a tick counter
+ from the processor that can be used for
+ profiling. It does not need to run at any
+ particular rate.
+-------------------------------------------------*/
+
+#define get_profile_ticks _get_profile_ticks
+INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
+{
+ UINT64 result;
+ __asm__ __volatile__ (
+ "rdtsc"
+ : "=A" (result)
+ );
+ return (INT64) (result & U64(0x7fffffffffffffff));
+}
+
#endif /* __EIGCCX86__ */
diff --git a/src/emu/eminline.h b/src/emu/eminline.h
index 2cfb99013dd..67b1f34db18 100644
--- a/src/emu/eminline.h
+++ b/src/emu/eminline.h
@@ -430,4 +430,24 @@ INLINE INT32 atomic_decrement32(INT32 volatile *ptr)
}
#endif
+
+
+/***************************************************************************
+ INLINE TIMING FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
+ get_profile_ticks - return a tick counter
+ from the processor that can be used for
+ profiling. It does not need to run at any
+ particular rate.
+-------------------------------------------------*/
+
+#ifndef get_profile_ticks
+INLINE INT64 get_profile_ticks(void)
+{
+ return osd_ticks();
+}
+#endif
+
#endif /* __EMINLINE__ */
diff --git a/src/emu/profiler.c b/src/emu/profiler.c
index fe44e5ccf03..7ade648e243 100644
--- a/src/emu/profiler.c
+++ b/src/emu/profiler.c
@@ -48,7 +48,7 @@ profiler_state global_profiler;
void _profiler_mark_start(int type)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
- osd_ticks_t curticks = osd_profiling_ticks();
+ osd_ticks_t curticks = get_profile_ticks();
profiler_filo_entry *entry;
int index;
@@ -85,7 +85,7 @@ void _profiler_mark_start(int type)
void _profiler_mark_end(void)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
- osd_ticks_t curticks = osd_profiling_ticks();
+ osd_ticks_t curticks = get_profile_ticks();
/* we're ending an existing bucket, update the time */
if (global_profiler.filoindex > 0)
diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c
index 4c52d9a2a45..fe3388a9682 100644
--- a/src/emu/sound/discrete.c
+++ b/src/emu/sound/discrete.c
@@ -293,7 +293,7 @@ INLINE void step_nodes_in_list(const linked_list_entry *list)
if (DISCRETE_PROFILING)
{
- osd_ticks_t last = osd_profiling_ticks();
+ osd_ticks_t last = get_profile_ticks();
for (entry = list; entry != NULL; entry = entry->next)
{
@@ -301,7 +301,7 @@ INLINE void step_nodes_in_list(const linked_list_entry *list)
node->run_time -= last;
(*node->module->step)(node);
- last = osd_profiling_ticks();
+ last = get_profile_ticks();
node->run_time += last;
}
}
diff --git a/src/emu/validity.c b/src/emu/validity.c
index 8438c4f9a6a..9dac3653b0a 100644
--- a/src/emu/validity.c
+++ b/src/emu/validity.c
@@ -1648,12 +1648,12 @@ int mame_validitychecks(const game_driver *curdriver)
init_resource_tracking();
begin_resource_tracking();
- osd_profiling_ticks();
+ get_profile_ticks();
/* prepare by pre-scanning all the drivers and adding their info to hash tables */
- prep -= osd_profiling_ticks();
+ prep -= get_profile_ticks();
quark_tables_create(&tables);
- prep += osd_profiling_ticks();
+ prep += get_profile_ticks();
/* iterate over all drivers */
for (drivnum = 0; drivers[drivnum]; drivnum++)
@@ -1670,49 +1670,49 @@ int mame_validitychecks(const game_driver *curdriver)
memset(&rgninfo, 0, sizeof(rgninfo));
/* expand the machine driver */
- expansion -= osd_profiling_ticks();
+ expansion -= get_profile_ticks();
config = machine_config_alloc(driver->machine_config);
- expansion += osd_profiling_ticks();
+ expansion += get_profile_ticks();
/* validate the driver entry */
- driver_checks -= osd_profiling_ticks();
+ driver_checks -= get_profile_ticks();
error = validate_driver(drivnum, config, &tables) || error;
- driver_checks += osd_profiling_ticks();
+ driver_checks += get_profile_ticks();
/* validate the ROM information */
- rom_checks -= osd_profiling_ticks();
+ rom_checks -= get_profile_ticks();
error = validate_roms(drivnum, config, &rgninfo) || error;
- rom_checks += osd_profiling_ticks();
+ rom_checks += get_profile_ticks();
/* validate input ports */
- input_checks -= osd_profiling_ticks();
+ input_checks -= get_profile_ticks();
error = validate_inputs(drivnum, config, tables.defstr, &portlist) || error;
- input_checks += osd_profiling_ticks();
+ input_checks += get_profile_ticks();
/* validate the CPU information */
- cpu_checks -= osd_profiling_ticks();
+ cpu_checks -= get_profile_ticks();
error = validate_cpu(drivnum, config) || error;
- cpu_checks += osd_profiling_ticks();
+ cpu_checks += get_profile_ticks();
/* validate the display */
- display_checks -= osd_profiling_ticks();
+ display_checks -= get_profile_ticks();
error = validate_display(drivnum, config) || error;
- display_checks += osd_profiling_ticks();
+ display_checks += get_profile_ticks();
/* validate the graphics decoding */
- gfx_checks -= osd_profiling_ticks();
+ gfx_checks -= get_profile_ticks();
error = validate_gfx(drivnum, config, &rgninfo) || error;
- gfx_checks += osd_profiling_ticks();
+ gfx_checks += get_profile_ticks();
/* validate sounds and speakers */
- sound_checks -= osd_profiling_ticks();
+ sound_checks -= get_profile_ticks();
error = validate_sound(drivnum, config) || error;
- sound_checks += osd_profiling_ticks();
+ sound_checks += get_profile_ticks();
/* validate devices */
- device_checks -= osd_profiling_ticks();
+ device_checks -= get_profile_ticks();
error = validate_devices(drivnum, config, portlist, &rgninfo) || error;
- device_checks += osd_profiling_ticks();
+ device_checks += get_profile_ticks();
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo.entries); rgnnum++)
if (rgninfo.entries[rgnnum].tag != NULL)
@@ -1723,10 +1723,10 @@ int mame_validitychecks(const game_driver *curdriver)
}
#ifdef MESS
- mess_checks -= osd_profiling_ticks();
+ mess_checks -= get_profile_ticks();
if (mess_validitychecks())
error = TRUE;
- mess_checks += osd_profiling_ticks();
+ mess_checks += get_profile_ticks();
#endif /* MESS */
#if (REPORT_TIMES)
diff --git a/src/emu/video/poly.c b/src/emu/video/poly.c
index 9e658218828..6d46061b83a 100644
--- a/src/emu/video/poly.c
+++ b/src/emu/video/poly.c
@@ -421,7 +421,7 @@ void poly_wait(poly_manager *poly, const char *debug_reason)
/* remember the start time if we're logging */
if (LOG_WAITS)
- time = osd_profiling_ticks();
+ time = get_profile_ticks();
/* wait for all pending work items to complete */
if (poly->queue != NULL)
@@ -438,7 +438,7 @@ void poly_wait(poly_manager *poly, const char *debug_reason)
/* log any long waits */
if (LOG_WAITS)
{
- time = osd_profiling_ticks() - time;
+ time = get_profile_ticks() - time;
if (time > LOG_WAIT_THRESHOLD)
logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason);
}
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index dd3fee57890..9665bb1d4a0 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -352,7 +352,6 @@ typedef INT64 osd_ticks_t;
-----------------------------------------------------------------------------*/
osd_ticks_t osd_ticks(void);
-
/*-----------------------------------------------------------------------------
osd_ticks_per_second: return the number of ticks per second
@@ -367,35 +366,6 @@ osd_ticks_t osd_ticks(void);
-----------------------------------------------------------------------------*/
osd_ticks_t osd_ticks_per_second(void);
-
-/*-----------------------------------------------------------------------------
- osd_profiling_ticks: return the current running "profiling" tick counter
-
- Parameters:
-
- None
-
- Return value:
-
- an osd_ticks_t value which represents the current "profiling" tick
- counter
-
- Notes:
-
- The profiling tick counter may or may not be different from the
- regular tick counter. However, the profiling counter has differing
- requirements. First, it must be as fast as possible, so as not to
- perturb profiling measurements in a significant way. Second, it
- should be a high resolution as possible to provide accurate short-
- term measurements (1us resolution or better is ideal). Third, it
- is not necessary to calibrate the timing (hence the lack of an
- osd_profiling_ticks_per_second call).
-
- On x86 system, this generally maps to an RDTSC instruction.
------------------------------------------------------------------------------*/
-osd_ticks_t osd_profiling_ticks(void);
-
-
/*-----------------------------------------------------------------------------
osd_sleep: sleep for the specified time interval
diff --git a/src/osd/osdmini/minitime.c b/src/osd/osdmini/minitime.c
index 4fd7d05d55d..4b11fe172de 100644
--- a/src/osd/osdmini/minitime.c
+++ b/src/osd/osdmini/minitime.c
@@ -34,10 +34,10 @@ osd_ticks_t osd_ticks_per_second(void)
//============================================================
-// osd_profiling_ticks
+// get_profile_ticks
//============================================================
-osd_ticks_t osd_profiling_ticks(void)
+osd_ticks_t get_profile_ticks(void)
{
// on x86 platforms, we should return the value of RDTSC here
// generically, we fall back to clock(), which hopefully is
diff --git a/src/osd/windows/eivcx86.h b/src/osd/windows/eivcx86.h
index fad82b60227..0a2184bb5e7 100644
--- a/src/osd/windows/eivcx86.h
+++ b/src/osd/windows/eivcx86.h
@@ -460,4 +460,45 @@ INLINE UINT8 _count_leading_ones(UINT32 value)
}
#endif
+
+
+/***************************************************************************
+ INLINE TIMING FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
+ get_profile_ticks - return a tick counter
+ from the processor that can be used for
+ profiling. It does not need to run at any
+ particular rate.
+-------------------------------------------------*/
+
+#define get_profile_ticks _get_profile_ticks
+
+#ifdef PTR64
+
+INLINE osd_ticks_t _get_profile_ticks(void)
+{
+ return __rdtsc();
+}
+
+#else
+
+INLINE osd_ticks_t _get_profile_ticks(void)
+{
+ INT64 result;
+ INT64 *presult = &result;
+
+ __asm {
+ __asm _emit 0Fh __asm _emit 031h // rdtsc
+ mov ebx, presult
+ mov [ebx],eax
+ mov [ebx+4],edx
+ }
+
+ return result;
+}
+
+#endif
+
#endif /* __EIVCX86__ */
diff --git a/src/osd/windows/wintime.c b/src/osd/windows/wintime.c
index 9c0de54a22d..28eb2b0ed27 100644
--- a/src/osd/windows/wintime.c
+++ b/src/osd/windows/wintime.c
@@ -77,56 +77,6 @@ osd_ticks_t osd_ticks_per_second(void)
//============================================================
-// osd_profiling_ticks
-//============================================================
-
-#ifdef _MSC_VER
-
-#ifdef PTR64
-
-osd_ticks_t osd_profiling_ticks(void)
-{
- return __rdtsc();
-}
-
-#else
-
-osd_ticks_t osd_profiling_ticks(void)
-{
- INT64 result;
- INT64 *presult = &result;
-
- __asm {
- __asm _emit 0Fh __asm _emit 031h // rdtsc
- mov ebx, presult
- mov [ebx],eax
- mov [ebx+4],edx
- }
-
- return result;
-}
-
-#endif
-
-#else
-
-osd_ticks_t osd_profiling_ticks(void)
-{
- INT64 result;
-
- // use RDTSC
- __asm__ __volatile__ (
- "rdtsc"
- : "=A" (result)
- );
-
- return result;
-}
-
-#endif
-
-
-//============================================================
// osd_sleep
//============================================================
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 4b81ad802bf..dcad121da63 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -44,8 +44,8 @@
#if KEEP_STATISTICS
#define add_to_stat(v,x) do { interlocked_add((v), (x)); } while (0)
-#define begin_timing(v) do { (v) -= osd_profiling_ticks(); } while (0)
-#define end_timing(v) do { (v) += osd_profiling_ticks(); } while (0)
+#define begin_timing(v) do { (v) -= get_profile_ticks(); } while (0)
+#define end_timing(v) do { (v) += get_profile_ticks(); } while (0)
#else
#define add_to_stat(v,x) do { } while (0)
#define begin_timing(v) do { } while (0)