mirror of
https://github.com/holub/mame
synced 2025-05-06 22:35:43 +03:00
Added module profiling to discrete sound core
* added DISCRETE_PROFILING macro to discrete.h * Upon discrete_stop, the worst performing modules will be listed
This commit is contained in:
parent
fa04fe6355
commit
c81b2cb24d
@ -51,7 +51,6 @@
|
||||
#define DISCRETE_DEBUGLOG (0)
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Global variables
|
||||
@ -374,6 +373,34 @@ static void discrete_stop(void *chip)
|
||||
discrete_info *info = chip;
|
||||
int log_num;
|
||||
|
||||
#if (DISCRETE_PROFILING)
|
||||
{
|
||||
int nodenum;
|
||||
osd_ticks_t total = 0;
|
||||
osd_ticks_t tresh;
|
||||
|
||||
/* calculate total time */
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
{
|
||||
node_description *node = info->running_order[nodenum];
|
||||
|
||||
/* Now step the node */
|
||||
total += node->run_time;
|
||||
}
|
||||
/* print statistics */
|
||||
tresh = total / info->node_count;
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
{
|
||||
node_description *node = info->running_order[nodenum];
|
||||
|
||||
if (node->run_time > tresh)
|
||||
printf("%3d: %20s %8.2f\n", NODE_INDEX(node->node), node->module.name, (float) node->run_time / (float) total * 100.0);
|
||||
/* Now step the node */
|
||||
total += node->run_time;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* close any csv files */
|
||||
for (log_num = 0; log_num < info->num_csvlogs; log_num++)
|
||||
if (info->disc_csv_file[log_num])
|
||||
@ -459,8 +486,14 @@ static void discrete_stream_update(void *param, stream_sample_t **inputs, stream
|
||||
node_description *node = info->running_order[nodenum];
|
||||
|
||||
/* Now step the node */
|
||||
#if (DISCRETE_PROFILING)
|
||||
node->run_time -= osd_profiling_ticks();
|
||||
#endif
|
||||
if (node->module.step)
|
||||
(*node->module.step)(node);
|
||||
#if (DISCRETE_PROFILING)
|
||||
node->run_time += osd_profiling_ticks();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Add gain to the output and put into the buffers */
|
||||
|
@ -3150,6 +3150,14 @@
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Profiling Nodes
|
||||
*
|
||||
*************************************/
|
||||
|
||||
#define DISCRETE_PROFILING (0)
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Core constants
|
||||
@ -3421,6 +3429,9 @@ struct _node_description
|
||||
void * context; /* Contextual information specific to this node type */
|
||||
const char * name; /* Text name string for identification/debug */
|
||||
const void * custom; /* Custom function specific initialisation data */
|
||||
#if (DISCRETE_PROFILING)
|
||||
osd_ticks_t run_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user