Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
288d5bdf
Commit
288d5bdf
authored
Mar 01, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- requestprofiler: added new --daysago option and added
support for reading gzipped detailed logfiles
parent
da359ae5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
utilities/requestprofiler.py
utilities/requestprofiler.py
+26
-4
No files found.
doc/CHANGES.txt
View file @
288d5bdf
...
...
@@ -16,6 +16,9 @@ Zope Changes
a ZCatalog multiple times it is much faster to use a
TopicIndex instead.
- requestprofiler: added new --daysago option and added
support for reading gzipped detailed logfiles
Bugs:
- Collector #32: Use difflib instead of ndiff
...
...
utilities/requestprofiler.py
View file @
288d5bdf
...
...
@@ -15,9 +15,11 @@
""" Request log profiler script """
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
string
,
sys
,
time
,
getopt
,
tempfile
,
math
,
cPickle
try
:
import
gzip
except
:
pass
class
ProfileException
(
Exception
):
pass
...
...
@@ -596,6 +598,8 @@ If the 'verbose' argument is specified, do not trim url to fit into 80 cols.
If the 'today' argument is specified, limit results to hits received today.
If the 'daysago' argument is specified, limit results to hits received n days ago.
The 'resolution' argument is used only for timed reports and specifies the
number of seconds between consecutive lines in the report
(default is 60 seconds).
...
...
@@ -634,6 +638,11 @@ Examples:
Show cumulative report statistics sorted by mean for entries in the log
which happened today, and do not trim the URL in the resulting report.
%(pname)s debug.log --cumulative --sort=mean --daysago=3 --verbose
Show cumulative report statistics sorted by mean for entries in the log
which happened three days ago, and do not trim the URL in the resulting report.
%(pname)s debug.log --urlfocus='/manage_main' --urlfocustime=60
Show 'urlfocus' report which displays statistics about requests
...
...
@@ -677,7 +686,7 @@ Usage: %s filename1 [filename2 ...]
[--sort=spec]
[--top=n]
[--verbose]
[--today | [--start=date] [--end=date]
]
[--today | [--start=date] [--end=date]
| --daysago=n ]
[--writestats=filename | --readstats=filename]
[--urlfocus=url]
[--urlfocustime=seconds]
...
...
@@ -715,7 +724,10 @@ if __name__ == '__main__':
i
=
1
for
arg
in
sys
.
argv
[
1
:]:
if
arg
[:
2
]
!=
'--'
:
files
.
append
(
open
(
arg
))
if
arg
[
-
3
:]
==
'.gz'
and
globals
().
has_key
(
'gzip'
):
files
.
append
(
gzip
.
GzipFile
(
arg
,
'r'
))
else
:
files
.
append
(
open
(
arg
))
sys
.
argv
.
remove
(
arg
)
i
=
i
+
1
...
...
@@ -723,10 +735,11 @@ if __name__ == '__main__':
opts
,
extra
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
''
,
[
'sort='
,
'top='
,
'help'
,
'verbose'
,
'today'
,
'cumulative'
,
'detailed'
,
'timed'
,
'start='
,
'end='
,
'resolution='
,
'writestats='
,
'end='
,
'resolution='
,
'writestats='
,
'daysago='
,
'readstats='
,
'urlfocus='
,
'urlfocustime='
]
)
for
opt
,
val
in
opts
:
if
opt
==
'--readstats'
:
statsfname
=
val
readstats
=
1
...
...
@@ -749,6 +762,15 @@ if __name__ == '__main__':
end
=
list
(
now
)
end
[
3
]
=
23
;
end
[
4
]
=
59
;
end
[
5
]
=
59
end
=
time
.
mktime
(
end
)
if
opt
==
'--daysago'
:
now
=
time
.
localtime
(
time
.
time
()
-
int
(
val
)
*
3600
*
24
)
# for testing - now = (2001, 04, 19, 0, 0, 0, 0, 0, -1)
start
=
list
(
now
)
start
[
3
]
=
start
[
4
]
=
start
[
5
]
=
0
start
=
time
.
mktime
(
start
)
end
=
list
(
now
)
end
[
3
]
=
23
;
end
[
4
]
=
59
;
end
[
5
]
=
59
end
=
time
.
mktime
(
end
)
if
opt
==
'--start'
:
start
=
getdate
(
val
)
if
opt
==
'--end'
:
...
...
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