Logging of all GC memory access

Thomas Schatzl thomas.schatzl at oracle.com
Mon Jun 8 09:17:29 UTC 2020


Hi,

On 08.06.20 09:56, Ofir Gordon wrote:
> Hello,
> 
> Is there a way to enable logging of any access to memory that the gc
> process is performing? For the purpose of theoretical time analysis.

"Process" as in operating system process, or the general actions taken 
during gc?

> Is there a way to do this using flags or with some external tool? or is
> there a specific place in the code in which adding few lines would enable
> such property?

Your best option (as far as I understand the problem) if you want all 
accesses is probably using your machine's hardware performance counters 
to collect memory accesses, aggregating them by stack trace.

On Linux there is the perf tool, and several vendors provide profilers 
that can read them (e.g. Intel VTune), partially open source. A search 
for "performance counter" in one of the big development platforms (e.g. 
Github) gives hundreds of hits for potentially interesting tools that 
provide access to them.

> I'm familiar with the GC logging flags which provide information about
> execution of collections, but I'm specifically looking for information
> about accesses to memory.
> 
> (I'm working with the jdk-14 source code if it's relevant).

In case of accesses to the Java heap (and not general memory accesses) 
by the VM (that does not include compiled code, but includes "other" 
accesses) you could probably look whether hooking into the Access class 
and derivatives (RawAccess, HeapAccess, ArrayAccess) helps.

> 
> Thanks,
> Ofir
> 

Hth,
   Thomas



More information about the hotspot-gc-dev mailing list