Skip to content

Commit

Permalink
util/util-jvm: Add support for g1 allocation stats
Browse files Browse the repository at this point in the history
Problem

Currently we only support ParNew collector for eden allocation stats.

Solution

Support G1 as well.

Differential Revision: https://phabricator.twitter.biz/D1182243
  • Loading branch information
jcrossley authored and jenkins committed Nov 12, 2024
1 parent 1d6ff9b commit 7d74b9c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions util-jvm/src/main/scala/com/twitter/jvm/Allocations.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.twitter.jvm

import com.twitter.finagle.stats.StatsReceiver
import java.lang.management.{MemoryPoolMXBean, MemoryUsage, ManagementFactory}
import java.lang.management.MemoryPoolMXBean
import java.lang.management.MemoryUsage
import java.lang.management.ManagementFactory
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.atomic.AtomicLong
import java.util.{List => juList}
import javax.management.openmbean.{CompositeData, TabularData}
import javax.management.{
ListenerNotFoundException,
Notification,
NotificationListener,
NotificationEmitter
}
import javax.management.openmbean.CompositeData
import javax.management.openmbean.TabularData
import javax.management.ListenerNotFoundException
import javax.management.Notification
import javax.management.NotificationListener
import javax.management.NotificationEmitter
import scala.collection.mutable
import scala.jdk.CollectionConverters._

Expand All @@ -30,8 +31,7 @@ private[jvm] class Allocations(statsReceiver: StatsReceiver) {

private[this] val edenPool: Option[MemoryPoolMXBean] =
ManagementFactory.getMemoryPoolMXBeans.asScala.find { bean =>
// todo: see if we can support the g1 collector
bean.getName == "Par Eden Space" || bean.getName == "PS Eden Space"
bean.getName == "Par Eden Space" || bean.getName == "PS Eden Space" || bean.getName == "G1 Eden Space"
}

private[this] val edenSizeAfterLastGc = new AtomicLong()
Expand Down

0 comments on commit 7d74b9c

Please sign in to comment.