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

Commit849ec99

Browse files
author
Neil Conway
committed
Adjust the output of MemoryContextStats() so that the stats for a
child memory contexts is indented two spaces to the right of itsparent context. This should make it easier to deduce the memorycontext hierarchy from the output of MemoryContextStats().
1 parent3605c8c commit849ec99

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

‎src/backend/utils/mmgr/aset.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.72 2007/04/30 00:12:08 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.73 2007/08/07 06:25:14 neilc Exp $
1515
*
1616
* NOTE:
1717
*This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -214,7 +214,7 @@ static void AllocSetReset(MemoryContext context);
214214
staticvoidAllocSetDelete(MemoryContextcontext);
215215
staticSizeAllocSetGetChunkSpace(MemoryContextcontext,void*pointer);
216216
staticboolAllocSetIsEmpty(MemoryContextcontext);
217-
staticvoidAllocSetStats(MemoryContextcontext);
217+
staticvoidAllocSetStats(MemoryContextcontext,intlevel);
218218

219219
#ifdefMEMORY_CONTEXT_CHECKING
220220
staticvoidAllocSetCheck(MemoryContextcontext);
@@ -1034,7 +1034,7 @@ AllocSetIsEmpty(MemoryContext context)
10341034
*Displays stats about memory consumption of an allocset.
10351035
*/
10361036
staticvoid
1037-
AllocSetStats(MemoryContextcontext)
1037+
AllocSetStats(MemoryContextcontext,intlevel)
10381038
{
10391039
AllocSetset= (AllocSet)context;
10401040
longnblocks=0;
@@ -1044,6 +1044,7 @@ AllocSetStats(MemoryContext context)
10441044
AllocBlockblock;
10451045
AllocChunkchunk;
10461046
intfidx;
1047+
inti;
10471048

10481049
for (block=set->blocks;block!=NULL;block=block->next)
10491050
{
@@ -1060,6 +1061,10 @@ AllocSetStats(MemoryContext context)
10601061
freespace+=chunk->size+ALLOC_CHUNKHDRSZ;
10611062
}
10621063
}
1064+
1065+
for (i=0;i<level;i++)
1066+
fprintf(stderr," ");
1067+
10631068
fprintf(stderr,
10641069
"%s: %lu total in %ld blocks; %lu free (%ld chunks); %lu used\n",
10651070
set->header.name,totalspace,nblocks,freespace,nchunks,

‎src/backend/utils/mmgr/mcxt.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.61 2007/07/25 12:22:52 mha Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.62 2007/08/07 06:25:14 neilc Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -49,6 +49,8 @@ MemoryContext CurTransactionContext = NULL;
4949
/* This is a transient link to the active portal's memory context: */
5050
MemoryContextPortalContext=NULL;
5151

52+
staticvoidMemoryContextStatsInternal(MemoryContextcontext,intlevel);
53+
5254

5355
/*****************************************************************************
5456
* EXPORTED ROUTINES *
@@ -320,17 +322,22 @@ MemoryContextIsEmpty(MemoryContext context)
320322
*/
321323
void
322324
MemoryContextStats(MemoryContextcontext)
325+
{
326+
MemoryContextStatsInternal(context,0);
327+
}
328+
329+
staticvoid
330+
MemoryContextStatsInternal(MemoryContextcontext,intlevel)
323331
{
324332
MemoryContextchild;
325333

326334
AssertArg(MemoryContextIsValid(context));
327335

328-
(*context->methods->stats) (context);
336+
(*context->methods->stats) (context,level);
329337
for (child=context->firstchild;child!=NULL;child=child->nextchild)
330-
MemoryContextStats(child);
338+
MemoryContextStatsInternal(child,level+1);
331339
}
332340

333-
334341
/*
335342
* MemoryContextCheck
336343
*Check all chunks in the named context.

‎src/include/nodes/memnodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/nodes/memnodes.h,v 1.32 2007/01/05 22:19:55 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/nodes/memnodes.h,v 1.33 2007/08/07 06:25:14 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -44,7 +44,7 @@ typedef struct MemoryContextMethods
4444
void(*delete) (MemoryContextcontext);
4545
Size(*get_chunk_space) (MemoryContextcontext,void*pointer);
4646
bool(*is_empty) (MemoryContextcontext);
47-
void(*stats) (MemoryContextcontext);
47+
void(*stats) (MemoryContextcontext,intlevel);
4848
#ifdefMEMORY_CONTEXT_CHECKING
4949
void(*check) (MemoryContextcontext);
5050
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp