rm ftime for windows build by substitution with clock_gettime
This commit is contained in:
parent
50ea3c275e
commit
90c5825855
|
|
@ -908,14 +908,7 @@ AC_STRUCT_TM
|
|||
AC_STRUCT_TIMEZONE
|
||||
AC_CHECK_FUNCS([localtime])
|
||||
|
||||
case $host_os in
|
||||
*mingw* | *msys* )
|
||||
AC_CHECK_FUNCS([clock_gettime gettimeofday times ftime])
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_FUNCS([clock_gettime gettimeofday times ftime])
|
||||
;;
|
||||
esac
|
||||
AC_CHECK_FUNCS([clock_gettime gettimeofday times ftime])
|
||||
|
||||
# Do not use time or getrusage function for CPU time measurement under OpenMP
|
||||
if test "x$enable_openmp" = xno; then
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ init_rlimits(void)
|
|||
ft_ckspace();
|
||||
}
|
||||
|
||||
#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
PortableTime timebegin;
|
||||
#endif
|
||||
|
||||
void
|
||||
init_time(void)
|
||||
|
|
@ -86,7 +89,6 @@ init_time(void)
|
|||
# ifdef HAVE_TIMES
|
||||
# else
|
||||
# if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
struct PortableTime timebegin;
|
||||
get_portable_time(&timebegin);
|
||||
# endif
|
||||
# endif
|
||||
|
|
@ -192,7 +194,7 @@ printres(char *name)
|
|||
cpu_elapsed = "CPU";
|
||||
# else
|
||||
#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
struct PortableTime timenow;
|
||||
PortableTime timenow;
|
||||
get_portable_time(&timenow);
|
||||
timediff(&timenow, &timebegin, &total_sec, &total_msec);
|
||||
cpu_elapsed = "elapsed";
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ datestring(void)
|
|||
|
||||
#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
|
||||
PortableTime timebegin;
|
||||
|
||||
void timediff(PortableTime *now, PortableTime *begin, int *sec, int *msec)
|
||||
{
|
||||
|
||||
|
|
@ -111,7 +109,8 @@ seconds(void)
|
|||
|
||||
#else
|
||||
#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
struct PortableTime timenow;
|
||||
PortableTime timenow;
|
||||
PortableTime timebegin;
|
||||
int sec, msec;
|
||||
|
||||
get_portable_time(&timenow);
|
||||
|
|
|
|||
|
|
@ -155,10 +155,6 @@ static bool cont_condition;
|
|||
#include "ngspice/stringskip.h"
|
||||
#include "frontend/variable.h"
|
||||
|
||||
#ifdef HAVE_FTIME
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
/* To interupt a spice run */
|
||||
#include <signal.h>
|
||||
typedef void (*sighandler)(int);
|
||||
|
|
@ -1892,26 +1888,26 @@ void SetAnalyse(
|
|||
static unsigned int ng_id1 = 0, ng_id2 = 0;
|
||||
bool thread1;
|
||||
|
||||
#ifdef HAVE_FTIME
|
||||
struct timeb timenow; /* actual time stamp */
|
||||
#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETTIMEOFDAY
|
||||
PortableTime timenow; /* actual time stamp */
|
||||
int diffsec, diffmillisec; /* differences actual minus prev. time stamp */
|
||||
int result; /* return value from callback function */
|
||||
char* s; /* outputs to callback function */
|
||||
int OldPercent; /* Previous progress value */
|
||||
char OldAn[128]; /* Previous analysis type */
|
||||
char olds[128]; /* previous output */
|
||||
static struct timeb timebefore; /* previous time stamp */
|
||||
static PortableTime timebefore; /* previous time stamp */
|
||||
|
||||
/* thread 1 */
|
||||
static int OldPercent1 = -2; /* Previous progress value */
|
||||
static char OldAn1[128]; /* Previous analysis type */
|
||||
static char olds1[128]; /* previous output */
|
||||
static struct timeb timebefore1; /* previous time stamp */
|
||||
static PortableTime timebefore1; /* previous time stamp */
|
||||
/* thread2 */
|
||||
static int OldPercent2 = -2; /* Previous progress value */
|
||||
static char OldAn2[128]; /* Previous analysis type */
|
||||
static char olds2[128]; /* previous output */
|
||||
static struct timeb timebefore2; /* previous time stamp */
|
||||
static PortableTime timebefore2; /* previous time stamp */
|
||||
|
||||
/*set the two thread ids */
|
||||
unsigned int ng_idl = threadid_self();
|
||||
|
|
@ -1929,20 +1925,16 @@ void SetAnalyse(
|
|||
strcpy(OldAn, OldAn1);
|
||||
strcpy(olds, olds1);
|
||||
OldPercent = OldPercent1;
|
||||
timebefore.dstflag = timebefore1.dstflag;
|
||||
timebefore.millitm = timebefore1.millitm;
|
||||
timebefore.time = timebefore1.time;
|
||||
timebefore.timezone = timebefore1.timezone;
|
||||
timebefore.milliseconds = timebefore1.milliseconds;
|
||||
timebefore.seconds = timebefore1.seconds;
|
||||
}
|
||||
else if (ng_idl == ng_id2) {
|
||||
thread1 = FALSE;
|
||||
strcpy(OldAn, OldAn2);
|
||||
strcpy(olds, olds2);
|
||||
OldPercent = OldPercent2;
|
||||
timebefore.dstflag = timebefore2.dstflag;
|
||||
timebefore.millitm = timebefore2.millitm;
|
||||
timebefore.time = timebefore2.time;
|
||||
timebefore.timezone = timebefore2.timezone;
|
||||
timebefore.milliseconds = timebefore2.milliseconds;
|
||||
timebefore.seconds = timebefore2.seconds;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
|
@ -1956,7 +1948,7 @@ void SetAnalyse(
|
|||
return;
|
||||
|
||||
/* get actual time */
|
||||
ftime(&timenow);
|
||||
get_portable_time(&timenow);
|
||||
timediff(&timenow, &timebefore, &diffsec, &diffmillisec);
|
||||
s = TMALLOC(char, 128);
|
||||
|
||||
|
|
@ -2007,16 +1999,12 @@ void SetAnalyse(
|
|||
sprintf( s, "%s: %3.1f%%", Analyse, (double)DecaPercent/10.);
|
||||
}
|
||||
if (thread1) {
|
||||
timebefore1.dstflag = timenow.dstflag;
|
||||
timebefore1.millitm = timenow.millitm;
|
||||
timebefore1.time = timenow.time;
|
||||
timebefore1.timezone = timenow.timezone;
|
||||
timebefore1.milliseconds = timenow.milliseconds;
|
||||
timebefore1.seconds = timenow.seconds;
|
||||
}
|
||||
else {
|
||||
timebefore2.dstflag = timenow.dstflag;
|
||||
timebefore2.millitm = timenow.millitm;
|
||||
timebefore2.time = timenow.time;
|
||||
timebefore2.timezone = timenow.timezone;
|
||||
timebefore2.milliseconds = timenow.milliseconds;
|
||||
timebefore2.seconds = timenow.seconds;
|
||||
}
|
||||
/* info when previous analysis period has finished */
|
||||
if (strcmp(OldAn, Analyse)) {
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ SetAnalyse(char *Analyse, /* in: analysis type */
|
|||
static int OldPercent = -2; /* Previous progress value */
|
||||
static char OldAn[128]; /* Previous analysis type */
|
||||
char s[128], t[128]; /* outputs to analysis window and task bar */
|
||||
static struct timeb timebefore; /* previous time stamp */
|
||||
struct timeb timenow; /* actual time stamp */
|
||||
static PortableTime timebefore; /* previous time stamp */
|
||||
PortableTime timenow; /* actual time stamp */
|
||||
int diffsec, diffmillisec; /* differences actual minus prev. time stamp */
|
||||
|
||||
WaitForIdle();
|
||||
|
|
@ -232,7 +232,7 @@ SetAnalyse(char *Analyse, /* in: analysis type */
|
|||
return;
|
||||
|
||||
/* get actual time */
|
||||
ftime(&timenow);
|
||||
get_portable_time(&timenow);
|
||||
timediff(&timenow, &timebefore, &diffsec, &diffmillisec);
|
||||
|
||||
OldPercent = DecaPercent;
|
||||
|
|
@ -255,10 +255,8 @@ SetAnalyse(char *Analyse, /* in: analysis type */
|
|||
sprintf(s, " %s: %3.1f%%", Analyse, (double)DecaPercent/10.);
|
||||
sprintf(t, "%s %3.1f%%", PACKAGE_STRING, (double)DecaPercent/10.);
|
||||
}
|
||||
timebefore.dstflag = timenow.dstflag;
|
||||
timebefore.millitm = timenow.millitm;
|
||||
timebefore.time = timenow.time;
|
||||
timebefore.timezone = timenow.timezone;
|
||||
timebefore.milliseconds = timenow.milliseconds;
|
||||
timebefore.seconds = timenow.seconds;
|
||||
/* info when previous analysis period has finished */
|
||||
if (strcmp(OldAn, Analyse)) {
|
||||
if ((ft_nginfo || ft_ngdebug) && (strcmp(OldAn, "")))
|
||||
|
|
|
|||
Loading…
Reference in New Issue