2001-09-18 03:59:07 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* instrument.h
|
|
|
|
* definitions for run-time statistics collection
|
|
|
|
*
|
|
|
|
*
|
2005-01-01 06:43:09 +01:00
|
|
|
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
|
2001-09-18 03:59:07 +02:00
|
|
|
*
|
2005-01-01 06:43:09 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.8 2005/01/01 05:43:09 momjian Exp $
|
2001-09-18 03:59:07 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef INSTRUMENT_H
|
|
|
|
#define INSTRUMENT_H
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Instrumentation
|
|
|
|
{
|
|
|
|
/* Info about current plan cycle: */
|
2001-10-25 07:50:21 +02:00
|
|
|
bool running; /* TRUE if we've completed first tuple */
|
2001-09-18 03:59:07 +02:00
|
|
|
struct timeval starttime; /* Start time of current iteration of node */
|
|
|
|
struct timeval counter; /* Accumulates runtime for this node */
|
2001-10-25 07:50:21 +02:00
|
|
|
double firsttuple; /* Time for first tuple of this cycle */
|
|
|
|
double tuplecount; /* Tuples so far this cycle */
|
2001-09-18 03:59:07 +02:00
|
|
|
/* Accumulated statistics across all completed cycles: */
|
2001-10-25 07:50:21 +02: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-18 03:59:07 +02: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 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* INSTRUMENT_H */
|