Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
6937dfb242fb
Commit
bd82f055
authored
Mar 29, 2009
by
Nicolas Chauvat
Browse files
[devtools] ExamineLog command does not fail on strange input and outputs to csv
parent
450c435d69b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
devtools/devctl.py
View file @
6937dfb2
...
...
@@ -513,17 +513,20 @@ class ExamineLogCommand(Command):
raise
BadCommandUsage
(
"no argument expected"
)
import
re
requests
=
{}
for
line
in
sys
.
stdin
:
for
line
no
,
line
in
enumerate
(
sys
.
stdin
)
:
if
not
' WHERE '
in
line
:
continue
#sys.stderr.write( line )
rql
,
time
=
line
.
split
(
'--'
)
rql
=
re
.
sub
(
"(
\'
\w+': \d*)"
,
''
,
rql
)
req
=
requests
.
setdefault
(
rql
,
[])
time
.
strip
()
chunks
=
time
.
split
()
cputime
=
float
(
chunks
[
-
3
])
req
.
append
(
cputime
)
try
:
rql
,
time
=
line
.
split
(
'--'
)
rql
=
re
.
sub
(
"(
\'
\w+': \d*)"
,
''
,
rql
)
req
=
requests
.
setdefault
(
rql
,
[])
time
.
strip
()
chunks
=
time
.
split
()
cputime
=
float
(
chunks
[
-
3
])
req
.
append
(
cputime
)
except
Exception
,
exc
:
sys
.
stderr
.
write
(
'Line %s: %s
\n
'
%
(
lineno
,
exc
))
stat
=
[]
for
rql
,
times
in
requests
.
items
():
...
...
@@ -531,8 +534,9 @@ class ExamineLogCommand(Command):
stat
.
sort
()
stat
.
reverse
()
print
'Time ; Occurences ; Query'
for
time
,
occ
,
rql
in
stat
:
print
time
,
occ
,
rql
print
time
,
';'
,
occ
,
';'
,
rql
register_commands
((
UpdateCubicWebCatalogCommand
,
UpdateTemplateCatalogCommand
,
...
...
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