Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35c2a3c

Browse files
committed
Allow ShowBufferUsage() to report the number of reads/writes that have
occurred to temporary files. This replaces the unusedNDirectFileRead/NDirectFileWrite counters.Itagaki Takahiro
1 parent32f159c commit35c2a3c

File tree

5 files changed

+17
-29
lines changed

5 files changed

+17
-29
lines changed

‎src/backend/storage/buffer/buf_init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.80 2008/01/01 19:45:51 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.81 2008/09/17 13:15:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,6 +29,8 @@ long intBufferHitCount;
2929
longintLocalBufferHitCount;
3030
longintBufferFlushCount;
3131
longintLocalBufferFlushCount;
32+
longintBufFileReadCount;
33+
longintBufFileWriteCount;
3234

3335

3436
/*

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.237 2008/08/11 11:05:11 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.238 2008/09/17 13:15:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -64,12 +64,6 @@ boolzero_damaged_pages = false;
6464
intbgwriter_lru_maxpages=100;
6565
doublebgwriter_lru_multiplier=2.0;
6666

67-
68-
longNDirectFileRead;/* some I/O's are direct file access. bypass
69-
* bufmgr */
70-
longNDirectFileWrite;/* e.g., I/O in psort and hashjoin. */
71-
72-
7367
/* local state for StartBufferIO and related functions */
7468
staticvolatileBufferDesc*InProgressBuf=NULL;
7569
staticboolIsForInput;
@@ -1572,7 +1566,7 @@ ShowBufferUsage(void)
15721566
ReadLocalBufferCount-LocalBufferHitCount,LocalBufferFlushCount,localhitrate);
15731567
appendStringInfo(&str,
15741568
"!\tDirect blocks: %10ld read, %10ld written\n",
1575-
NDirectFileRead,NDirectFileWrite);
1569+
BufFileReadCount,BufFileWriteCount);
15761570

15771571
returnstr.data;
15781572
}
@@ -1586,8 +1580,8 @@ ResetBufferUsage(void)
15861580
LocalBufferHitCount=0;
15871581
ReadLocalBufferCount=0;
15881582
LocalBufferFlushCount=0;
1589-
NDirectFileRead=0;
1590-
NDirectFileWrite=0;
1583+
BufFileReadCount=0;
1584+
BufFileWriteCount=0;
15911585
}
15921586

15931587
/*

‎src/backend/storage/file/buffile.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.31 2008/05/02 01:08:27 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.32 2008/09/17 13:15:55 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -36,6 +36,7 @@
3636

3737
#include"storage/fd.h"
3838
#include"storage/buffile.h"
39+
#include"storage/buf_internals.h"
3940

4041
/*
4142
* We break BufFiles into gigabyte-sized segments, regardless of RELSEG_SIZE.
@@ -238,6 +239,8 @@ BufFileLoadBuffer(BufFile *file)
238239
file->nbytes=0;
239240
file->offsets[file->curFile]+=file->nbytes;
240241
/* we choose not to advance curOffset here */
242+
243+
BufFileReadCount++;
241244
}
242245

243246
/*
@@ -300,6 +303,8 @@ BufFileDumpBuffer(BufFile *file)
300303
file->offsets[file->curFile]+=bytestowrite;
301304
file->curOffset+=bytestowrite;
302305
wpos+=bytestowrite;
306+
307+
BufFileWriteCount++;
303308
}
304309
file->dirty= false;
305310

‎src/include/executor/execdebug.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
13-
* $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.32 2008/01/01 19:45:57 momjian Exp $
13+
* $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.33 2008/09/17 13:15:55 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -190,19 +190,4 @@ extern intNIndexTupleInserted;
190190
#defineMJ_DEBUG_PROC_NODE(slot)
191191
#endif/* EXEC_MERGEJOINDEBUG */
192192

193-
/* ----------------------------------------------------------------
194-
*DO NOT DEFINE THESE EVER OR YOU WILL BURN!
195-
* ----------------------------------------------------------------
196-
*/
197-
/* ----------------
198-
*NOTYET is placed around any code not yet implemented
199-
*in the executor. Only remove these when actually implementing
200-
*said code.
201-
* ----------------
202-
*/
203-
#undef NOTYET
204-
205-
externlongNDirectFileRead;
206-
externlongNDirectFileWrite;
207-
208193
#endif/* ExecDebugIncluded */

‎src/include/storage/buf_internals.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.98 2008/08/11 11:05:11 heikki Exp $
11+
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.99 2008/09/17 13:15:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -180,6 +180,8 @@ extern long int BufferHitCount;
180180
externlongintLocalBufferHitCount;
181181
externlongintBufferFlushCount;
182182
externlongintLocalBufferFlushCount;
183+
externlongintBufFileReadCount;
184+
externlongintBufFileWriteCount;
183185

184186

185187
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp