alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (IOStats.scala)

This example Scala source code file (IOStats.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Scala source code examples by using tags.

All credit for the original source code belongs to scala-lang.org; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Scala tags/keywords

iostats, reflection, utilities

The IOStats.scala Scala example source code

package scala
package reflect.io

import scala.reflect.internal.util.Statistics

// Due to limitations in the Statistics machinery, these are only
// reported if this patch is applied.
//
// --- a/src/reflect/scala/reflect/internal/util/Statistics.scala
// +++ b/src/reflect/scala/reflect/internal/util/Statistics.scala
// @@ -109,7 +109,7 @@ quant)
//     *  Quantities with non-empty prefix are printed in the statistics info.
//     */
//    trait Quantity {
// -    if (enabled && prefix.nonEmpty) {
// +    if (prefix.nonEmpty) {
//        val key = s"${if (underlying != this) underlying.prefix else ""}/$prefix"
//        qs(key) = this
//      }
// @@ -243,7 +243,7 @@ quant)
//     *
//     *  to remove all Statistics code from build
//     */
// -  final val canEnable = _enabled
// +  final val canEnable = true // _enabled
//
// We can commit this change as the first diff reverts a fix for an IDE memory leak.
private[io] object IOStats {
  val fileExistsCount      = Statistics.newCounter("# File.exists calls")
  val fileIsDirectoryCount = Statistics.newCounter("# File.isDirectory calls")
  val fileIsFileCount      = Statistics.newCounter("# File.isFile calls")
}

Other Scala source code examples

Here is a short list of links related to this Scala IOStats.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.