Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

User can now input number of iterations

  • Loading branch information...
commit 78251acbc26b647431c0d034e15aa7796ffbb2da 1 parent 07e862e
@mslinn authored
View
BIN  lib/SwingExtras.jar
Binary file not shown
View
4 src/main/scala/com/micronautics/akka/benchmark/ExecutorBenchmark.scala
@@ -79,10 +79,10 @@ object ExecutorBenchmark extends App {
//system1 -> "ActorSystem & fork-join-executor",
//system2 -> "ActorSystem & thread-pool-executor, parallelism-factor=3",
//system3 -> "Akka ActorSystem w/ thread-pool-executor & parallelism-factor=1",
- //esFJP -> "Updated ForkJoinPool",
+ esFJP -> "Updated ForkJoinPool"
//esFTP1 -> "FixedThreadPool w/ nProcessors=1",
//esFTPn -> "FixedThreadPool w/ nProcessors=%d".format(nProcessors),
- esCTP -> "CachedThreadPool"
+ //esCTP -> "CachedThreadPool"
//esSTE -> "SingleThreadExecutor"
)
}
View
22 src/main/scala/com/micronautics/akka/benchmark/Gui.scala
@@ -30,19 +30,21 @@ import scala.swing._
import org.jfree.data.category.DefaultCategoryDataset
import org.jfree.ui.{TextAnchor, RectangleInsets}
import org.jfree.chart.labels.{ItemLabelPosition, ItemLabelAnchor, StandardCategoryItemLabelGenerator}
-import javax.swing.{JPanel, WindowConstants}
import scala.swing.event._
import javax.swing.border.EmptyBorder
import java.util.{Collections, Properties}
+import com.lamatek.swingextras.JNumericField
+import javax.swing.{JTextField, JPanel, WindowConstants}
/**
* @author Mike Slinn */
class Gui (benchmark: Benchmark) extends SimpleSwingApplication with PersistableApp {
private val dataset = new DefaultCategoryDataset()
private val barChart = ChartFactory.createBarChart("", "", "milliseconds", dataset, PlotOrientation.HORIZONTAL, true, true, false)
- var chartPanel: ChartPanel = null
- var navigator: Navigator = null
- val barHeight = 125
+ private var chartPanel: ChartPanel = null
+ private var navigator: Navigator = null
+ private val barHeight = 125
+ private val numericField = new JNumericField(9, JNumericField.INTEGER)
private val attribution = new Label() { // The license requires this block to remain untouched
text = "Copyright Micronautics Research Corporation. All rights reserved."
@@ -57,6 +59,7 @@ class Gui (benchmark: Benchmark) extends SimpleSwingApplication with Persistable
attribution.peer.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT)
+
def addValue(testResult: TestResult, isWarmup: Boolean): DefaultCategoryDataset = {
dataset.addValue(testResult.millis, testResult.testName, if (isWarmup) Benchmark.strWarmup else Benchmark.strTimed)
dataset
@@ -144,6 +147,7 @@ class Gui (benchmark: Benchmark) extends SimpleSwingApplication with Persistable
Benchmark.numInterations = props.getOrElse("numInterations", "1000").toInt
Benchmark.consoleOutput = props.getOrElse("consoleOutput", "true").toBoolean
navigator.checkboxShowWarmup.selected = Benchmark.showWarmUpTimes
+ numericField.setValue(Benchmark.numInterations)
}
private def saveProperties(location: Point, size: Dimension) {
@@ -183,7 +187,12 @@ class Gui (benchmark: Benchmark) extends SimpleSwingApplication with Persistable
val itemHeight:Int = 20
var index = 0
+ numericField.setMaximumSize(new Dimension(numericField.getPreferredSize.getWidth.toInt, itemHeight))
+ numericField.setAlignmentX(4) // RIGHT
+
contents += checkboxShowWarmup
+ peer.add(numericField)
+ contents += new Label(" iterations ")
contents += buttonRun
listenTo(checkboxShowWarmup)
@@ -192,8 +201,9 @@ class Gui (benchmark: Benchmark) extends SimpleSwingApplication with Persistable
reactions += {
case ButtonClicked(`buttonRun`) =>
computeChartPanelSize
- dataset.clear()
- benchmark.run()
+ dataset.clear
+ Benchmark.numInterations = numericField.getInteger
+ benchmark.run
case ButtonClicked(`checkboxShowWarmup`) =>
Benchmark.showWarmUpTimes = checkboxShowWarmup.selected
ExecutorBenchmark.reset
Please sign in to comment.
Something went wrong with that request. Please try again.