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
c9d77b24
Kaydet (Commit)
c9d77b24
authored
May 01, 2012
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add an option to timeit to use time.process_time() and mark -t and -c as deprecated.
üst
1503eed6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
timeit.py
Lib/timeit.py
+9
-5
No files found.
Lib/timeit.py
Dosyayı görüntüle @
c9d77b24
...
...
@@ -9,14 +9,15 @@ the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line usage:
python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [--] [statement]
python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-
p] [-
h] [--] [statement]
Options:
-n/--number N: how many times to execute 'statement' (default: see below)
-r/--repeat N: how many times to repeat the timer (default 3)
-s/--setup S: statement to be executed once initially (default 'pass')
-t/--time: use time.time()
-c/--clock: use time.clock()
-p/--process: use time.process_time() (default is time.perf_counter())
-t/--time: use time.time() (deprecated)
-c/--clock: use time.clock() (deprecated)
-v/--verbose: print raw timing results; repeat for more digits precision
-h/--help: print this usage message and exit
--: separate options from statement, use when statement starts with -
...
...
@@ -249,9 +250,10 @@ def main(args=None, *, _wrap_timer=None):
args
=
sys
.
argv
[
1
:]
import
getopt
try
:
opts
,
args
=
getopt
.
getopt
(
args
,
"n:s:r:tcvh"
,
opts
,
args
=
getopt
.
getopt
(
args
,
"n:s:r:tc
p
vh"
,
[
"number="
,
"setup="
,
"repeat="
,
"time"
,
"clock"
,
"verbose"
,
"help"
])
"time"
,
"clock"
,
"process"
,
"verbose"
,
"help"
])
except
getopt
.
error
as
err
:
print
(
err
)
print
(
"use -h/--help for command line help"
)
...
...
@@ -276,6 +278,8 @@ def main(args=None, *, _wrap_timer=None):
timer
=
time
.
time
if
o
in
(
"-c"
,
"--clock"
):
timer
=
time
.
clock
if
o
in
(
"-p"
,
"--process"
):
timer
=
time
.
process_time
if
o
in
(
"-v"
,
"--verbose"
):
if
verbose
:
precision
+=
1
...
...
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