summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-01-27 01:43:04 +0100
committer couriersud <couriersud@arcor.de>2015-01-27 01:43:04 +0100
commitfed05b1e86ce772e3ce81dc50b50bd3927510a8f (patch)
tree0aba867de149919b95f67a597153efbbe038d3a6
parent7d8546a111361889aa78b057ac24d614c14cb920 (diff)
Promote osd_getenv from osdlib.h to osdcore.h. Change return type to
"const char*". Fixes netlist compile.
-rw-r--r--src/emu/netlist/analog/nld_ms_gauss_seidel.h40
-rw-r--r--src/osd/modules/lib/osdlib.h13
-rw-r--r--src/osd/modules/lib/osdlib_macosx.c2
-rw-r--r--src/osd/modules/lib/osdlib_os2.c2
-rw-r--r--src/osd/modules/lib/osdlib_unix.c2
-rw-r--r--src/osd/modules/lib/osdlib_win32.c2
-rw-r--r--src/osd/modules/sync/work_osd.c5
-rw-r--r--src/osd/osdcore.h14
-rw-r--r--src/osd/sdl/sdldir.c4
-rw-r--r--src/osd/sdl/sdlfile.c3
10 files changed, 46 insertions, 41 deletions
diff --git a/src/emu/netlist/analog/nld_ms_gauss_seidel.h b/src/emu/netlist/analog/nld_ms_gauss_seidel.h
index d57168a436d..2cc7a8cda3d 100644
--- a/src/emu/netlist/analog/nld_ms_gauss_seidel.h
+++ b/src/emu/netlist/analog/nld_ms_gauss_seidel.h
@@ -21,7 +21,13 @@ public:
, m_lp_fact(0)
, m_gs_fail(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() {}
@@ -35,6 +41,7 @@ private:
nl_double m_lp_fact;
int m_gs_fail;
int m_gs_total;
+ bool m_log_stats;
};
@@ -45,22 +52,21 @@ private:
template <int m_N, int _storage_N>
void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
{
-#if 1
- if (this->m_stat_calculations == 0)
- return;
- printf("==============================================\n");
- printf("Solver %s\n", this->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_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(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n",
- this->m_stat_calculations,
- this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
- this->m_gs_fail,
- 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
- (double) this->m_gs_total / (double) this->m_stat_calculations);
-#endif
+ if (this->m_stat_calculations != 0 && m_log_stats)
+ {
+ printf("==============================================\n");
+ printf("Solver %s\n", this->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_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(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n",
+ this->m_stat_calculations,
+ this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
+ this->m_gs_fail,
+ 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
+ (double) this->m_gs_total / (double) this->m_stat_calculations);
+ }
}
template <int m_N, int _storage_N>
diff --git a/src/osd/modules/lib/osdlib.h b/src/osd/modules/lib/osdlib.h
index f9c364d5464..37f45797436 100644
--- a/src/osd/modules/lib/osdlib.h
+++ b/src/osd/modules/lib/osdlib.h
@@ -47,19 +47,6 @@ int osd_get_num_processors(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
Parameters:
diff --git a/src/osd/modules/lib/osdlib_macosx.c b/src/osd/modules/lib/osdlib_macosx.c
index 65d19562092..5d6233bce25 100644
--- a/src/osd/modules/lib/osdlib_macosx.c
+++ b/src/osd/modules/lib/osdlib_macosx.c
@@ -32,7 +32,7 @@
// osd_getenv
//============================================================
-char *osd_getenv(const char *name)
+const char *osd_getenv(const char *name)
{
return getenv(name);
}
diff --git a/src/osd/modules/lib/osdlib_os2.c b/src/osd/modules/lib/osdlib_os2.c
index 0211401abfa..d852ea5ce93 100644
--- a/src/osd/modules/lib/osdlib_os2.c
+++ b/src/osd/modules/lib/osdlib_os2.c
@@ -29,7 +29,7 @@
// osd_getenv
//============================================================
-char *osd_getenv(const char *name)
+const char *osd_getenv(const char *name)
{
return getenv(name);
}
diff --git a/src/osd/modules/lib/osdlib_unix.c b/src/osd/modules/lib/osdlib_unix.c
index 36a558ae95a..39eed83b918 100644
--- a/src/osd/modules/lib/osdlib_unix.c
+++ b/src/osd/modules/lib/osdlib_unix.c
@@ -28,7 +28,7 @@
// osd_getenv
//============================================================
-char *osd_getenv(const char *name)
+const char *osd_getenv(const char *name)
{
return getenv(name);
}
diff --git a/src/osd/modules/lib/osdlib_win32.c b/src/osd/modules/lib/osdlib_win32.c
index ead90ddd2bc..d59c68d69ce 100644
--- a/src/osd/modules/lib/osdlib_win32.c
+++ b/src/osd/modules/lib/osdlib_win32.c
@@ -47,7 +47,7 @@ void (*s_debugger_stack_crawler)() = NULL;
// osd_getenv
//============================================================
-char *osd_getenv(const char *name)
+const char *osd_getenv(const char *name)
{
return getenv(name);
}
diff --git a/src/osd/modules/sync/work_osd.c b/src/osd/modules/sync/work_osd.c
index 52b0c15bf9e..6c080b5a2ed 100644
--- a/src/osd/modules/sync/work_osd.c
+++ b/src/osd/modules/sync/work_osd.c
@@ -173,7 +173,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
osd_work_queue *queue;
int osdthreadnum = 0;
int allocthreadnum;
- char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
+ const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
// allocate a new queue
queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
@@ -612,12 +612,11 @@ static int effective_num_processors(void)
}
else
{
- char *procsoverride;
int numprocs = 0;
// 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
- procsoverride = osd_getenv(ENV_PROCESSORS);
+ const char *procsoverride = osd_getenv(ENV_PROCESSORS);
if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
return MIN(4 * physprocs, numprocs);
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index 478a6a17e55..2807db7f89e 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -196,6 +196,20 @@ 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
drive, return the geometry of that drive
diff --git a/src/osd/sdl/sdldir.c b/src/osd/sdl/sdldir.c
index dab4d45a2cb..4c3b29dea34 100644
--- a/src/osd/sdl/sdldir.c
+++ b/src/osd/sdl/sdldir.c
@@ -152,7 +152,7 @@ osd_directory *osd_opendir(const char *dirname)
if (tmpstr[0] == '$')
{
- char *envval;
+
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
strcpy(envstr, tmpstr);
@@ -165,7 +165,7 @@ osd_directory *osd_opendir(const char *dirname)
envstr[i] = '\0';
- envval = osd_getenv(&envstr[1]);
+ const char *envval = osd_getenv(&envstr[1]);
if (envval != NULL)
{
j = strlen(envval) + strlen(tmpstr) + 1;
diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c
index aab9828b3b5..6df7615f1ab 100644
--- a/src/osd/sdl/sdlfile.c
+++ b/src/osd/sdl/sdlfile.c
@@ -176,7 +176,6 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
// does path start with an environment variable?
if (tmpstr[0] == '$')
{
- char *envval;
envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
strcpy(envstr, tmpstr);
@@ -189,7 +188,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
envstr[i] = '\0';
- envval = osd_getenv(&envstr[1]);
+ const char *envval = osd_getenv(&envstr[1]);
if (envval != NULL)
{
j = strlen(envval) + strlen(tmpstr) + 1;