Per-device load timing support.
This commit is contained in:
parent
758b8cc853
commit
e1677a18c4
|
|
@ -14,6 +14,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
#include "ngspice/ngspice.h"
|
||||
#include "ngspice/cpdefs.h"
|
||||
#include "ngspice/ftedefs.h"
|
||||
#include "ngspice/devdefs.h"
|
||||
|
||||
#include "circuits.h"
|
||||
#include "resource.h"
|
||||
|
|
@ -325,7 +326,22 @@ printres(char *name)
|
|||
|
||||
/* Now get all the spice resource stuff. */
|
||||
if (ft_curckt && ft_curckt->ci_ckt) {
|
||||
|
||||
if (name && eq(name, "devtimes")) {
|
||||
/* Per-device timings */
|
||||
for(int i=0; i<=DEVmaxnum; i++) {
|
||||
if (ft_curckt->ci_ckt->CKTstat->devCounts[i]==0) {
|
||||
continue;
|
||||
}
|
||||
fprintf(cp_out, "%s: t=%f n=%ld t/n=%e\n",
|
||||
(i==DEVmaxnum ? "\noverhead" : DEVices[i]->DEVpublic.name),
|
||||
ft_curckt->ci_ckt->CKTstat->devTimes[i],
|
||||
ft_curckt->ci_ckt->CKTstat->devCounts[i],
|
||||
ft_curckt->ci_ckt->CKTstat->devTimes[i]/(double)(ft_curckt->ci_ckt->CKTstat->devCounts[i])
|
||||
);
|
||||
}
|
||||
}
|
||||
yy = TRUE;
|
||||
|
||||
#ifdef CIDER
|
||||
/* begin cider integration */
|
||||
if (!name || eq(name, "circuit") || eq(name, "task"))
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ Modified: 2000 AlansFixes
|
|||
#ifndef ngspice_OPTDEFS_H
|
||||
#define ngspice_OPTDEFS_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* structure used to describe the statistics to be collected */
|
||||
|
||||
typedef struct sSTATdevList {
|
||||
|
|
@ -46,6 +48,8 @@ typedef struct {
|
|||
double STATacLoadTime; /* time spent in AC device loading */
|
||||
double STATacSyncTime; /* time spent in transient sync'ing */
|
||||
STATdevList *STATdevNum; /* PN: Number of instances and models for each device */
|
||||
double *devTimes; /* Per-device load times, last entry is overhead */
|
||||
size_t *devCounts; /* Per-device load counts, last entry is overhead */
|
||||
} STATistics;
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ CKTdestroy(CKTcircuit *ckt)
|
|||
#endif
|
||||
|
||||
FREE(ckt->CKTstat->STATdevNum);
|
||||
FREE(ckt->CKTstat->devCounts);
|
||||
FREE(ckt->CKTstat->devTimes);
|
||||
FREE(ckt->CKTstat);
|
||||
FREE(ckt->CKThead);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ Modified: 2000 AlansFixes
|
|||
|
||||
static int ZeroNoncurRow(SMPmatrix *matrix, CKTnode *nodes, int rownum);
|
||||
|
||||
// #define PER_DEVICE_STATS
|
||||
int
|
||||
CKTload(CKTcircuit *ckt)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
double startTime;
|
||||
double startTime, td0;
|
||||
CKTnode *node;
|
||||
int error;
|
||||
#ifdef STEPDEBUG
|
||||
|
|
@ -49,6 +50,13 @@ CKTload(CKTcircuit *ckt)
|
|||
/* gtri - begin - Put resistors to ground at all nodes */
|
||||
#endif
|
||||
|
||||
td0 = SPfrontEnd->IFseconds();
|
||||
|
||||
#ifdef PER_DEVICE_STATS
|
||||
ckt->CKTstat->devTimes[DEVmaxnum] += SPfrontEnd->IFseconds() - td0;
|
||||
ckt->CKTstat->devCounts[DEVmaxnum]++;
|
||||
#endif
|
||||
|
||||
startTime = SPfrontEnd->IFseconds();
|
||||
size = SMPmatSize(ckt->CKTmatrix);
|
||||
for (i = 0; i <= size; i++) {
|
||||
|
|
@ -61,7 +69,14 @@ CKTload(CKTcircuit *ckt)
|
|||
|
||||
for (i = 0; i < DEVmaxnum; i++) {
|
||||
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead[i]) {
|
||||
#ifdef PER_DEVICE_STATS
|
||||
td0 = SPfrontEnd->IFseconds();
|
||||
#endif
|
||||
error = DEVices[i]->DEVload (ckt->CKThead[i], ckt);
|
||||
#ifdef PER_DEVICE_STATS
|
||||
ckt->CKTstat->devTimes[i] += SPfrontEnd->IFseconds() - td0;
|
||||
ckt->CKTstat->devCounts[i]++;
|
||||
#endif
|
||||
if (ckt->CKTnoncon)
|
||||
ckt->CKTtroubleNode = 0;
|
||||
#ifdef STEPDEBUG
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ CKTinit(CKTcircuit **ckt) /* new circuit to create */
|
|||
sckt->CKTstat->STATdevNum = TMALLOC(STATdevList, DEVmaxnum);
|
||||
if(sckt->CKTstat->STATdevNum == NULL)
|
||||
return(E_NOMEM);
|
||||
/* Per-device timings */
|
||||
sckt->CKTstat->devTimes = TMALLOC(double, DEVmaxnum+1);
|
||||
sckt->CKTstat->devCounts = TMALLOC(size_t, DEVmaxnum+1);
|
||||
sckt->CKTtroubleNode = 0;
|
||||
sckt->CKTtroubleElt = NULL;
|
||||
sckt->CKTtimePoints = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue