You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StatisticsHelper.java generates information about the garbage collector during a benchmark task.
Here's a snippet that winds up at the end of a ".stdout" log file:
Garbage Generated in Young Generation: 48913.992 MiB
Garbage Generated in Survivor Generation: 69.45353 MiB
Garbage Generated in Old Generation: 66.00384 MiB
Due to a bug, those numbers if done today will all be zero. StatisticsHelper.run calls Thread.currentThread().setDaemon(true); which looked wrong to me, and sure enough was causing an IllegalStateException on the thread (or something like that if I recall). A Runnable being invoked by an Executor ought not to mess with the state of it's thread. And I think it's unnecessary to try to make these threads daemons since stopStatistics() will cancel then shut it down.
Note quite related: I also thought it prudent to explicitly call run() from stopStatistics so we get the very latest information.
Another aside: it's suspicious to see all these volatile fields and furthermore "+=" operations on them. I don't think there are thread-safety concerns; they can all be regular fields. I don't think there needs to be synchronization in this class either. Calling executor.shutdown() triggers a happens-before relationship with the state modified by the task thread.
I could submit a PR if desired.
CC @shaie whom I suspect wrote StatisticsHelper originally
The text was updated successfully, but these errors were encountered:
StatisticsHelper.java generates information about the garbage collector during a benchmark task.
Here's a snippet that winds up at the end of a ".stdout" log file:
Due to a bug, those numbers if done today will all be zero. StatisticsHelper.run calls
Thread.currentThread().setDaemon(true);
which looked wrong to me, and sure enough was causing an IllegalStateException on the thread (or something like that if I recall). A Runnable being invoked by an Executor ought not to mess with the state of it's thread. And I think it's unnecessary to try to make these threads daemons since stopStatistics() will cancel then shut it down.Note quite related: I also thought it prudent to explicitly call run() from stopStatistics so we get the very latest information.
Another aside: it's suspicious to see all these volatile fields and furthermore "+=" operations on them. I don't think there are thread-safety concerns; they can all be regular fields. I don't think there needs to be synchronization in this class either. Calling executor.shutdown() triggers a happens-before relationship with the state modified by the task thread.
I could submit a PR if desired.
CC @shaie whom I suspect wrote StatisticsHelper originally
The text was updated successfully, but these errors were encountered: