override def handleNotification()

in util-jvm/src/main/scala/com/twitter/jvm/Allocations.scala [145:172]


    override def handleNotification(notification: Notification, handback: Any): Unit = {
      val userData = notification.getUserData match {
        case cd: CompositeData if cd.containsKey("gcInfo") => cd
        case _ => return
      }
      val gcInfo = userData.get("gcInfo") match {
        case cd: CompositeData => cd
        case _ => return
      }

      if (gcInfo.containsKey("duration")) {
        gcInfo.get("duration") match {
          case duration: java.lang.Long => edenGcPauses.add(duration.floatValue)
          case _ =>
        }
      }

      if (!gcInfo.containsKey("memoryUsageBeforeGc") || !gcInfo.containsKey("memoryUsageAfterGc"))
        return

      for {
        beforeGc <- edenMemoryUsageFrom(gcInfo.get("memoryUsageBeforeGc")).map(_.getUsed)
        afterGc <- edenMemoryUsageFrom(gcInfo.get("memoryUsageAfterGc")).map(_.getUsed)
      } {
        edenAllocated.addAndGet(beforeGc - afterGc)
        edenSizeAfterLastGc.set(afterGc)
      }
    }