Browse Source

Add statistics: load, subckt expansion, and parse times

pre-master-46
Holger Vogt 6 years ago
parent
commit
6b0104849e
  1. 9
      src/frontend/ftesopt.c
  2. 14
      src/frontend/inp.c
  3. 2
      src/include/ngspice/fteoptdefs.h

9
src/frontend/ftesopt.c

@ -20,9 +20,10 @@ struct FTEparm {
static struct FTEparm FTEOPTtbl[] = {
{ "decklineno", FTEOPT_NLDECK, "Number of lines in the deck" },
{ "netloadtime", FTEOPT_NLT, "Netlist loading time" },
{ "netparsetime", FTEOPT_NPT, "Netlist parsing time" }
{ "decklineno", FTEOPT_NLDECK, "Number of lines in the deck" },
{ "netloadtime", FTEOPT_NLT, "Netlist loading time" },
{ "netpreptime", FTEOPT_PRT, "Subckt and Param expansion time"},
{ "netparsetime", FTEOPT_NPT, "Netlist parsing time" }
};
static const int FTEOPTcount = sizeof(FTEOPTtbl)/sizeof(*FTEOPTtbl);
@ -57,6 +58,8 @@ getFTEstat(struct FTEparm *p, FTESTATistics *stat, struct variable *next)
return var_alloc_num(copy(p->description), stat->FTESTATdeckNumLines, next);
case FTEOPT_NLT:
return var_alloc_real(copy(p->description), stat->FTESTATnetLoadTime, next);
case FTEOPT_PRT:
return var_alloc_real(copy(p->description), stat->FTESTATnetPrepTime, next);
case FTEOPT_NPT:
return var_alloc_real(copy(p->description), stat->FTESTATnetParseTime, next);
default:

14
src/frontend/inp.c

@ -459,7 +459,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
double temperature_value;
bool expr_w_temper = FALSE;
double startTime, endTime;
double startTime, loadTime = 0., endTime;
#ifdef HAS_PROGREP
if (!comfile)
@ -735,6 +735,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
#ifdef HAS_PROGREP
SetAnalyse("Prepare Deck", 0);
#endif
endTime = seconds();
loadTime = endTime - startTime;
startTime = endTime;
/*This is for the globel param setting only */
/* replace agauss(x,y,z) in each b-line by suitable value, one for all */
bool statlocal = cp_getvar("statlocal", CP_BOOL, NULL, 0);
@ -856,8 +859,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
if (ft_curckt) {
ft_curckt->ci_param = NULL;
ft_curckt->ci_meas = NULL;
/* PN add here stats*/
ft_curckt->FTEstats->FTESTATnetLoadTime = endTime - startTime;
}
for (dd = deck; dd; dd = dd->nextcard) {
@ -964,6 +965,13 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
/* Now that the deck is loaded, do the commands, if there are any */
controls = wl_reverse(controls);
/* statistics for preparing the deck */
endTime = seconds();
if (ft_curckt) {
ft_curckt->FTEstats->FTESTATnetLoadTime = loadTime;
ft_curckt->FTEstats->FTESTATnetPrepTime = seconds() - startTime;
}
/* in shared ngspice controls a execute in the primary thread, typically
before the background thread has finished. This leads to premature execution
of commands. Thus this is delegated to a function using a third thread, that

2
src/include/ngspice/fteoptdefs.h

@ -14,6 +14,7 @@ typedef struct sFTESTATistics {
int FTESTATdeckNumLines; /* number of lines in spice deck */
double FTESTATnetLoadTime; /* total time required to load the spice deck */
double FTESTATnetPrepTime; /* total time required to do subcircuit and numparam expansion */
double FTESTATnetParseTime; /* total time required to parse the netlist */
} FTESTATistics;
@ -21,6 +22,7 @@ typedef struct sFTESTATistics {
enum {
FTEOPT_NLDECK = 1,
FTEOPT_NLT,
FTEOPT_PRT,
FTEOPT_NPT,
};

Loading…
Cancel
Save