Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GC Metrics #12

Merged

Conversation

bilalbari
Copy link
Collaborator

No description provided.

Signed-off-by: Sayed Bilal Bari <[email protected]>
Comment on lines 123 to 129
private def getGcMetrics: (Any, Any) = {
val gcBeans = ManagementFactory.getGarbageCollectorMXBeans
val gcTime = gcBeans.map(_.getCollectionTime).sum
val gcCount = gcBeans.map(_.getCollectionCount).sum
(gcTime, gcCount)
}

Copy link
Owner

@amahussein amahussein Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move this to the RuntimeUtil, then we can use any where as a utility function regardless it is part of the benchmark or not.
Also, we can return a case class


case class JVMGCInfo(val gcCount: Long, val gcTime: Long, val: totalHeap: Long, val usedHeap: Long, val freeHeap: Long)

After we do that we can also define another object to manage snapshots (similar to the timer)
But we probably need another manager to handle start/end to return the diff instead of flatenning the code. We can do the manager class together after you update the PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added changes to handle the above. Added memory tracker class. Also added tracking of average used memory, average free memory and max heap allocation

bilalbari added 2 commits July 3, 2024 15:10
Signed-off-by: Sayed Bilal Bari <[email protected]>
Copy link
Owner

@amahussein amahussein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • NaN in stdev calculation.
  • The relative value can have two decimal points instead of just 1.

Signed-off-by: Sayed Bilal Bari <[email protected]>
@@ -99,18 +99,31 @@ class Benchmark(

val firstBest = results.head.bestMs
// The results are going to be processor specific so it is useful to include that.
out.println(RuntimeUtil.getJVMOSInfo.mkString("\n"))
val jvmInfo = RuntimeUtil.getJVMOSInfo
out.printf(s"%-26s -> %-30s \n","JVM Name", jvmInfo("jvm.name"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make it more standard : instead of ->

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected

out.printf(s"%-26s -> %-30s \n","Java Version",jvmInfo("jvm.version"))
out.printf(s"%-26s -> %-30s \n","OS Name",jvmInfo("os.name"))
out.printf(s"%-26s -> %-30s \n","OS Version",jvmInfo("os.version"))
out.printf(s"%-26s -> %-30s \n","MaxHeapMemory", ("%6d" format Runtime.getRuntime.maxMemory()/1024/1024)+"MB")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%6d will cause the string not to be aligned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected

out.printf(s"%-26s -> %-30s \n","OS Name",jvmInfo("os.name"))
out.printf(s"%-26s -> %-30s \n","OS Version",jvmInfo("os.version"))
out.printf(s"%-26s -> %-30s \n","MaxHeapMemory", ("%6d" format Runtime.getRuntime.maxMemory()/1024/1024)+"MB")
out.printf(s"%-26s -> %-30s \n","Total Warm Up Iterations","%2d" format warmUpIterations)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%2d will not be aligned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected

out.printf(s"%-26s -> %-30s \n","OS Version",jvmInfo("os.version"))
out.printf(s"%-26s -> %-30s \n","MaxHeapMemory", ("%6d" format Runtime.getRuntime.maxMemory()/1024/1024)+"MB")
out.printf(s"%-26s -> %-30s \n","Total Warm Up Iterations","%2d" format warmUpIterations)
out.printf(s"%-26s -> %-30s \n \n","Total Runtime Iterations","%2d" format minNumIters)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%2d waon't be alogned

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected

@@ -27,23 +27,28 @@ import com.nvidia.spark.rapids.tool.qualification.QualificationMain.mainInternal
* 2. Write the benchmark code in the runBenchmark method passing relevant arguments
* 3. Write benchmarked code inside
*/
object QualificationBenchmark extends BenchmarkBase {
object QualificationToolBenchmark extends BenchmarkBase {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can call this SingleThreadedQualTool and set the number of threads to be 1.
In tht case, when someone is running the benchmark with multiple eventlogs, it will be forced to be single threaded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@amahussein amahussein merged commit 1026e69 into spark-rapids-tools-1120 Jul 5, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants