summaryrefslogtreecommitdiff
path: root/src/partest/scala/tools/partest/MemoryTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/partest/scala/tools/partest/MemoryTest.scala')
-rw-r--r--src/partest/scala/tools/partest/MemoryTest.scala38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/partest/scala/tools/partest/MemoryTest.scala b/src/partest/scala/tools/partest/MemoryTest.scala
deleted file mode 100644
index 58d25d2f01..0000000000
--- a/src/partest/scala/tools/partest/MemoryTest.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-package scala.tools.partest
-
-abstract class MemoryTest {
- def maxDelta: Double
- def calcsPerIter: Int
- def calc(): Unit
-
- def main(args: Array[String]) {
- val rt = Runtime.getRuntime()
- def memUsage() = {
- import java.lang.management._
- import scala.collection.JavaConverters._
- val pools = ManagementFactory.getMemoryPoolMXBeans.asScala
- pools.map(_.getUsage.getUsed).sum / 1000000d
- }
-
- val history = scala.collection.mutable.ListBuffer[Double]()
- def stressTestIter() = {
- var i = 0
- while (i < calcsPerIter) { calc(); i += 1 }
- 1 to 5 foreach (_ => rt.gc())
- history += memUsage
- }
-
- 1 to 5 foreach (_ => stressTestIter())
- val reference = memUsage()
- 1 to 5 foreach (_ => stressTestIter())
- 1 to 5 foreach (_ => rt.gc())
- val result = memUsage()
- history += result
-
- val delta = result - reference
- if (delta > maxDelta) {
- println("FAILED")
- history foreach (mb => println(mb + " Mb"))
- }
- }
-}