Skip to content

Commit

Permalink
Spanner benchmarks: print() is a function in Python 3 (googleapis#5862)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored and tseaver committed Aug 29, 2018
1 parent 90f3d0b commit fa27f5d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions bigquery/benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
raise Exception('found {0} columsn, expected {1}'.format(len(row), num_cols))
num_rows += 1
total_time = datetime.now() - start_time
print "query {0}: {1} rows, {2} cols, first byte {3} sec, total {4} sec"\
.format(query, num_rows, num_cols, first_byte_time.total_seconds(), total_time.total_seconds())
print("query {0}: {1} rows, {2} cols, first byte {3} sec, total {4} sec"
.format(query, num_rows, num_cols, first_byte_time.total_seconds(), total_time.total_seconds()))
46 changes: 23 additions & 23 deletions spanner/benchmark/ycsb.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,38 +147,38 @@ def aggregate_metrics(latencies_ms, duration_ms, num_bucket):
latency in latencies_ms.iteritems()}
overall_op_count = sum([op_count for op_count in op_counts.itervalues()])

print '[OVERALL], RunTime(ms), %f' % duration_ms
print '[OVERALL], Throughput(ops/sec), %f' % (float(overall_op_count) /
duration_ms * 1000.0)
print('[OVERALL], RunTime(ms), %f' % duration_ms)
print('[OVERALL], Throughput(ops/sec), %f' % (float(overall_op_count) /
duration_ms * 1000.0))

for operation in op_counts.keys():
operation_upper = operation.upper()
print '[%s], Operations, %d' % (operation_upper, op_counts[operation])
print '[%s], AverageLatency(us), %f' % (
operation_upper, numpy.average(latencies_ms[operation]) * 1000.0)
print '[%s], LatencyVariance(us), %f' % (
operation_upper, numpy.var(latencies_ms[operation]) * 1000.0)
print '[%s], MinLatency(us), %f' % (
operation_upper, min(latencies_ms[operation]) * 1000.0)
print '[%s], MaxLatency(us), %f' % (
operation_upper, max(latencies_ms[operation]) * 1000.0)
print '[%s], 95thPercentileLatency(us), %f' % (
print('[%s], Operations, %d' % (operation_upper, op_counts[operation]))
print('[%s], AverageLatency(us), %f' % (
operation_upper, numpy.average(latencies_ms[operation]) * 1000.0))
print('[%s], LatencyVariance(us), %f' % (
operation_upper, numpy.var(latencies_ms[operation]) * 1000.0))
print('[%s], MinLatency(us), %f' % (
operation_upper, min(latencies_ms[operation]) * 1000.0))
print('[%s], MaxLatency(us), %f' % (
operation_upper, max(latencies_ms[operation]) * 1000.0))
print('[%s], 95thPercentileLatency(us), %f' % (
operation_upper,
numpy.percentile(latencies_ms[operation], 95.0) * 1000.0)
print '[%s], 99thPercentileLatency(us), %f' % (
numpy.percentile(latencies_ms[operation], 95.0) * 1000.0))
print('[%s], 99thPercentileLatency(us), %f' % (
operation_upper,
numpy.percentile(latencies_ms[operation], 99.0) * 1000.0)
print '[%s], 99.9thPercentileLatency(us), %f' % (
numpy.percentile(latencies_ms[operation], 99.0) * 1000.0))
print('[%s], 99.9thPercentileLatency(us), %f' % (
operation_upper,
numpy.percentile(latencies_ms[operation], 99.9) * 1000.0)
print '[%s], Return=OK, %d' % (operation_upper, op_counts[operation])
numpy.percentile(latencies_ms[operation], 99.9) * 1000.0))
print('[%s], Return=OK, %d' % (operation_upper, op_counts[operation]))
latency_array = numpy.array(latencies_ms[operation])
for j in range(num_bucket):
print '[%s], %d, %d' % (
print('[%s], %d, %d' % (
operation_upper, j,
((j <= latency_array) & (latency_array < (j + 1))).sum())
print '[%s], >%d, %d' % (operation_upper, num_bucket,
(num_bucket <= latency_array).sum())
((j <= latency_array) & (latency_array < (j + 1))).sum()))
print('[%s], >%d, %d' % (operation_upper, num_bucket,
(num_bucket <= latency_array).sum()))


class WorkloadThread(threading.Thread):
Expand Down

0 comments on commit fa27f5d

Please sign in to comment.