Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
49f26817
Commit
49f26817
authored
Apr 06, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor improvements to the stats output dump, including adding commas to
the big numbers.
parent
8ace1ab5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
10 deletions
+34
-10
Objects/obmalloc.c
Objects/obmalloc.c
+34
-10
No files found.
Objects/obmalloc.c
View file @
49f26817
...
...
@@ -1197,14 +1197,37 @@ _PyMalloc_DebugDumpAddress(const void *p)
static
ulong
printone
(
const
char
*
msg
,
ulong
value
)
{
const
size_t
len
=
strlen
(
msg
);
size_t
i
;
int
i
,
k
;
char
buf
[
100
];
ulong
origvalue
=
value
;
fputs
(
msg
,
stderr
);
for
(
i
=
len
;
i
<
40
;
++
i
)
for
(
i
=
(
int
)
strlen
(
msg
);
i
<
35
;
++
i
)
fputc
(
' '
,
stderr
);
fprintf
(
stderr
,
"= %15lu
\n
"
,
value
);
return
value
;
fputc
(
'='
,
stderr
);
/* Write the value with commas. */
i
=
22
;
buf
[
i
--
]
=
'\0'
;
buf
[
i
--
]
=
'\n'
;
k
=
3
;
do
{
ulong
nextvalue
=
value
/
10UL
;
uint
digit
=
value
-
nextvalue
*
10UL
;
value
=
nextvalue
;
buf
[
i
--
]
=
(
char
)(
digit
+
'0'
);
--
k
;
if
(
k
==
0
&&
value
&&
i
>=
0
)
{
k
=
3
;
buf
[
i
--
]
=
','
;
}
}
while
(
value
&&
i
>=
0
);
while
(
i
>=
0
)
buf
[
i
--
]
=
' '
;
fputs
(
buf
,
stderr
);
return
origvalue
;
}
/* Print summary info to stderr about the state of pymalloc's structures. */
...
...
@@ -1284,8 +1307,8 @@ _PyMalloc_DebugDumpStats(void)
}
fputc
(
'\n'
,
stderr
);
fputs
(
"class
num bytes
num pools blocks in use avail blocks
\n
"
"----- ----
-----
--------- ------------- ------------
\n
"
,
fputs
(
"class
size
num pools blocks in use avail blocks
\n
"
"----- ---- --------- ------------- ------------
\n
"
,
stderr
);
for
(
i
=
0
;
i
<
numclasses
;
++
i
)
{
...
...
@@ -1297,7 +1320,7 @@ _PyMalloc_DebugDumpStats(void)
assert
(
b
==
0
&&
f
==
0
);
continue
;
}
fprintf
(
stderr
,
"%5u %
11
u %11lu %15lu %13lu
\n
"
,
fprintf
(
stderr
,
"%5u %
6
u %11lu %15lu %13lu
\n
"
,
i
,
size
,
p
,
b
,
f
);
allocated_bytes
+=
b
*
size
;
available_bytes
+=
f
*
size
;
...
...
@@ -1312,11 +1335,12 @@ _PyMalloc_DebugDumpStats(void)
fputc
(
'\n'
,
stderr
);
total
=
printone
(
"# bytes in allocated blocks"
,
allocated_bytes
);
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"%u unused pools * %d bytes"
,
numfreepools
,
POOL_SIZE
);
total
=
printone
(
buf
,
(
ulong
)
numfreepools
*
POOL_SIZE
);
total
+
=
printone
(
buf
,
(
ulong
)
numfreepools
*
POOL_SIZE
);
total
+=
printone
(
"# bytes in allocated blocks"
,
allocated_bytes
);
total
+=
printone
(
"# bytes in available blocks"
,
available_bytes
);
total
+=
printone
(
"# bytes lost to pool headers"
,
pool_header_bytes
);
total
+=
printone
(
"# bytes lost to quantization"
,
quantization
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment