instrument.h 1.4 KB
Newer Older
1 2 3 4 5 6
/*-------------------------------------------------------------------------
 *
 * instrument.h
 *	  definitions for run-time statistics collection
 *
 *
7
 * Copyright (c) 2001-2008, PostgreSQL Global Development Group
8
 *
9
 * $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.19 2008/05/14 19:10:29 tgl Exp $
10 11 12 13 14 15
 *
 *-------------------------------------------------------------------------
 */
#ifndef INSTRUMENT_H
#define INSTRUMENT_H

16
#include "portability/instr_time.h"
17 18


19 20 21
typedef struct Instrumentation
{
	/* Info about current plan cycle: */
22
	bool		running;		/* TRUE if we've completed first tuple */
23
	instr_time	starttime;		/* Start time of current iteration of node */
24
	instr_time	counter;		/* Accumulated runtime for this node */
25
	double		firsttuple;		/* Time for first tuple of this cycle */
26
	double		tuplecount;		/* Tuples emitted so far this cycle */
27
	/* Accumulated statistics across all completed cycles: */
28 29 30 31
	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 */
32 33
} Instrumentation;

34
extern Instrumentation *InstrAlloc(int n);
35
extern void InstrStartNode(Instrumentation *instr);
36
extern void InstrStopNode(Instrumentation *instr, double nTuples);
37
extern void InstrEndLoop(Instrumentation *instr);
38

39
#endif   /* INSTRUMENT_H */