Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
403f9869
Commit
403f9869
authored
Oct 03, 2021
by
dieter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fsdump/fsstats improvements
parent
1fb097b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
CHANGES.rst
CHANGES.rst
+6
-0
src/ZODB/FileStorage/fsdump.py
src/ZODB/FileStorage/fsdump.py
+10
-4
src/ZODB/scripts/fsstats.py
src/ZODB/scripts/fsstats.py
+7
-4
No files found.
CHANGES.rst
View file @
403f9869
...
...
@@ -5,6 +5,12 @@
5.6.1 (unreleased)
==================
- Readd transaction size information to ``fsdump`` output;
adapt `fsstats` to ``fsdump``'s exchanged order for ``size`` and ``class``
information in data records;
(fixes `#354 <https://github.com/zopefoundation/ZODB/issues/354>_).
Make ``fsdump`` callable via Python's ``-m`` command line option.
- Fix UnboundLocalError when running fsoids.py script.
See `issue 285 <https://github.com/zopefoundation/ZODB/issues/285>`_.
...
...
src/ZODB/FileStorage/fsdump.py
View file @
403f9869
...
...
@@ -23,12 +23,14 @@ from ZODB.utils import u64, get_pickle_metadata
def
fsdump
(
path
,
file
=
None
,
with_offset
=
1
):
iter
=
FileIterator
(
path
)
for
i
,
trans
in
enumerate
(
iter
):
size
=
trans
.
_tend
-
trans
.
_tpos
if
with_offset
:
print
((
"Trans #%05d tid=%016x time=%s offset=%d"
%
(
i
,
u64
(
trans
.
tid
),
TimeStamp
(
trans
.
tid
),
trans
.
_pos
)),
file
=
file
)
print
((
"Trans #%05d tid=%016x size=%d time=%s offset=%d"
%
(
i
,
u64
(
trans
.
tid
),
size
,
TimeStamp
(
trans
.
tid
),
trans
.
_pos
)),
file
=
file
)
else
:
print
((
"Trans #%05d tid=%016x time=%s"
%
(
i
,
u64
(
trans
.
tid
),
TimeStamp
(
trans
.
tid
))),
file
=
file
)
print
((
"Trans #%05d tid=%016x
size=%d
time=%s"
%
(
i
,
u64
(
trans
.
tid
),
size
,
TimeStamp
(
trans
.
tid
))),
file
=
file
)
print
((
" status=%r user=%r description=%r"
%
(
trans
.
status
,
trans
.
user
,
trans
.
description
)),
file
=
file
)
...
...
@@ -122,3 +124,7 @@ class Dumper(object):
def
main
():
import
sys
fsdump
(
sys
.
argv
[
1
])
if
__name__
==
"__main__"
:
main
()
src/ZODB/scripts/fsstats.py
View file @
403f9869
...
...
@@ -7,7 +7,7 @@ import six
from
six.moves
import
filter
rx_txn
=
re
.
compile
(
"tid=([0-9a-f]+).*size=(
\
d+)
"
)
rx_data = re.compile("
oid
=
([
0
-
9
a
-
f
]
+
)
class
=
(
\
S
+
)
size
=
(
\
d
+
)
")
rx_data = re.compile("
oid
=
([
0
-
9
a
-
f
]
+
)
size
=
(
\
d
+
)
class
=
(
\
S
+
)
")
def sort_byhsize(seq, reverse=False):
L = [(v.size(), k, v) for k, v in seq]
...
...
@@ -50,7 +50,10 @@ class Histogram(dict):
return mode
def make_bins(self, binsize):
maxkey = max(six.iterkeys(self))
try:
maxkey = max(six.iterkeys(self))
except ValueError:
maxkey = 0
self.binsize = binsize
self.bins = [0] * (1 + maxkey / binsize)
for k, v in six.iteritems(self):
...
...
@@ -104,7 +107,7 @@ def class_detail(class_size):
# per class details
for klass, h in sort_byhsize(six.iteritems(class_size), reverse=True):
h.make_bins(50)
if len(
filter(None, h.bins
)) == 1:
if len(
tuple(filter(None, h.bins)
)) == 1:
continue
h.report("
Object
size
for
%
s
" % klass, usebins=True)
...
...
@@ -146,7 +149,7 @@ def main(path=None):
m = rx_data.search(line)
if not m:
continue
oid,
klass, size
= m.groups()
oid,
size, klass
= m.groups()
size = int(size)
obj_size.add(size)
...
...
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