Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-pull-mirror-test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
Testing Projects
hg-pull-mirror-test2
Commits
30c40ba10963
Commit
30c40ba10963
authored
17 years ago
by
Dirkjan Ochtman
Browse files
Options
Downloads
Patches
Plain Diff
updating lsprof.py from remote repository
parent
31726c27e40e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/lsprof.py
+18
-27
18 additions, 27 deletions
mercurial/lsprof.py
with
18 additions
and
27 deletions
mercurial/lsprof.py
+
18
−
27
View file @
30c40ba1
# this is copied from the lsprof distro because somehow
# it is not installed by distutils
#
# small modifications made
#! /usr/bin/env python
import
sys
...
...
@@ -5,15 +2,9 @@
import
sys
try
:
from
_lsprof
import
Profiler
,
profiler_entry
,
profiler_subentry
except
ImportError
,
inst
:
import
packagescan
if
packagescan
.
scan_in_progress
:
raise
packagescan
.
SkipPackage
(
'
_lsprof not available
'
)
raise
from
_lsprof
import
Profiler
,
profiler_entry
,
profiler_subentry
__all__
=
[
'
profile
'
,
'
Stats
'
]
def
profile
(
f
,
*
args
,
**
kwds
):
"""
XXX docstring
"""
p
=
Profiler
()
...
...
@@ -14,8 +5,8 @@
__all__
=
[
'
profile
'
,
'
Stats
'
]
def
profile
(
f
,
*
args
,
**
kwds
):
"""
XXX docstring
"""
p
=
Profiler
()
p
.
enable
(
subcalls
=
True
)
p
.
enable
(
subcalls
=
True
,
builtins
=
True
)
try
:
...
...
@@ -21,4 +12,4 @@
try
:
ret
=
f
(
*
args
,
**
kwds
)
f
(
*
args
,
**
kwds
)
finally
:
p
.
disable
()
...
...
@@ -23,6 +14,6 @@
finally
:
p
.
disable
()
return
ret
,
Stats
(
p
.
getstats
())
return
Stats
(
p
.
getstats
())
class
Stats
(
object
):
...
...
@@ -49,10 +40,10 @@
d
=
self
.
data
if
top
is
not
None
:
d
=
d
[:
top
]
cols
=
"
% 12s %11.4f %11.4f %s
\n
"
hcols
=
"
% 12s %12s %12s %s
\n
"
cols2
=
"
+%12s %11.4f %11.4f + %s
\n
"
file
.
write
(
hcols
%
(
"
CallCount
"
,
"
Total(s)
"
,
"
Inline(s)
"
,
"
module:lineno(function)
"
))
cols
=
"
% 12s
%12s
%11.4f %11.4f %s
\n
"
hcols
=
"
% 12s %12s %12s
%12s
%s
\n
"
cols2
=
"
+%12s
%12s
%11.4f %11.4f + %s
\n
"
file
.
write
(
hcols
%
(
"
CallCount
"
,
"
Recursive
"
,
"
Total(
m
s)
"
,
"
Inline(
m
s)
"
,
"
module:lineno(function)
"
))
count
=
0
for
e
in
d
:
...
...
@@ -57,6 +48,6 @@
count
=
0
for
e
in
d
:
file
.
write
(
cols
%
(
e
.
callcount
,
e
.
totaltime
,
file
.
write
(
cols
%
(
e
.
callcount
,
e
.
reccallcount
,
e
.
totaltime
,
e
.
inlinetime
,
label
(
e
.
code
)))
count
+=
1
if
limit
is
not
None
and
count
==
limit
:
...
...
@@ -64,7 +55,7 @@
ccount
=
0
if
e
.
calls
:
for
se
in
e
.
calls
:
file
.
write
(
cols
%
(
"
+%s
"
%
se
.
callcount
,
file
.
write
(
cols
%
(
"
+%s
"
%
se
.
callcount
,
se
.
reccallcount
,
se
.
totaltime
,
se
.
inlinetime
,
"
+%s
"
%
label
(
se
.
code
)))
count
+=
1
...
...
@@ -83,11 +74,11 @@
e
=
self
.
data
[
i
]
if
not
isinstance
(
e
.
code
,
str
):
self
.
data
[
i
]
=
type
(
e
)((
label
(
e
.
code
),)
+
e
[
1
:])
if
e
.
calls
:
for
j
in
range
(
len
(
e
.
calls
)):
se
=
e
.
calls
[
j
]
if
not
isinstance
(
se
.
code
,
str
):
e
.
calls
[
j
]
=
type
(
se
)((
label
(
se
.
code
),)
+
se
[
1
:])
if
e
.
calls
:
for
j
in
range
(
len
(
e
.
calls
)):
se
=
e
.
calls
[
j
]
if
not
isinstance
(
se
.
code
,
str
):
e
.
calls
[
j
]
=
type
(
se
)((
label
(
se
.
code
),)
+
se
[
1
:])
_fn2mod
=
{}
...
...
@@ -97,7 +88,7 @@
try
:
mname
=
_fn2mod
[
code
.
co_filename
]
except
KeyError
:
for
k
,
v
in
sys
.
modules
.
iter
items
():
for
k
,
v
in
sys
.
modules
.
items
():
if
v
is
None
:
continue
if
not
hasattr
(
v
,
'
__file__
'
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment