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:
Couriersud 2008-08-06 19:31:39 +00:00
parent fa04fe6355
commit c81b2cb24d
2 changed files with 45 additions and 1 deletions

View File

@ -51,7 +51,6 @@
#define DISCRETE_DEBUGLOG (0) #define DISCRETE_DEBUGLOG (0)
/************************************* /*************************************
* *
* Global variables * Global variables
@ -374,6 +373,34 @@ static void discrete_stop(void *chip)
discrete_info *info = chip; discrete_info *info = chip;
int log_num; 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 */ /* close any csv files */
for (log_num = 0; log_num < info->num_csvlogs; log_num++) for (log_num = 0; log_num < info->num_csvlogs; log_num++)
if (info->disc_csv_file[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]; node_description *node = info->running_order[nodenum];
/* Now step the node */ /* Now step the node */
#if (DISCRETE_PROFILING)
node->run_time -= osd_profiling_ticks();
#endif
if (node->module.step) if (node->module.step)
(*node->module.step)(node); (*node->module.step)(node);
#if (DISCRETE_PROFILING)
node->run_time += osd_profiling_ticks();
#endif
} }
/* Add gain to the output and put into the buffers */ /* Add gain to the output and put into the buffers */

View File

@ -3150,6 +3150,14 @@
************************************************************************/ ************************************************************************/
/*************************************
*
* Profiling Nodes
*
*************************************/
#define DISCRETE_PROFILING (0)
/************************************* /*************************************
* *
* Core constants * Core constants
@ -3421,6 +3429,9 @@ struct _node_description
void * context; /* Contextual information specific to this node type */ void * context; /* Contextual information specific to this node type */
const char * name; /* Text name string for identification/debug */ const char * name; /* Text name string for identification/debug */
const void * custom; /* Custom function specific initialisation data */ const void * custom; /* Custom function specific initialisation data */
#if (DISCRETE_PROFILING)
osd_ticks_t run_time;
#endif
}; };