2001-09-17 21:59:07 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* instrument.h
|
|
|
|
|
* definitions for run-time statistics collection
|
|
|
|
|
*
|
|
|
|
|
*
|
2003-08-04 19:59:41 -04:00
|
|
|
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
|
2001-09-17 21:59:07 -04:00
|
|
|
*
|
2003-11-29 17:41:33 -05:00
|
|
|
* $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.6 2003/11/29 22:41:01 pgsql Exp $
|
2001-09-17 21:59:07 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#ifndef INSTRUMENT_H
|
|
|
|
|
#define INSTRUMENT_H
|
|
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Instrumentation
|
|
|
|
|
{
|
|
|
|
|
/* Info about current plan cycle: */
|
2001-10-25 01:50:21 -04:00
|
|
|
bool running; /* TRUE if we've completed first tuple */
|
2001-09-17 21:59:07 -04:00
|
|
|
struct timeval starttime; /* Start time of current iteration of node */
|
|
|
|
|
struct timeval counter; /* Accumulates runtime for this node */
|
2001-10-25 01:50:21 -04:00
|
|
|
double firsttuple; /* Time for first tuple of this cycle */
|
|
|
|
|
double tuplecount; /* Tuples so far this cycle */
|
2001-09-17 21:59:07 -04:00
|
|
|
/* Accumulated statistics across all completed cycles: */
|
2001-10-25 01:50:21 -04:00
|
|
|
double startup; /* Total startup time (in seconds) */
|
|
|
|
|
double total; /* Total total time (in seconds) */
|
|
|
|
|
double ntuples; /* Total tuples produced */
|
|
|
|
|
double nloops; /* # of run cycles for this node */
|
2001-09-17 21:59:07 -04:00
|
|
|
} Instrumentation;
|
|
|
|
|
|
|
|
|
|
extern Instrumentation *InstrAlloc(void);
|
|
|
|
|
extern void InstrStartNode(Instrumentation *instr);
|
|
|
|
|
extern void InstrStopNode(Instrumentation *instr, bool returnedTuple);
|
|
|
|
|
extern void InstrEndLoop(Instrumentation *instr);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* INSTRUMENT_H */
|