gooderp18绿色标准版
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

86 rindas
3.3KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * instrument.h
  4. * definitions for run-time statistics collection
  5. *
  6. *
  7. * Copyright (c) 2001-2019, PostgreSQL Global Development Group
  8. *
  9. * src/include/executor/instrument.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef INSTRUMENT_H
  14. #define INSTRUMENT_H
  15. #include "portability/instr_time.h"
  16. typedef struct BufferUsage
  17. {
  18. long shared_blks_hit; /* # of shared buffer hits */
  19. long shared_blks_read; /* # of shared disk blocks read */
  20. long shared_blks_dirtied; /* # of shared blocks dirtied */
  21. long shared_blks_written; /* # of shared disk blocks written */
  22. long local_blks_hit; /* # of local buffer hits */
  23. long local_blks_read; /* # of local disk blocks read */
  24. long local_blks_dirtied; /* # of shared blocks dirtied */
  25. long local_blks_written; /* # of local disk blocks written */
  26. long temp_blks_read; /* # of temp blocks read */
  27. long temp_blks_written; /* # of temp blocks written */
  28. instr_time blk_read_time; /* time spent reading */
  29. instr_time blk_write_time; /* time spent writing */
  30. } BufferUsage;
  31. /* Flag bits included in InstrAlloc's instrument_options bitmask */
  32. typedef enum InstrumentOption
  33. {
  34. INSTRUMENT_TIMER = 1 << 0, /* needs timer (and row counts) */
  35. INSTRUMENT_BUFFERS = 1 << 1, /* needs buffer usage */
  36. INSTRUMENT_ROWS = 1 << 2, /* needs row count */
  37. INSTRUMENT_ALL = PG_INT32_MAX
  38. } InstrumentOption;
  39. typedef struct Instrumentation
  40. {
  41. /* Parameters set at node creation: */
  42. bool need_timer; /* true if we need timer data */
  43. bool need_bufusage; /* true if we need buffer usage data */
  44. /* Info about current plan cycle: */
  45. bool running; /* true if we've completed first tuple */
  46. instr_time starttime; /* Start time of current iteration of node */
  47. instr_time counter; /* Accumulated runtime for this node */
  48. double firsttuple; /* Time for first tuple of this cycle */
  49. double tuplecount; /* Tuples emitted so far this cycle */
  50. BufferUsage bufusage_start; /* Buffer usage at start */
  51. /* Accumulated statistics across all completed cycles: */
  52. double startup; /* Total startup time (in seconds) */
  53. double total; /* Total total time (in seconds) */
  54. double ntuples; /* Total tuples produced */
  55. double ntuples2; /* Secondary node-specific tuple counter */
  56. double nloops; /* # of run cycles for this node */
  57. double nfiltered1; /* # tuples removed by scanqual or joinqual */
  58. double nfiltered2; /* # tuples removed by "other" quals */
  59. BufferUsage bufusage; /* Total buffer usage */
  60. } Instrumentation;
  61. typedef struct WorkerInstrumentation
  62. {
  63. int num_workers; /* # of structures that follow */
  64. Instrumentation instrument[FLEXIBLE_ARRAY_MEMBER];
  65. } WorkerInstrumentation;
  66. extern PGDLLIMPORT BufferUsage pgBufferUsage;
  67. extern Instrumentation *InstrAlloc(int n, int instrument_options);
  68. extern void InstrInit(Instrumentation *instr, int instrument_options);
  69. extern void InstrStartNode(Instrumentation *instr);
  70. extern void InstrStopNode(Instrumentation *instr, double nTuples);
  71. extern void InstrEndLoop(Instrumentation *instr);
  72. extern void InstrAggNode(Instrumentation *dst, Instrumentation *add);
  73. extern void InstrStartParallelQuery(void);
  74. extern void InstrEndParallelQuery(BufferUsage *result);
  75. extern void InstrAccumParallelQuery(BufferUsage *result);
  76. #endif /* INSTRUMENT_H */
上海开阖软件有限公司 沪ICP备12045867号-1