PostgreSQL Source Code  git master
backend_progress.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PGSTAT_NUM_PROGRESS_PARAM   20
 

Typedefs

typedef enum ProgressCommandType ProgressCommandType
 

Enumerations

enum  ProgressCommandType {
  PROGRESS_COMMAND_INVALID, PROGRESS_COMMAND_VACUUM, PROGRESS_COMMAND_ANALYZE, PROGRESS_COMMAND_CLUSTER,
  PROGRESS_COMMAND_CREATE_INDEX, PROGRESS_COMMAND_BASEBACKUP, PROGRESS_COMMAND_COPY
}
 

Functions

void pgstat_progress_start_command (ProgressCommandType cmdtype, Oid relid)
 
void pgstat_progress_update_param (int index, int64 val)
 
void pgstat_progress_update_multi_param (int nparam, const int *index, const int64 *val)
 
void pgstat_progress_end_command (void)
 

Macro Definition Documentation

◆ PGSTAT_NUM_PROGRESS_PARAM

#define PGSTAT_NUM_PROGRESS_PARAM   20

Typedef Documentation

◆ ProgressCommandType

Enumeration Type Documentation

◆ ProgressCommandType

Enumerator
PROGRESS_COMMAND_INVALID 
PROGRESS_COMMAND_VACUUM 
PROGRESS_COMMAND_ANALYZE 
PROGRESS_COMMAND_CLUSTER 
PROGRESS_COMMAND_CREATE_INDEX 
PROGRESS_COMMAND_BASEBACKUP 
PROGRESS_COMMAND_COPY 

Definition at line 22 of file backend_progress.h.

Function Documentation

◆ pgstat_progress_end_command()

void pgstat_progress_end_command ( void  )

Definition at line 98 of file backend_progress.c.

References InvalidOid, MyBEEntry, PGSTAT_BEGIN_WRITE_ACTIVITY, PGSTAT_END_WRITE_ACTIVITY, pgstat_track_activities, PROGRESS_COMMAND_INVALID, PgBackendStatus::st_progress_command, and PgBackendStatus::st_progress_command_target.

Referenced by AbortSubTransaction(), AbortTransaction(), analyze_rel(), cluster_rel(), DefineIndex(), EndCopy(), EndCopyFrom(), heap_vacuum_rel(), perform_base_backup(), reindex_index(), and ReindexRelationConcurrently().

99 {
100  volatile PgBackendStatus *beentry = MyBEEntry;
101 
102  if (!beentry || !pgstat_track_activities)
103  return;
104 
106  return;
107 
111  PGSTAT_END_WRITE_ACTIVITY(beentry);
112 }
PgBackendStatus * MyBEEntry
Oid st_progress_command_target
ProgressCommandType st_progress_command
#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry)
#define InvalidOid
Definition: postgres_ext.h:36
#define PGSTAT_END_WRITE_ACTIVITY(beentry)
bool pgstat_track_activities

◆ pgstat_progress_start_command()

void pgstat_progress_start_command ( ProgressCommandType  cmdtype,
Oid  relid 
)

Definition at line 26 of file backend_progress.c.

References MemSet, MyBEEntry, PGSTAT_BEGIN_WRITE_ACTIVITY, PGSTAT_END_WRITE_ACTIVITY, pgstat_track_activities, PgBackendStatus::st_progress_command, PgBackendStatus::st_progress_command_target, and PgBackendStatus::st_progress_param.

Referenced by analyze_rel(), BeginCopyFrom(), BeginCopyTo(), cluster_rel(), DefineIndex(), heap_vacuum_rel(), perform_base_backup(), reindex_index(), and ReindexRelationConcurrently().

27 {
28  volatile PgBackendStatus *beentry = MyBEEntry;
29 
30  if (!beentry || !pgstat_track_activities)
31  return;
32 
34  beentry->st_progress_command = cmdtype;
35  beentry->st_progress_command_target = relid;
36  MemSet(&beentry->st_progress_param, 0, sizeof(beentry->st_progress_param));
38 }
PgBackendStatus * MyBEEntry
Oid st_progress_command_target
#define MemSet(start, val, len)
Definition: c.h:1008
ProgressCommandType st_progress_command
#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry)
int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]
#define PGSTAT_END_WRITE_ACTIVITY(beentry)
bool pgstat_track_activities

◆ pgstat_progress_update_multi_param()

void pgstat_progress_update_multi_param ( int  nparam,
const int *  index,
const int64 *  val 
)

Definition at line 69 of file backend_progress.c.

References Assert, i, MyBEEntry, PGSTAT_BEGIN_WRITE_ACTIVITY, PGSTAT_END_WRITE_ACTIVITY, PGSTAT_NUM_PROGRESS_PARAM, pgstat_track_activities, and PgBackendStatus::st_progress_param.

Referenced by _bt_spools_heapscan(), BeginCopyFrom(), BeginCopyTo(), BuildRelationExtStatistics(), DefineIndex(), heapam_relation_copy_for_cluster(), index_build(), lazy_scan_heap(), perform_base_backup(), reindex_index(), ReindexRelationConcurrently(), update_basebackup_progress(), validate_index(), and WaitForLockersMultiple().

71 {
72  volatile PgBackendStatus *beentry = MyBEEntry;
73  int i;
74 
75  if (!beentry || !pgstat_track_activities || nparam == 0)
76  return;
77 
79 
80  for (i = 0; i < nparam; ++i)
81  {
83 
84  beentry->st_progress_param[index[i]] = val[i];
85  }
86 
88 }
PgBackendStatus * MyBEEntry
Definition: type.h:89
#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry)
#define Assert(condition)
Definition: c.h:804
int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]
#define PGSTAT_END_WRITE_ACTIVITY(beentry)
int i
bool pgstat_track_activities
#define PGSTAT_NUM_PROGRESS_PARAM
long val
Definition: informix.c:664

◆ pgstat_progress_update_param()

void pgstat_progress_update_param ( int  index,
int64  val 
)

Definition at line 47 of file backend_progress.c.

References Assert, MyBEEntry, PGSTAT_BEGIN_WRITE_ACTIVITY, PGSTAT_END_WRITE_ACTIVITY, PGSTAT_NUM_PROGRESS_PARAM, pgstat_track_activities, PgBackendStatus::st_progress_param, and val.

Referenced by _bt_leafbuild(), _bt_load(), _bt_spools_heapscan(), _h_indexbuild(), acquire_inherited_sample_rows(), acquire_sample_rows(), btvacuumscan(), BuildRelationExtStatistics(), cluster_rel(), copy_dest_receive(), CopyFrom(), CopyLoadRawBuf(), CopySendEndOfRow(), DefineIndex(), do_analyze_rel(), DoCopyTo(), finish_heap_swap(), hashbuild(), heap_vacuum_rel(), heapam_index_build_range_scan(), heapam_index_validate_scan(), heapam_relation_copy_for_cluster(), lazy_cleanup_all_indexes(), lazy_scan_heap(), lazy_scan_prune(), lazy_truncate_heap(), lazy_vacuum_all_indexes(), lazy_vacuum_heap_page(), lazy_vacuum_heap_rel(), perform_base_backup(), reindex_index(), reindex_relation(), ReindexRelationConcurrently(), validate_index(), WaitForLockersMultiple(), and WaitForOlderSnapshots().

48 {
49  volatile PgBackendStatus *beentry = MyBEEntry;
50 
52 
53  if (!beentry || !pgstat_track_activities)
54  return;
55 
57  beentry->st_progress_param[index] = val;
59 }
PgBackendStatus * MyBEEntry
Definition: type.h:89
#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry)
#define Assert(condition)
Definition: c.h:804
int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]
#define PGSTAT_END_WRITE_ACTIVITY(beentry)
bool pgstat_track_activities
#define PGSTAT_NUM_PROGRESS_PARAM
long val
Definition: informix.c:664