summaryrefslogtreecommitdiff
path: root/src/backend/utils/activity/backend_progress.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/activity/backend_progress.c')
-rw-r--r--src/backend/utils/activity/backend_progress.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c
index d96af812b1..fb48eafef9 100644
--- a/src/backend/utils/activity/backend_progress.c
+++ b/src/backend/utils/activity/backend_progress.c
@@ -59,6 +59,27 @@ pgstat_progress_update_param(int index, int64 val)
}
/*-----------
+ * pgstat_progress_incr_param() -
+ *
+ * Increment index'th member in st_progress_param[] of own backend entry.
+ *-----------
+ */
+void
+pgstat_progress_incr_param(int index, int64 incr)
+{
+ volatile PgBackendStatus *beentry = MyBEEntry;
+
+ Assert(index >= 0 && index < PGSTAT_NUM_PROGRESS_PARAM);
+
+ if (!beentry || !pgstat_track_activities)
+ return;
+
+ PGSTAT_BEGIN_WRITE_ACTIVITY(beentry);
+ beentry->st_progress_param[index] += incr;
+ PGSTAT_END_WRITE_ACTIVITY(beentry);
+}
+
+/*-----------
* pgstat_progress_update_multi_param() -
*
* Update multiple members in st_progress_param[] of own backend entry.