|
|
568ccc1 |
From f68dcdb47bfe6e069f4f6be10e6a47c55c2b9533 Mon Sep 17 00:00:00 2001
|
|
|
568ccc1 |
From: Sergio Pascual <sergiopr@fis.ucm.es>
|
|
|
568ccc1 |
Date: Thu, 11 Jul 2019 18:17:05 +0200
|
|
|
568ccc1 |
Subject: [PATCH] Replace deprecated time.clock with time.perf_counter
|
|
|
568ccc1 |
|
|
|
568ccc1 |
---
|
|
|
568ccc1 |
bench/bsddb-table-bench.py | 8 ++++----
|
|
|
568ccc1 |
bench/recarray2-test.py | 24 ++++++++++++------------
|
|
|
568ccc1 |
bench/search-bench.py | 16 ++++++++--------
|
|
|
568ccc1 |
bench/searchsorted-bench.py | 8 ++++----
|
|
|
568ccc1 |
bench/searchsorted-bench2.py | 8 ++++----
|
|
|
568ccc1 |
bench/shelve-bench.py | 8 ++++----
|
|
|
568ccc1 |
bench/sqlite-search-bench.py | 16 ++++++++--------
|
|
|
568ccc1 |
bench/stress-test.py | 8 ++++----
|
|
|
568ccc1 |
bench/stress-test2.py | 8 ++++----
|
|
|
568ccc1 |
bench/stress-test3.py | 8 ++++----
|
|
|
568ccc1 |
bench/table-bench.py | 8 ++++----
|
|
|
568ccc1 |
tables/index.py | 10 +++++-----
|
|
|
568ccc1 |
12 files changed, 65 insertions(+), 65 deletions(-)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
diff --git a/bench/bsddb-table-bench.py b/bench/bsddb-table-bench.py
|
|
|
568ccc1 |
index 49c4f809e..dd9f875b3 100644
|
|
|
568ccc1 |
--- a/bench/bsddb-table-bench.py
|
|
|
568ccc1 |
+++ b/bench/bsddb-table-bench.py
|
|
|
568ccc1 |
@@ -239,16 +239,16 @@ def readFile(filename, recsize, verbose):
|
|
|
568ccc1 |
# Catch the hdf5 file passed as the last argument
|
|
|
568ccc1 |
file = pargs[0]
|
|
|
568ccc1 |
|
|
|
568ccc1 |
- t1 = time.clock()
|
|
|
568ccc1 |
+ t1 = time.perf_counter()
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, iterations, recsize, verbose)
|
|
|
568ccc1 |
- t2 = time.clock()
|
|
|
568ccc1 |
+ t2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
- t1 = time.clock()
|
|
|
568ccc1 |
+ t1 = time.perf_counter()
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
readFile(file, recsize, verbose)
|
|
|
568ccc1 |
- t2 = time.clock()
|
|
|
568ccc1 |
+ t2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Rows written:", rowsw, " Row size:", rowsz)
|
|
|
568ccc1 |
diff --git a/bench/recarray2-test.py b/bench/recarray2-test.py
|
|
|
568ccc1 |
index e4affe213..a8602d80d 100644
|
|
|
568ccc1 |
--- a/bench/recarray2-test.py
|
|
|
568ccc1 |
+++ b/bench/recarray2-test.py
|
|
|
568ccc1 |
@@ -30,11 +30,11 @@
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Assignment in recarray original")
|
|
|
568ccc1 |
print("-------------------------------")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
for row in range(reclen):
|
|
|
568ccc1 |
#r1.field("b")[row] = "changed"
|
|
|
568ccc1 |
r1.field("c")[row] = float(row ** 2)
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
origtime = round(t2 - t1, 3)
|
|
|
568ccc1 |
print("Assign time:", origtime, " Rows/s:", int(reclen / (origtime + delta)))
|
|
|
568ccc1 |
# print "Field b on row 2 after re-assign:", r1.field("c")[2]
|
|
|
568ccc1 |
@@ -42,12 +42,12 @@
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Assignment in recarray modified")
|
|
|
568ccc1 |
print("-------------------------------")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
for row in range(reclen):
|
|
|
568ccc1 |
rec = r2._row(row) # select the row to be changed
|
|
|
568ccc1 |
# rec.b = "changed" # change the "b" field
|
|
|
568ccc1 |
rec.c = float(row ** 2) # Change the "c" field
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
ttime = round(t2 - t1, 3)
|
|
|
568ccc1 |
print("Assign time:", ttime, " Rows/s:", int(reclen / (ttime + delta)),
|
|
|
568ccc1 |
end=' ')
|
|
|
568ccc1 |
@@ -57,24 +57,24 @@
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Selection in recarray original")
|
|
|
568ccc1 |
print("------------------------------")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
for row in range(reclen):
|
|
|
568ccc1 |
rec = r1[row]
|
|
|
568ccc1 |
if rec.field("a") < 3:
|
|
|
568ccc1 |
print("This record pass the cut ==>", rec.field("c"), "(row", row, ")")
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
origtime = round(t2 - t1, 3)
|
|
|
568ccc1 |
print("Select time:", origtime, " Rows/s:", int(reclen / (origtime + delta)))
|
|
|
568ccc1 |
print()
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Selection in recarray modified")
|
|
|
568ccc1 |
print("------------------------------")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
for row in range(reclen):
|
|
|
568ccc1 |
rec = r2._row(row)
|
|
|
568ccc1 |
if rec.a < 3:
|
|
|
568ccc1 |
print("This record pass the cut ==>", rec.c, "(row", row, ")")
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
ttime = round(t2 - t1, 3)
|
|
|
568ccc1 |
print("Select time:", ttime, " Rows/s:", int(reclen / (ttime + delta)),
|
|
|
568ccc1 |
end=' ')
|
|
|
568ccc1 |
@@ -84,9 +84,9 @@
|
|
|
568ccc1 |
print("Printing in recarray original")
|
|
|
568ccc1 |
print("------------------------------")
|
|
|
568ccc1 |
f = open("test.out", "w")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
f.write(str(r1))
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
origtime = round(t2 - t1, 3)
|
|
|
568ccc1 |
f.close()
|
|
|
568ccc1 |
os.unlink("test.out")
|
|
|
568ccc1 |
@@ -95,9 +95,9 @@
|
|
|
568ccc1 |
print("Printing in recarray modified")
|
|
|
568ccc1 |
print("------------------------------")
|
|
|
568ccc1 |
f = open("test2.out", "w")
|
|
|
568ccc1 |
-t1 = time.clock()
|
|
|
568ccc1 |
+t1 = time.perf_counter()
|
|
|
568ccc1 |
f.write(str(r2))
|
|
|
568ccc1 |
-t2 = time.clock()
|
|
|
568ccc1 |
+t2 = time.perf_counter()
|
|
|
568ccc1 |
ttime = round(t2 - t1, 3)
|
|
|
568ccc1 |
f.close()
|
|
|
568ccc1 |
os.unlink("test2.out")
|
|
|
568ccc1 |
diff --git a/bench/search-bench.py b/bench/search-bench.py
|
|
|
568ccc1 |
index a56f738a8..11d88349f 100644
|
|
|
568ccc1 |
--- a/bench/search-bench.py
|
|
|
568ccc1 |
+++ b/bench/search-bench.py
|
|
|
568ccc1 |
@@ -92,7 +92,7 @@ def createFile(filename, nrows, filters, index, heavy, noise, verbose):
|
|
|
568ccc1 |
None, nrows)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
nrowsbuf = table.nrowsinbuf
|
|
|
568ccc1 |
minimum = 0
|
|
|
568ccc1 |
maximum = nrows
|
|
|
568ccc1 |
@@ -115,7 +115,7 @@ def createFile(filename, nrows, filters, index, heavy, noise, verbose):
|
|
|
568ccc1 |
table.flush()
|
|
|
568ccc1 |
rowswritten += nrows
|
|
|
568ccc1 |
time1 = time.time() - t1
|
|
|
568ccc1 |
- tcpu1 = time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu1 = time.perf_counter() - cpu1
|
|
|
568ccc1 |
print("Time for filling:", round(time1, 3),
|
|
|
568ccc1 |
"Krows/s:", round(nrows / 1000. / time1, 3), end=' ')
|
|
|
568ccc1 |
fileh.close()
|
|
|
568ccc1 |
@@ -127,14 +127,14 @@ def createFile(filename, nrows, filters, index, heavy, noise, verbose):
|
|
|
568ccc1 |
rowsize = table.rowsize
|
|
|
568ccc1 |
if index:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
# Index all entries
|
|
|
568ccc1 |
if not heavy:
|
|
|
568ccc1 |
indexrows = table.cols.var1.create_index(filters=filters)
|
|
|
568ccc1 |
for colname in ['var2', 'var3']:
|
|
|
568ccc1 |
table.colinstances[colname].create_index(filters=filters)
|
|
|
568ccc1 |
time2 = time.time() - t1
|
|
|
568ccc1 |
- tcpu2 = time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu2 = time.perf_counter() - cpu1
|
|
|
568ccc1 |
print("Time for indexing:", round(time2, 3),
|
|
|
568ccc1 |
"iKrows/s:", round(indexrows / 1000. / time2, 3), end=' ')
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
@@ -250,7 +250,7 @@ def readFile(filename, atom, riter, indexmode, dselect, verbose):
|
|
|
568ccc1 |
# The interval for look values at. This is aproximately equivalent to
|
|
|
568ccc1 |
# the number of elements to select
|
|
|
568ccc1 |
rnd = numpy.random.randint(table.nrows)
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
if atom == "string":
|
|
|
568ccc1 |
val = str(rnd)[-4:]
|
|
|
568ccc1 |
@@ -284,17 +284,17 @@ def readFile(filename, atom, riter, indexmode, dselect, verbose):
|
|
|
568ccc1 |
if i == 0:
|
|
|
568ccc1 |
# First iteration
|
|
|
568ccc1 |
time1 = time.time() - t1
|
|
|
568ccc1 |
- tcpu1 = time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu1 = time.perf_counter() - cpu1
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
if indexmode == "indexed":
|
|
|
568ccc1 |
# if indexed, wait until the 5th iteration (in order to
|
|
|
568ccc1 |
# insure that the index is effectively cached) to take times
|
|
|
568ccc1 |
if i >= 5:
|
|
|
568ccc1 |
time2 += time.time() - t1
|
|
|
568ccc1 |
- tcpu2 += time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu2 += time.perf_counter() - cpu1
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
time2 += time.time() - t1
|
|
|
568ccc1 |
- tcpu2 += time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu2 += time.perf_counter() - cpu1
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if riter > 1:
|
|
|
568ccc1 |
if indexmode == "indexed" and riter >= 5:
|
|
|
568ccc1 |
diff --git a/bench/searchsorted-bench.py b/bench/searchsorted-bench.py
|
|
|
568ccc1 |
index f595de51e..a4bfe7d3b 100644
|
|
|
568ccc1 |
--- a/bench/searchsorted-bench.py
|
|
|
568ccc1 |
+++ b/bench/searchsorted-bench.py
|
|
|
568ccc1 |
@@ -295,13 +295,13 @@ def searchFile(filename, atom, verbose, item):
|
|
|
568ccc1 |
if shuffle:
|
|
|
568ccc1 |
print("Suffling...")
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, nrows, filters,
|
|
|
568ccc1 |
atom, recsize, index, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -316,14 +316,14 @@ def searchFile(filename, atom, verbose, item):
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
psyco.bind(searchFile)
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if rng or item:
|
|
|
568ccc1 |
(rowsr, uncomprB, niter) = searchFile(file, atom, verbose, item)
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
for i in range(1):
|
|
|
568ccc1 |
(rowsr, rowsel, rowsz) = readFile(file, atom, niter, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/bench/searchsorted-bench2.py b/bench/searchsorted-bench2.py
|
|
|
568ccc1 |
index f8446aed4..2b88e11d6 100644
|
|
|
568ccc1 |
--- a/bench/searchsorted-bench2.py
|
|
|
568ccc1 |
+++ b/bench/searchsorted-bench2.py
|
|
|
568ccc1 |
@@ -295,13 +295,13 @@ def searchFile(filename, atom, verbose, item):
|
|
|
568ccc1 |
if shuffle:
|
|
|
568ccc1 |
print("Suffling...")
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, nrows, filters,
|
|
|
568ccc1 |
atom, recsize, index, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -316,14 +316,14 @@ def searchFile(filename, atom, verbose, item):
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
psyco.bind(searchFile)
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if rng or item:
|
|
|
568ccc1 |
(rowsr, uncomprB, niter) = searchFile(file, atom, verbose, item)
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
for i in range(1):
|
|
|
568ccc1 |
(rowsr, rowsel, rowsz) = readFile(file, atom, niter, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/bench/shelve-bench.py b/bench/shelve-bench.py
|
|
|
568ccc1 |
index 4a891c02d..d30739d83 100644
|
|
|
568ccc1 |
--- a/bench/shelve-bench.py
|
|
|
568ccc1 |
+++ b/bench/shelve-bench.py
|
|
|
568ccc1 |
@@ -178,16 +178,16 @@ def readFile(filename, recsize):
|
|
|
568ccc1 |
# Catch the hdf5 file passed as the last argument
|
|
|
568ccc1 |
file = pargs[0]
|
|
|
568ccc1 |
|
|
|
568ccc1 |
- t1 = time.clock()
|
|
|
568ccc1 |
+ t1 = time.perf_counter()
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, iterations, recsize)
|
|
|
568ccc1 |
- t2 = time.clock()
|
|
|
568ccc1 |
+ t2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
- t1 = time.clock()
|
|
|
568ccc1 |
+ t1 = time.perf_counter()
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
readFile(file, recsize)
|
|
|
568ccc1 |
- t2 = time.clock()
|
|
|
568ccc1 |
+ t2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
|
|
|
568ccc1 |
print("Rows written:", rowsw, " Row size:", rowsz)
|
|
|
568ccc1 |
diff --git a/bench/sqlite-search-bench.py b/bench/sqlite-search-bench.py
|
|
|
568ccc1 |
index 995fe0e36..76dc7c57e 100644
|
|
|
568ccc1 |
--- a/bench/sqlite-search-bench.py
|
|
|
568ccc1 |
+++ b/bench/sqlite-search-bench.py
|
|
|
568ccc1 |
@@ -123,7 +123,7 @@ def createFile(filename, nrows, filters, indexmode, heavy, noise, bfile,
|
|
|
568ccc1 |
# Insert rows
|
|
|
568ccc1 |
SQL = "insert into small values(NULL, %s)" % place_holders
|
|
|
568ccc1 |
time1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
# This way of filling is to copy the PyTables benchmark
|
|
|
568ccc1 |
nrowsbuf = 1000
|
|
|
568ccc1 |
minimum = 0
|
|
|
568ccc1 |
@@ -149,7 +149,7 @@ def createFile(filename, nrows, filters, indexmode, heavy, noise, bfile,
|
|
|
568ccc1 |
cursor.execute(SQL, fields)
|
|
|
568ccc1 |
conn.commit()
|
|
|
568ccc1 |
t1 = round(time.time() - time1, 5)
|
|
|
568ccc1 |
- tcpu1 = round(time.clock() - cpu1, 5)
|
|
|
568ccc1 |
+ tcpu1 = round(time.perf_counter() - cpu1, 5)
|
|
|
568ccc1 |
rowsecf = nrows / t1
|
|
|
568ccc1 |
size1 = os.stat(dbfile)[6]
|
|
|
568ccc1 |
print("******** Results for writing nrows = %s" % (nrows), "*********")
|
|
|
568ccc1 |
@@ -160,7 +160,7 @@ def createFile(filename, nrows, filters, indexmode, heavy, noise, bfile,
|
|
|
568ccc1 |
# Indexem
|
|
|
568ccc1 |
if indexmode == "indexed":
|
|
|
568ccc1 |
time1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if not heavy:
|
|
|
568ccc1 |
cursor.execute("CREATE INDEX ivar1 ON small(var1)")
|
|
|
568ccc1 |
conn.commit()
|
|
|
568ccc1 |
@@ -169,7 +169,7 @@ def createFile(filename, nrows, filters, indexmode, heavy, noise, bfile,
|
|
|
568ccc1 |
cursor.execute("CREATE INDEX ivar3 ON small(var3)")
|
|
|
568ccc1 |
conn.commit()
|
|
|
568ccc1 |
t2 = round(time.time() - time1, 5)
|
|
|
568ccc1 |
- tcpu2 = round(time.clock() - cpu1, 5)
|
|
|
568ccc1 |
+ tcpu2 = round(time.perf_counter() - cpu1, 5)
|
|
|
568ccc1 |
rowseci = nrows / t2
|
|
|
568ccc1 |
print(("Index time:", t2, ", IKRows/s:",
|
|
|
568ccc1 |
round((nrows / 10. ** 3) / t2, 3),))
|
|
|
568ccc1 |
@@ -284,7 +284,7 @@ def readFile(dbfile, nrows, indexmode, heavy, dselect, bfile, riter):
|
|
|
568ccc1 |
for i in range(riter):
|
|
|
568ccc1 |
rnd = random.randrange(nrows)
|
|
|
568ccc1 |
time1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if atom == "string":
|
|
|
568ccc1 |
#cursor.execute(SQL1, "1111")
|
|
|
568ccc1 |
cursor.execute(SQL1, str(rnd)[-4:])
|
|
|
568ccc1 |
@@ -299,7 +299,7 @@ def readFile(dbfile, nrows, indexmode, heavy, dselect, bfile, riter):
|
|
|
568ccc1 |
"atom must take a value in ['string','int','float']")
|
|
|
568ccc1 |
if i == 0:
|
|
|
568ccc1 |
t1 = time.time() - time1
|
|
|
568ccc1 |
- tcpu1 = time.clock() - cpu1
|
|
|
568ccc1 |
+ tcpu1 = time.perf_counter() - cpu1
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
if indexmode == "indexed":
|
|
|
568ccc1 |
# if indexed, wait until the 5th iteration to take
|
|
|
568ccc1 |
@@ -307,10 +307,10 @@ def readFile(dbfile, nrows, indexmode, heavy, dselect, bfile, riter):
|
|
|
568ccc1 |
# effectively cached)
|
|
|
568ccc1 |
if i >= 5:
|
|
|
568ccc1 |
time2 += time.time() - time1
|
|
|
568ccc1 |
- cpu2 += time.clock() - cpu1
|
|
|
568ccc1 |
+ cpu2 += time.perf_counter() - cpu1
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
time2 += time.time() - time1
|
|
|
568ccc1 |
- time2 += time.clock() - cpu1
|
|
|
568ccc1 |
+ time2 += time.perf_counter() - cpu1
|
|
|
568ccc1 |
if riter > 1:
|
|
|
568ccc1 |
if indexmode == "indexed" and riter >= 5:
|
|
|
568ccc1 |
correction = 5
|
|
|
568ccc1 |
diff --git a/bench/stress-test.py b/bench/stress-test.py
|
|
|
568ccc1 |
index 109e7a433..3eb6c9ca0 100644
|
|
|
568ccc1 |
--- a/bench/stress-test.py
|
|
|
568ccc1 |
+++ b/bench/stress-test.py
|
|
|
568ccc1 |
@@ -265,14 +265,14 @@ def testMethod(file, usearray, testwrite, testread, complib, complevel,
|
|
|
568ccc1 |
print("Compression library:", complib)
|
|
|
568ccc1 |
if testwrite:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if usearray:
|
|
|
568ccc1 |
(rowsw, rowsz) = createFileArr(file, ngroups, ntables, nrows)
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, ngroups, ntables, nrows,
|
|
|
568ccc1 |
complevel, complib, recsize)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -284,14 +284,14 @@ def testMethod(file, usearray, testwrite, testread, complib, complevel,
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if testread:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if usearray:
|
|
|
568ccc1 |
(rowsr, rowsz, bufsz) = readFileArr(file,
|
|
|
568ccc1 |
ngroups, recsize, verbose)
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
(rowsr, rowsz, bufsz) = readFile(file, ngroups, recsize, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/bench/stress-test2.py b/bench/stress-test2.py
|
|
|
568ccc1 |
index 1dc91fe8d..9a2868284 100644
|
|
|
568ccc1 |
--- a/bench/stress-test2.py
|
|
|
568ccc1 |
+++ b/bench/stress-test2.py
|
|
|
568ccc1 |
@@ -200,13 +200,13 @@ def dump_garbage():
|
|
|
568ccc1 |
print("Compression library:", complib)
|
|
|
568ccc1 |
if testwrite:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, ngroups, ntables, nrows,
|
|
|
568ccc1 |
complevel, complib, recsize)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -218,12 +218,12 @@ def dump_garbage():
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if testread:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
(rowsr, rowsz, bufsz) = readFile(file, ngroups, recsize, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/bench/stress-test3.py b/bench/stress-test3.py
|
|
|
568ccc1 |
index 42630f597..bed9ec976 100644
|
|
|
568ccc1 |
--- a/bench/stress-test3.py
|
|
|
568ccc1 |
+++ b/bench/stress-test3.py
|
|
|
568ccc1 |
@@ -245,7 +245,7 @@ def dump_garbage():
|
|
|
568ccc1 |
print("Compression library:", complib)
|
|
|
568ccc1 |
if testwrite:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
if usearray:
|
|
|
568ccc1 |
@@ -254,7 +254,7 @@ def dump_garbage():
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, ngroups, ntables, nrows,
|
|
|
568ccc1 |
complevel, complib, recsize)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -266,7 +266,7 @@ def dump_garbage():
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if testread:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
if usearray:
|
|
|
568ccc1 |
@@ -275,7 +275,7 @@ def dump_garbage():
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
(rowsr, rowsz, bufsz) = readFile(file, ngroups, recsize, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/bench/table-bench.py b/bench/table-bench.py
|
|
|
568ccc1 |
index 64d304ba9..e9e176559 100644
|
|
|
568ccc1 |
--- a/bench/table-bench.py
|
|
|
568ccc1 |
+++ b/bench/table-bench.py
|
|
|
568ccc1 |
@@ -372,7 +372,7 @@ def readField(filename, field, rng, verbose):
|
|
|
568ccc1 |
if shuffle:
|
|
|
568ccc1 |
print("Suffling...")
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(createFile)
|
|
|
568ccc1 |
if profile:
|
|
|
568ccc1 |
@@ -389,7 +389,7 @@ def readField(filename, field, rng, verbose):
|
|
|
568ccc1 |
else:
|
|
|
568ccc1 |
(rowsw, rowsz) = createFile(file, iterations, filters, recsize)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
tapprows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpuapprows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpuapprows / tapprows, 2) * 100)
|
|
|
568ccc1 |
@@ -401,7 +401,7 @@ def readField(filename, field, rng, verbose):
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if testread:
|
|
|
568ccc1 |
t1 = time.time()
|
|
|
568ccc1 |
- cpu1 = time.clock()
|
|
|
568ccc1 |
+ cpu1 = time.perf_counter()
|
|
|
568ccc1 |
if psyco_imported and usepsyco:
|
|
|
568ccc1 |
psyco.bind(readFile)
|
|
|
568ccc1 |
# psyco.bind(readField)
|
|
|
568ccc1 |
@@ -413,7 +413,7 @@ def readField(filename, field, rng, verbose):
|
|
|
568ccc1 |
for i in range(1):
|
|
|
568ccc1 |
(rowsr, rowsz) = readFile(file, recsize, verbose)
|
|
|
568ccc1 |
t2 = time.time()
|
|
|
568ccc1 |
- cpu2 = time.clock()
|
|
|
568ccc1 |
+ cpu2 = time.perf_counter()
|
|
|
568ccc1 |
treadrows = round(t2 - t1, 3)
|
|
|
568ccc1 |
cpureadrows = round(cpu2 - cpu1, 3)
|
|
|
568ccc1 |
tpercent = int(round(cpureadrows / treadrows, 2) * 100)
|
|
|
568ccc1 |
diff --git a/tables/index.py b/tables/index.py
|
|
|
568ccc1 |
index e5b3f8321..25300e4c0 100644
|
|
|
568ccc1 |
--- a/tables/index.py
|
|
|
568ccc1 |
+++ b/tables/index.py
|
|
|
568ccc1 |
@@ -23,7 +23,7 @@
|
|
|
568ccc1 |
import tempfile
|
|
|
568ccc1 |
import warnings
|
|
|
568ccc1 |
|
|
|
568ccc1 |
-from time import time, clock
|
|
|
568ccc1 |
+from time import time, perf_counter
|
|
|
568ccc1 |
|
|
|
568ccc1 |
import numpy
|
|
|
568ccc1 |
|
|
|
568ccc1 |
@@ -847,7 +847,7 @@ def do_complete_sort(self):
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if self.verbose:
|
|
|
568ccc1 |
t1 = time()
|
|
|
568ccc1 |
- c1 = clock()
|
|
|
568ccc1 |
+ c1 = perf_counter()
|
|
|
568ccc1 |
ss = self.slicesize
|
|
|
568ccc1 |
tmp = self.tmp
|
|
|
568ccc1 |
ranges = tmp.ranges[:]
|
|
|
568ccc1 |
@@ -953,7 +953,7 @@ def do_complete_sort(self):
|
|
|
568ccc1 |
self.compute_overlaps(self.tmp, "do_complete_sort()", self.verbose)
|
|
|
568ccc1 |
if self.verbose:
|
|
|
568ccc1 |
t = round(time() - t1, 4)
|
|
|
568ccc1 |
- c = round(clock() - c1, 4)
|
|
|
568ccc1 |
+ c = round(perf_counter() - c1, 4)
|
|
|
568ccc1 |
print("time: %s. clock: %s" % (t, c))
|
|
|
568ccc1 |
|
|
|
568ccc1 |
def swap(self, what, mode=None):
|
|
|
568ccc1 |
@@ -968,7 +968,7 @@ def swap(self, what, mode=None):
|
|
|
568ccc1 |
|
|
|
568ccc1 |
if self.verbose:
|
|
|
568ccc1 |
t1 = time()
|
|
|
568ccc1 |
- c1 = clock()
|
|
|
568ccc1 |
+ c1 = perf_counter()
|
|
|
568ccc1 |
if what == "chunks":
|
|
|
568ccc1 |
self.swap_chunks(mode)
|
|
|
568ccc1 |
elif what == "slices":
|
|
|
568ccc1 |
@@ -982,7 +982,7 @@ def swap(self, what, mode=None):
|
|
|
568ccc1 |
rmult = len(mult.nonzero()[0]) / float(len(mult))
|
|
|
568ccc1 |
if self.verbose:
|
|
|
568ccc1 |
t = round(time() - t1, 4)
|
|
|
568ccc1 |
- c = round(clock() - c1, 4)
|
|
|
568ccc1 |
+ c = round(perf_counter() - c1, 4)
|
|
|
568ccc1 |
print("time: %s. clock: %s" % (t, c))
|
|
|
568ccc1 |
# Check that entropy is actually decreasing
|
|
|
568ccc1 |
if what == "chunks" and self.last_tover > 0. and self.last_nover > 0:
|