mirror of
https://github.com/holub/mame
synced 2025-05-18 11:39:29 +03:00
Added some profiling code for discrete tasks
This commit is contained in:
parent
b2edb79562
commit
cbb4decb5d
@ -106,19 +106,31 @@ struct _task_info
|
|||||||
INLINE void step_nodes_in_list(linked_list_entry **list)
|
INLINE void step_nodes_in_list(linked_list_entry **list)
|
||||||
{
|
{
|
||||||
linked_list_entry *entry;
|
linked_list_entry *entry;
|
||||||
|
|
||||||
|
if (DISCRETE_PROFILING)
|
||||||
|
{
|
||||||
|
osd_ticks_t last = osd_profiling_ticks();
|
||||||
|
|
||||||
|
for (entry = *list; entry != NULL; entry = entry->next)
|
||||||
|
{
|
||||||
|
node_description *node = (node_description *) entry->ptr;
|
||||||
|
|
||||||
|
node->run_time -= last;
|
||||||
|
(*node->module->step)(node);
|
||||||
|
last = osd_profiling_ticks();
|
||||||
|
node->run_time += last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (entry = *list; entry != NULL; entry = entry->next)
|
for (entry = *list; entry != NULL; entry = entry->next)
|
||||||
{
|
{
|
||||||
node_description *node = (node_description *) entry->ptr;
|
node_description *node = (node_description *) entry->ptr;
|
||||||
|
|
||||||
/* Now step the node */
|
/* Now step the node */
|
||||||
if (DISCRETE_PROFILING)
|
|
||||||
node->run_time -= osd_profiling_ticks();
|
|
||||||
|
|
||||||
(*node->module->step)(node);
|
(*node->module->step)(node);
|
||||||
//bigselect(info->device, node);
|
//bigselect(info->device, node);
|
||||||
|
}
|
||||||
if (DISCRETE_PROFILING)
|
|
||||||
node->run_time += osd_profiling_ticks();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,6 +550,20 @@ static DEVICE_START( discrete )
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
|
static osd_ticks_t task_run_time(linked_list_entry *list)
|
||||||
|
{
|
||||||
|
linked_list_entry *entry;
|
||||||
|
osd_ticks_t total = 0;
|
||||||
|
|
||||||
|
for (entry = list; entry != NULL; entry = entry->next)
|
||||||
|
{
|
||||||
|
node_description *node = (node_description *) entry->ptr;
|
||||||
|
|
||||||
|
total += node->run_time;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
static DEVICE_STOP( discrete )
|
static DEVICE_STOP( discrete )
|
||||||
{
|
{
|
||||||
discrete_info *info = get_safe_token(device);
|
discrete_info *info = get_safe_token(device);
|
||||||
@ -551,9 +577,10 @@ static DEVICE_STOP( discrete )
|
|||||||
linked_list_entry *entry;
|
linked_list_entry *entry;
|
||||||
osd_ticks_t total = 0;
|
osd_ticks_t total = 0;
|
||||||
osd_ticks_t tresh;
|
osd_ticks_t tresh;
|
||||||
|
double tt;
|
||||||
|
|
||||||
/* calculate total time */
|
/* calculate total time */
|
||||||
for (entry = info->step_list; entry != NULL; entry = entry->next)
|
for (entry = info->node_list; entry != NULL; entry = entry->next)
|
||||||
{
|
{
|
||||||
node_description *node = (node_description *) entry->ptr;
|
node_description *node = (node_description *) entry->ptr;
|
||||||
|
|
||||||
@ -564,13 +591,26 @@ static DEVICE_STOP( discrete )
|
|||||||
/* print statistics */
|
/* print statistics */
|
||||||
printf("Total Samples: %d\n", info->total_samples);
|
printf("Total Samples: %d\n", info->total_samples);
|
||||||
tresh = total / count;
|
tresh = total / count;
|
||||||
for (entry = info->step_list; entry != NULL; entry = entry->next)
|
for (entry = info->node_list; entry != NULL; entry = entry->next)
|
||||||
{
|
{
|
||||||
node_description *node = (node_description *) entry->ptr;
|
node_description *node = (node_description *) entry->ptr;
|
||||||
|
|
||||||
if (node->run_time > tresh)
|
if (node->run_time > tresh)
|
||||||
printf("%3d: %20s %8.2f %10d\n", NODE_INDEX(node->node), node->module->name, (float) node->run_time / (float) total * 100.0, ((int) node->run_time) / info->total_samples);
|
printf("%3d: %20s %8.2f %10.2f\n", NODE_INDEX(node->node), node->module->name, (float) node->run_time / (float) total * 100.0, ((float) node->run_time) / (float) info->total_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Task information */
|
||||||
|
for (entry = info->task_list; entry != 0; entry = entry->next)
|
||||||
|
{
|
||||||
|
discrete_task_context *task = (discrete_task_context *) entry->ptr;
|
||||||
|
tt = task_run_time(task->list);
|
||||||
|
|
||||||
|
printf("Task: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
|
||||||
|
}
|
||||||
|
tt = task_run_time(info->step_list);
|
||||||
|
|
||||||
|
printf("Main: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close any csv files */
|
/* close any csv files */
|
||||||
@ -767,7 +807,7 @@ INLINE void discrete_stream_update_nodes(discrete_info *info)
|
|||||||
discrete_task_context *task = (discrete_task_context *) entry->ptr;
|
discrete_task_context *task = (discrete_task_context *) entry->ptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < task->numbuffered; i++)
|
for (i = task->numbuffered - 1; i >= 0 ; i--)
|
||||||
**task->dest[i] = *task->ptr[i]++;
|
**task->dest[i] = *task->ptr[i]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,8 +956,11 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < task->numbuffered; i++)
|
for (i = 0; i < task->numbuffered; i++)
|
||||||
|
{
|
||||||
|
task->node_buf[i] = auto_alloc_array(info->device->machine, double, 2048);
|
||||||
task->dest[i] = (double **) &node->input[i];
|
task->dest[i] = (double **) &node->input[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
node->context = task;
|
node->context = task;
|
||||||
task = NULL;
|
task = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -3380,6 +3380,7 @@
|
|||||||
#define DISCRETE_MAX_WAVELOGS 10
|
#define DISCRETE_MAX_WAVELOGS 10
|
||||||
#define DISCRETE_MAX_CSVLOGS 10
|
#define DISCRETE_MAX_CSVLOGS 10
|
||||||
#define DISCRETE_MAX_OUTPUTS 8
|
#define DISCRETE_MAX_OUTPUTS 8
|
||||||
|
#define DISCRETE_MAX_TASK_OUTPUTS 5
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@ -3670,9 +3671,10 @@ struct _discrete_task_context
|
|||||||
linked_list_entry *list;
|
linked_list_entry *list;
|
||||||
|
|
||||||
int numbuffered;
|
int numbuffered;
|
||||||
double *ptr[5];
|
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
double node_buf[5][2048];
|
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
double **dest[5];
|
double **dest[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _discrete_info
|
struct _discrete_info
|
||||||
|
Loading…
Reference in New Issue
Block a user