mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
Promote osd_getenv from osdlib.h to osdcore.h. Change return type to
"const char*". Fixes netlist compile.
This commit is contained in:
parent
7d8546a111
commit
fed05b1e86
@ -21,7 +21,13 @@ public:
|
|||||||
, m_lp_fact(0)
|
, m_lp_fact(0)
|
||||||
, m_gs_fail(0)
|
, m_gs_fail(0)
|
||||||
, m_gs_total(0)
|
, m_gs_total(0)
|
||||||
{}
|
{
|
||||||
|
const char *p = osd_getenv("NETLIST_STATS");
|
||||||
|
if (p != NULL)
|
||||||
|
m_log_stats = (bool) atoi(p);
|
||||||
|
else
|
||||||
|
m_log_stats = false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~netlist_matrix_solver_gauss_seidel_t() {}
|
virtual ~netlist_matrix_solver_gauss_seidel_t() {}
|
||||||
|
|
||||||
@ -35,6 +41,7 @@ private:
|
|||||||
nl_double m_lp_fact;
|
nl_double m_lp_fact;
|
||||||
int m_gs_fail;
|
int m_gs_fail;
|
||||||
int m_gs_total;
|
int m_gs_total;
|
||||||
|
bool m_log_stats;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,22 +52,21 @@ private:
|
|||||||
template <int m_N, int _storage_N>
|
template <int m_N, int _storage_N>
|
||||||
void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
|
void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
|
||||||
{
|
{
|
||||||
#if 1
|
if (this->m_stat_calculations != 0 && m_log_stats)
|
||||||
if (this->m_stat_calculations == 0)
|
{
|
||||||
return;
|
printf("==============================================\n");
|
||||||
printf("==============================================\n");
|
printf("Solver %s\n", this->name().cstr());
|
||||||
printf("Solver %s\n", this->name().cstr());
|
printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
|
||||||
printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
|
printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
|
||||||
printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
|
printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
|
||||||
printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
|
printf(" %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
|
||||||
printf(" %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
|
printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n",
|
||||||
printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n",
|
this->m_stat_calculations,
|
||||||
this->m_stat_calculations,
|
this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
|
||||||
this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
|
this->m_gs_fail,
|
||||||
this->m_gs_fail,
|
100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
|
||||||
100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
|
(double) this->m_gs_total / (double) this->m_stat_calculations);
|
||||||
(double) this->m_gs_total / (double) this->m_stat_calculations);
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int m_N, int _storage_N>
|
template <int m_N, int _storage_N>
|
||||||
|
@ -46,19 +46,6 @@ int osd_get_num_processors(void);
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
void osd_process_kill(void);
|
void osd_process_kill(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_getenv: return pointer to environment variable
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
name - name of environment variable
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
pointer to value
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
char *osd_getenv(const char *name);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
osd_setenv: set environment variable
|
osd_setenv: set environment variable
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
// osd_getenv
|
// osd_getenv
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
char *osd_getenv(const char *name)
|
const char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
// osd_getenv
|
// osd_getenv
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
char *osd_getenv(const char *name)
|
const char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
// osd_getenv
|
// osd_getenv
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
char *osd_getenv(const char *name)
|
const char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ void (*s_debugger_stack_crawler)() = NULL;
|
|||||||
// osd_getenv
|
// osd_getenv
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
char *osd_getenv(const char *name)
|
const char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
|
|||||||
osd_work_queue *queue;
|
osd_work_queue *queue;
|
||||||
int osdthreadnum = 0;
|
int osdthreadnum = 0;
|
||||||
int allocthreadnum;
|
int allocthreadnum;
|
||||||
char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
|
const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
|
||||||
|
|
||||||
// allocate a new queue
|
// allocate a new queue
|
||||||
queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
|
queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
|
||||||
@ -612,12 +612,11 @@ static int effective_num_processors(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *procsoverride;
|
|
||||||
int numprocs = 0;
|
int numprocs = 0;
|
||||||
|
|
||||||
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
||||||
// note that we permit more than the real number of processors for testing
|
// note that we permit more than the real number of processors for testing
|
||||||
procsoverride = osd_getenv(ENV_PROCESSORS);
|
const char *procsoverride = osd_getenv(ENV_PROCESSORS);
|
||||||
if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
|
if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
|
||||||
return MIN(4 * physprocs, numprocs);
|
return MIN(4 * physprocs, numprocs);
|
||||||
|
|
||||||
|
@ -195,6 +195,20 @@ file_error osd_truncate(osd_file *file, UINT64 offset);
|
|||||||
file_error osd_rmfile(const char *filename);
|
file_error osd_rmfile(const char *filename);
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------
|
||||||
|
osd_getenv: return pointer to environment variable
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
name - name of environment variable
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
|
||||||
|
pointer to value
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
const char *osd_getenv(const char *name);
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
osd_get_physical_drive_geometry: if the given path points to a physical
|
osd_get_physical_drive_geometry: if the given path points to a physical
|
||||||
drive, return the geometry of that drive
|
drive, return the geometry of that drive
|
||||||
|
@ -152,7 +152,7 @@ osd_directory *osd_opendir(const char *dirname)
|
|||||||
|
|
||||||
if (tmpstr[0] == '$')
|
if (tmpstr[0] == '$')
|
||||||
{
|
{
|
||||||
char *envval;
|
|
||||||
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
|
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
|
||||||
|
|
||||||
strcpy(envstr, tmpstr);
|
strcpy(envstr, tmpstr);
|
||||||
@ -165,7 +165,7 @@ osd_directory *osd_opendir(const char *dirname)
|
|||||||
|
|
||||||
envstr[i] = '\0';
|
envstr[i] = '\0';
|
||||||
|
|
||||||
envval = osd_getenv(&envstr[1]);
|
const char *envval = osd_getenv(&envstr[1]);
|
||||||
if (envval != NULL)
|
if (envval != NULL)
|
||||||
{
|
{
|
||||||
j = strlen(envval) + strlen(tmpstr) + 1;
|
j = strlen(envval) + strlen(tmpstr) + 1;
|
||||||
|
@ -176,7 +176,6 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
// does path start with an environment variable?
|
// does path start with an environment variable?
|
||||||
if (tmpstr[0] == '$')
|
if (tmpstr[0] == '$')
|
||||||
{
|
{
|
||||||
char *envval;
|
|
||||||
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
|
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
|
||||||
|
|
||||||
strcpy(envstr, tmpstr);
|
strcpy(envstr, tmpstr);
|
||||||
@ -189,7 +188,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
|
|
||||||
envstr[i] = '\0';
|
envstr[i] = '\0';
|
||||||
|
|
||||||
envval = osd_getenv(&envstr[1]);
|
const char *envval = osd_getenv(&envstr[1]);
|
||||||
if (envval != NULL)
|
if (envval != NULL)
|
||||||
{
|
{
|
||||||
j = strlen(envval) + strlen(tmpstr) + 1;
|
j = strlen(envval) + strlen(tmpstr) + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user