Skip to content

Commit 56ce573

Browse files
committed
PGPRO-427: Count pagemap compiling time
1 parent 6577c9b commit 56ce573

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/parsexlog.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "pg_probackup.h"
1414

15+
#include <time.h>
1516
#include <unistd.h>
1617
#ifdef HAVE_LIBZ
1718
#include <zlib.h>
@@ -256,6 +257,8 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
256257
bool extract_isok = true;
257258
pthread_t threads[num_threads];
258259
xlog_thread_arg thread_args[num_threads];
260+
time_t start_time,
261+
end_time;
259262

260263
elog(LOG, "Compiling pagemap");
261264
if (!XRecOffIsValid(startpoint))
@@ -271,6 +274,7 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
271274
endSegNo--;
272275

273276
nextSegNoToRead = 0;
277+
time(&start_time);
274278

275279
/*
276280
* Initialize thread args.
@@ -322,8 +326,11 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
322326
if (thread_args[i].ret == 1)
323327
extract_isok = false;
324328
}
329+
330+
time(&end_time);
325331
if (extract_isok)
326-
elog(LOG, "Pagemap compiled");
332+
elog(LOG, "Pagemap compiled, time elapsed %.0f sec",
333+
difftime(end_time, start_time));
327334
else
328335
elog(ERROR, "Pagemap compiling failed");
329336
}

0 commit comments

Comments
 (0)