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
cbf3dd53
Kaydet (Commit)
cbf3dd53
authored
Eki 08, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use better timer on the mac
Open files in binary mode (Jack)
üst
45ac47c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
profile.py
Lib/profile.py
+18
-1
No files found.
Lib/profile.py
Dosyayı görüntüle @
cbf3dd53
...
...
@@ -152,6 +152,11 @@ class Profile:
if
hasattr
(
os
,
'times'
):
self
.
timer
=
os
.
times
self
.
dispatcher
=
self
.
trace_dispatch
elif
os
.
name
==
'mac'
:
import
MacOS
self
.
timer
=
MacOS
.
GetTicks
self
.
dispatcher
=
self
.
trace_dispatch_mac
self
.
get_time
=
self
.
get_time_mac
else
:
self
.
timer
=
time
.
time
self
.
dispatcher
=
self
.
trace_dispatch_i
...
...
@@ -175,6 +180,8 @@ class Profile:
t
=
reduce
(
lambda
x
,
y
:
x
+
y
,
t
,
0
)
return
t
def
get_time_mac
(
self
):
return
self
.
timer
()
/
60.0
# Heavily optimized dispatch routine for os.times() timer
...
...
@@ -202,6 +209,16 @@ class Profile:
else
:
self
.
t
=
self
.
timer
()
-
t
# put back unrecorded delta
return
# Dispatch routine for macintosh (timer returns time in ticks of 1/60th second)
def
trace_dispatch_mac
(
self
,
frame
,
event
,
arg
):
t
=
self
.
timer
()
/
60.0
-
self
.
t
# - 1 # Integer calibration constant
if
self
.
dispatch
[
event
](
frame
,
t
):
self
.
t
=
self
.
timer
()
/
60.0
else
:
self
.
t
=
self
.
timer
()
/
60.0
-
t
# put back unrecorded delta
return
# SLOW generic dispatch rountine for timer returning lists of numbers
...
...
@@ -338,7 +355,7 @@ class Profile:
print_stats
()
def
dump_stats
(
self
,
file
):
f
=
open
(
file
,
'w'
)
f
=
open
(
file
,
'w
b
'
)
self
.
create_stats
()
marshal
.
dump
(
self
.
stats
,
f
)
f
.
close
()
...
...
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