summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-12-09 20:04:39 -0800
committerPaul Phillips <paulp@improving.org>2011-12-09 20:04:39 -0800
commit3ea73554823ad3f64f5d71bc08f8b9d71e67d78c (patch)
treef633e7f75a8430128546ce339968b11d0bc5c069
parentc6f57d77009a7995234f17b7a94fb970128c29de (diff)
parent878896577ec6865899e2e4a6f9fe18574cad4ebc (diff)
downloadscala-3ea73554823ad3f64f5d71bc08f8b9d71e67d78c.tar.gz
scala-3ea73554823ad3f64f5d71bc08f8b9d71e67d78c.tar.bz2
scala-3ea73554823ad3f64f5d71bc08f8b9d71e67d78c.zip
Merge remote-tracking branch 'origin/master' into xsbt
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala28
-rwxr-xr-xtools/epfl-publish17
2 files changed, 41 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index b4f14dd21b..f14474eda8 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -343,7 +343,14 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
def run() {
echoPhaseSummary(this)
- currentRun.units foreach applyPhase
+ currentRun.units foreach { unit =>
+ if (opt.timings) {
+ val start = System.nanoTime
+ try applyPhase(unit)
+ finally unitTimings(unit) += (System.nanoTime - start)
+ }
+ else applyPhase(unit)
+ }
}
def apply(unit: CompilationUnit): Unit
@@ -669,6 +676,21 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
protected lazy val phasesSet = new mutable.HashSet[SubComponent]
protected lazy val phasesDescMap = new mutable.HashMap[SubComponent, String] withDefaultValue ""
private lazy val phaseTimings = new Phases.TimingModel // tracking phase stats
+ private lazy val unitTimings = mutable.HashMap[CompilationUnit, Long]() withDefaultValue 0L // tracking time spent per unit
+ private def unitTimingsFormatted(): String = {
+ def toMillis(nanos: Long) = "%.3f" format nanos / 1000000d
+
+ val formatter = new util.TableDef[(String, String)] {
+ >> ("ms" -> (_._1)) >+ " "
+ << ("path" -> (_._2))
+ }
+ "" + (
+ new formatter.Table(unitTimings.toList sortBy (-_._2) map {
+ case (unit, nanos) => (toMillis(nanos), unit.source.path)
+ })
+ )
+ }
+
protected def addToPhasesSet(sub: SubComponent, descr: String) {
phasesSet += sub
phasesDescMap(sub) = descr
@@ -1149,8 +1171,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
if (opt.profileAll)
profiler.stopProfiling()
- if (opt.timings)
+ if (opt.timings) {
inform(phaseTimings.formatted)
+ inform(unitTimingsFormatted)
+ }
// In case no phase was specified for -Xshow-class/object, show it now for sure.
if (opt.noShow)
diff --git a/tools/epfl-publish b/tools/epfl-publish
index 2c0141e264..e9cd97b3d2 100755
--- a/tools/epfl-publish
+++ b/tools/epfl-publish
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
#
# publishes nightly build if $publish_to is set in environment.
+# alternate maven settings.xml file given in $maven_settings.
#
[[ $# -eq 1 ]] || {
@@ -20,7 +21,19 @@ version="$1"
}
# should not be hardcoded
-mavenSettings="/home/linuxsoft/apps/hudson-maven-settings/settings.xml"
+# adds -Dsettings.file= if fixed path is present
+mavenSettingsOption () {
+ hardcoded_path="/home/linuxsoft/apps/hudson-maven-settings/settings.xml"
+
+ # environment variable
+ if [[ -n $maven_settings ]]; then
+ echo -Dsettings.file="$maven_settings"
+ elif [[ -f $hardcoded_path ]]; then
+ echo -Dsettings.file="$hardcoded_path"
+ fi
+}
+
+mavenSettings=${maven_settings:-findMavenSettings}
if [[ -z $publish_to ]]; then
echo "Nothing to publish."
@@ -33,5 +46,5 @@ else
# sbaz
[[ -d dists/sbaz ]] && rsync -az dists/sbaz/ "$publish_to/sbaz"
# Deploy the maven artifacts on scala-tools.org
- ( cd dists/maven/latest && ant deploy.snapshot -Dsettings.file="$mavenSettings" )
+ ( cd dists/maven/latest && ant deploy.snapshot $(mavenSettingsOption) )
fi