jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1179385 - in /incubator/jena/Experimental/JenaPerf/trunk: ./ src/main/scala/org/apache/jena/perf/
Date Wed, 05 Oct 2011 19:02:05 GMT
Author: andy
Date: Wed Oct  5 19:02:04 2011
New Revision: 1179385

URL: http://svn.apache.org/viewvc?rev=1179385&view=rev
Log: (empty)

Added:
    incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn   (with props)
    incubator/jena/Experimental/JenaPerf/trunk/run   (with props)
Modified:
    incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
    incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
    incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala

Added: incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn?rev=1179385&view=auto
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn (added)
+++ incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn Wed Oct  5 19:02:04 2011
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+DIRROOT="$1"
+
+if [ "$DIRROOT" = "" ]
+then
+    echo "No directory given" 1>&2
+    exit 1
+    fi
+
+M2_REPO="${M2_REPO:-$HOME/.m2/repository}" ;
+X=$(perl -ne 'next unless /\spath="M2_REPO([^"]*)"/s ; print "$1","\n"' $DIRROOT/.classpath)
+
+CP=
+for x in $X
+do
+   CP="$CP:$M2_REPO$x"
+done
+
+CP="$DIRROOT/classes$CP"
+echo "$CP"
+

Propchange: incubator/jena/Experimental/JenaPerf/trunk/make_classpath_mvn
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jena/Experimental/JenaPerf/trunk/run
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/run?rev=1179385&view=auto
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/run (added)
+++ incubator/jena/Experimental/JenaPerf/trunk/run Wed Oct  5 19:02:04 2011
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+CP="$(make_classpath_mvn .)"
+
+exec java -cp "$CP" org.apache.jena.perf.PerfMain "$@"

Propchange: incubator/jena/Experimental/JenaPerf/trunk/run
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala?rev=1179385&r1=1179384&r2=1179385&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
(original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
Wed Oct  5 19:02:04 2011
@@ -25,19 +25,16 @@ class ActionBuilderManifest(filename: St
   
   val manifest = FileManager.get().loadModel(filename)
   val (label, endpoint) = manifestLabelEndpoint()
-  println("Manifest: "+label+" => "+endpoint)
   
-  val warmUpQueries: List[Entry] = getMix("pm:warmup")
-  val timedRunQueries: List[Entry]  = getMix("pm:suite")
+  private val warmUpQueries: Seq[Action] = getMix("pm:warmup")
+  val actionWarmUp: Action = new ActionN(warmUpQueries)
+  
+  private val timedRunQueries: Seq[Action]  = getMix("pm:suite")
+  val actionTimedRun: Action = new ActionN(timedRunQueries)
   
   def build: Action = new ActionN(actions)
 
-  def actions: Seq[Action] = {
-    val s1 = warmUpQueries.map(qf => new ActionByScheme(qf.name, endpoint, QueryFactory.read(qf.query)).asInstanceOf[Action]
)
-    val s2 = timedRunQueries.map(qf => new ActionByScheme(qf.name, endpoint, QueryFactory.read(qf.query)).asInstanceOf[Action]
)
-    s2 
-  }
-
+  def actions: Seq[Action] = { warmUpQueries ++ timedRunQueries }
   
   // ---- Manifest details.
 
@@ -51,7 +48,7 @@ class ActionBuilderManifest(filename: St
 
   // ---- Mixes.
 
-  private def getMix(prop:String): List[Entry] = {
+  private def getMix(prop:String): Seq[Action] = {
      var qs = "SELECT ?name ?action  " +
      		 "{  ?s rdf:type pm:Manifest ;" +
      		 "      {prop} [ list:member ?mix ] . " +
@@ -60,7 +57,8 @@ class ActionBuilderManifest(filename: St
      		  "}"
      qs = qs.replace("{prop}", prop) ;     		  
      val x = selectQuery(qs)
-     x.map(m => Entry(str(m.get("name").get), str(m.get("action").get)))
+     val y = x.map(m => Entry(str(m.get("name").get), str(m.get("action").get)))
+     y.map(qf => new ActionByScheme(qf.name, endpoint, QueryFactory.read(qf.query)).asInstanceOf[Action]
)
   }
    
   private def queries(): List[Entry] = {
@@ -89,8 +87,7 @@ class ActionBuilderManifest(filename: St
   private def selectQuery(q:Query): List[Map[String, Node]] = {
     import collection.JavaConversions._
     val vars = q.getProjectVars().map(_.getVarName())
-    for(row <- rows(q)) 
-      yield varsFromRow(row, vars)
+    rows(q).map( row => varsFromRow(row, vars) )
   }
 
   private def varsFromRow(row:QuerySolution, vars:Seq[String]): Map[String, Node]= {
@@ -106,11 +103,9 @@ class ActionBuilderManifest(filename: St
   private def str(n:Node):String = NodeFunctions.str(n)
   
   private def rows(q: Query): List[QuerySolution] = {
+    import collection.JavaConversions._
     val qexec = QueryExecutionFactory.create(q, manifest)
     val rs = qexec.execSelect()
-    var x:List[QuerySolution] = Nil
-    while(rs.hasNext()) 
-      x = rs.next :: x
-    x
+    rs.toList
   }
 }
\ No newline at end of file

Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala?rev=1179385&r1=1179384&r2=1179385&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
(original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
Wed Oct  5 19:02:04 2011
@@ -15,34 +15,39 @@ object PerfMain {
    else if ( args.length > 1 )
    {
       Console.err.println("Usage: manifest")
-      exit(1)
+      sys.exit(1)
     }
     
     println("Jena SPARQL Performance testbed")
     println("Manifest file: "+manifestFilename)
+    println
     val manifest = new ActionBuilderManifest(manifestFilename) 
-    println(manifest.label)
+    print(manifest.label)
+    print (" => ")
     println(manifest.endpoint)
+    println
     println("Start  @ "+now())
 
-    val actionBuilder:ActionBuilder = manifest
-    val action = actionBuilder.build 
-    
     val collector = new Collector()
     val monitor = actionMonitorPrint
-    val proc = new ActionProcessorCollector(collector, monitor)
-    val proc2 = new ActionProcessorPrint()
+
     val reporter = new ReporterPrint()
     
     if ( false )
-        enact(proc2, action)
+        enact(new ActionProcessorPrint(), manifest.build)
     
     //val procMon = new ActionProcessorMonitor(proc)
 
     if ( true )
     {
-        enact(proc, action)
-        report(reporter, collector)
+      // Feel wrong there are two ways to do things.
+      // Why not collect twice?
+      println("Warmup")
+      val collector0 = new Collector()
+      enact(new ActionProcessorCollector(collector0, monitor), manifest.actionWarmUp)
+      println("Collect result")
+      enact(new ActionProcessorCollector(collector, monitor), manifest.actionTimedRun)
+      report(reporter, collector)
     }
     
     println("Finish @ "+now())
@@ -60,11 +65,16 @@ object PerfMain {
 //    def build():Action = { new ActionN(List(action1, action2)) }
 //  }
 
-  // Performing : Runner
-  def enact(proc:ActionProcessor, action:Action): Unit =
-    new ActionExecutor(proc).exec(action)
+//  // Performing : Runner
+//  def enact(proc:ActionProcessor, action:Action): Unit =
+//    new ActionExecutor(proc).exec(action)
 
-  // Reporting : reporter
+  // Performing : Runner
+  def enact(proc:ActionProcessor, action:Action): Unit = {
+    val executor = new ActionExecutor(proc)
+    executor.exec(action)
+  }
+    // Reporting : reporter
   def report(reporter: Reporter, collector: Collector): Unit = reporter.report(collector)
   
   val dateFmt:DateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z")

Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala?rev=1179385&r1=1179384&r2=1179385&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala
(original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala
Wed Oct  5 19:02:04 2011
@@ -42,6 +42,10 @@ class Collector {
 
 // ---- Action Processors
 
+class ActionProcessorEnact extends ActionProcessor {
+  def exec(action:ActionStep) : Unit = action.enact()
+}
+
 class ActionProcessorCollector(collector:Collector, monitor:ResultMonitor) extends ActionProcessor
{
   val counter = new AtomicInteger(0)
 
@@ -69,6 +73,10 @@ class ActionProcessorPrint extends Actio
   def exec(action:ActionStep) : Unit = println(action)
 }
 
+class ActionProcessorPrintAnd(proc:ActionProcessor) extends ActionProcessor {
+  def exec(action:ActionStep) : Unit = { println(action) ; proc.exec(action) ; }
+}
+
 class ActionProcessorWrapper(proc:ActionProcessor) extends ActionProcessor {
   override def startAction(action:Action) : Unit    = { proc.startAction(action) }
   override def exec(action:ActionStep) : Unit       = { proc.exec(action) }
@@ -81,6 +89,12 @@ class ActionProcessorMonitor(proc:Action
   override def finishAction(action:Action) : Unit   = { super.finishAction(action) ; println("<
"+action.name) ; }
 }
 
+// ---- Results
+
+//class ResultsBuilder extends ResultMonitor {
+//  def report(action: Action, result: Result)
+//}
+
 // ---- Reporters
 
 class ReporterPrint extends Reporter {



Mime
View raw message