summaryrefslogtreecommitdiff
path: root/testing/tests/benchmarks/test_cpu.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-04-26 18:01:46 +0200
committerdrebs <drebs@leap.se>2017-04-27 10:02:21 +0200
commitaa9a13549eb30efa1f0528257e40fd67ebdfbee9 (patch)
tree77a759abd242408a2f05643b5589e6fe4bf1244b /testing/tests/benchmarks/test_cpu.py
parentc08083e9dfd38f93eb67d234e85b47efa211045c (diff)
[test] add memory measurement
Diffstat (limited to 'testing/tests/benchmarks/test_cpu.py')
-rw-r--r--testing/tests/benchmarks/test_cpu.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/testing/tests/benchmarks/test_cpu.py b/testing/tests/benchmarks/test_cpu.py
deleted file mode 100644
index fba6a6d4..00000000
--- a/testing/tests/benchmarks/test_cpu.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import pytest
-import random
-import time
-
-from decimal import Decimal
-
-
-def bellardBig(n):
- # http://en.wikipedia.org/wiki/Bellard%27s_formula
- pi = Decimal(0)
- k = 0
- while k < n:
- pi += (Decimal(-1) ** k / (1024 ** k)) * (
- Decimal(256) / (10 * k + 1) +
- Decimal(1) / (10 * k + 9) -
- Decimal(64) / (10 * k + 3) -
- Decimal(32) / (4 * k + 1) -
- Decimal(4) / (10 * k + 5) -
- Decimal(4) / (10 * k + 7) -
- Decimal(1) / (4 * k + 3))
- k += 1
- pi = pi * 1 / (2 ** 6)
- return pi
-
-
-def test_long_operation(monitored_benchmark):
-
- def _long_operation():
- sleep = [random.uniform(0.5, 1.5) for _ in xrange(3)]
- while sleep:
- t = sleep.pop()
- time.sleep(t)
- bellardBig(int((10 ** 3) * t))
-
- results = monitored_benchmark(_long_operation)
- print results