~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to src/compiler/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @author Vlad Ureche
 
3
 */
 
4
package scala.tools.nsc.doc
 
5
package html.page.diagram
 
6
 
 
7
object DiagramStats {
 
8
 
 
9
  class TimeTracker(title: String) {
 
10
    var totalTime: Long = 0l
 
11
    var maxTime: Long = 0l
 
12
    var instances: Int = 0
 
13
 
 
14
    def addTime(ms: Long) = {
 
15
      if (maxTime < ms)
 
16
        maxTime = ms
 
17
      totalTime += ms
 
18
      instances += 1
 
19
    }
 
20
 
 
21
    def printStats(print: String => Unit) = {
 
22
      if (instances == 0)
 
23
        print(title + ": no stats gathered")
 
24
      else {
 
25
        print("  " + title)
 
26
        print("  " + "=" * title.length)
 
27
        print("    count:        " + instances + " items")
 
28
        print("    total time:   " + totalTime + " ms")
 
29
        print("    average time: " + (totalTime/instances) + " ms")
 
30
        print("    maximum time: " + maxTime + " ms")
 
31
        print("")
 
32
      }
 
33
    }
 
34
  }
 
35
 
 
36
  private[this] val filterTrack = new TimeTracker("diagrams model filtering")
 
37
  private[this] val modelTrack = new TimeTracker("diagrams model generation")
 
38
  private[this] val dotGenTrack = new TimeTracker("dot diagram generation")
 
39
  private[this] val dotRunTrack = new TimeTracker("dot process runnning")
 
40
  private[this] val svgTrack = new TimeTracker("svg processing")
 
41
  private[this] var brokenImages = 0
 
42
  private[this] var fixedImages = 0
 
43
 
 
44
  def printStats(settings: Settings) = {
 
45
    if (settings.docDiagramsDebug.value) {
 
46
      settings.printMsg("\nDiagram generation running time breakdown:\n")
 
47
      filterTrack.printStats(settings.printMsg)
 
48
      modelTrack.printStats(settings.printMsg)
 
49
      dotGenTrack.printStats(settings.printMsg)
 
50
      dotRunTrack.printStats(settings.printMsg)
 
51
      svgTrack.printStats(settings.printMsg)
 
52
      println("  Broken images: " + brokenImages)
 
53
      println("  Fixed images: " + fixedImages)
 
54
      println("")
 
55
    }
 
56
  }
 
57
 
 
58
  def addFilterTime(ms: Long) = filterTrack.addTime(ms)
 
59
  def addModelTime(ms: Long) = modelTrack.addTime(ms)
 
60
  def addDotGenerationTime(ms: Long) = dotGenTrack.addTime(ms)
 
61
  def addDotRunningTime(ms: Long) = dotRunTrack.addTime(ms)
 
62
  def addSvgTime(ms: Long) = svgTrack.addTime(ms)
 
63
 
 
64
  def addBrokenImage(): Unit = brokenImages += 1
 
65
  def addFixedImage(): Unit = fixedImages += 1
 
66
}
 
 
b'\\ No newline at end of file'