Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4f399fb6
Kaydet (Commit)
4f399fb6
authored
Eyl 30, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
more robust coding, adapted for mac
üst
59c473be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
profile.py
Lib/profile.py
+19
-16
pstats.py
Lib/pstats.py
+4
-7
No files found.
Lib/profile.py
Dosyayı görüntüle @
4f399fb6
...
...
@@ -43,11 +43,10 @@ import marshal
# Global variables
func_norm_dict
=
{}
func_norm_counter
=
0
pid_string
=
`os.getpid()`
# Optimized intermodule references
ostimes
=
os
.
times
if
hasattr
(
os
,
'getpid'
):
pid_string
=
`os.getpid()`
else
:
pid_string
=
''
# Sample timer for use with
...
...
@@ -137,7 +136,7 @@ def help():
#**************************************************************************
class
Profile
:
def
__init__
(
self
,
*
arg
):
def
__init__
(
self
,
timer
=
None
):
self
.
timings
=
{}
self
.
cur
=
None
self
.
cmd
=
""
...
...
@@ -148,18 +147,22 @@ class Profile:
'exception'
:
self
.
trace_dispatch_exception
,
\
}
if
not
arg
:
self
.
timer
=
os
.
times
self
.
dispatcher
=
self
.
trace_dispatch
if
not
timer
:
if
hasattr
(
os
,
'times'
):
self
.
timer
=
os
.
times
self
.
dispatcher
=
self
.
trace_dispatch
else
:
self
.
timer
=
time
.
time
self
.
dispatcher
=
self
.
trace_dispatch_i
else
:
self
.
timer
=
arg
[
0
]
self
.
timer
=
timer
t
=
self
.
timer
()
# test out timer function
try
:
if
len
(
t
)
==
2
:
self
.
dispatcher
=
self
.
trace_dispatch
else
:
self
.
dispatcher
=
self
.
trace_dispatch_
r
except
:
self
.
dispatcher
=
self
.
trace_dispatch_
l
except
TypeError
:
self
.
dispatcher
=
self
.
trace_dispatch_i
self
.
t
=
self
.
get_time
()
self
.
simulate_call
(
'profiler'
)
...
...
@@ -373,9 +376,9 @@ class Profile:
return
func_norm_dict
[
func_name
]
if
type
(
func_name
)
==
type
(
""
):
long_name
=
string
.
split
(
func_name
)
file_name
=
long_name
[
6
][
1
:
-
2
]
file_name
=
long_name
[
-
3
][
1
:
-
2
]
func
=
long_name
[
2
]
lineno
=
long_name
[
8
][:
-
1
]
lineno
=
long_name
[
-
1
][:
-
1
]
if
'?'
==
func
:
# Until I find out how to may 'em...
file_name
=
'python'
func_norm_counter
=
func_norm_counter
+
1
...
...
@@ -398,7 +401,7 @@ class Profile:
def
runctx
(
self
,
cmd
,
globals
,
locals
):
self
.
set_cmd
(
cmd
)
sys
.
setprofile
(
self
.
trace_dispatch
)
sys
.
setprofile
(
self
.
dispatcher
)
try
:
exec
cmd
in
globals
,
locals
finally
:
...
...
@@ -407,7 +410,7 @@ class Profile:
# This method is more useful to profile a single function call.
def
runcall
(
self
,
func
,
*
args
):
self
.
set_cmd
(
`func`
)
sys
.
setprofile
(
self
.
trace_dispatch
)
sys
.
setprofile
(
self
.
dispatcher
)
try
:
apply
(
func
,
args
)
finally
:
...
...
Lib/pstats.py
Dosyayı görüntüle @
4f399fb6
...
...
@@ -116,13 +116,10 @@ class Stats:
except
:
# in case this is not unix
pass
self
.
files
=
[
arg
]
elif
type
(
arg
)
==
type
(
self
):
try
:
arg
.
create_stats
()
self
.
stats
=
arg
.
stats
arg
.
stats
=
{}
except
:
pass
elif
hasattr
(
arg
,
'create_stats'
):
arg
.
create_stats
()
self
.
stats
=
arg
.
stats
arg
.
stats
=
{}
if
not
self
.
stats
:
raise
TypeError
,
"Cannot create or construct a "
\
+
`self.__class__`
\
...
...
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