RFR: 8317453: NMT: Performance benchmarks are needed to measure speed and memory [v11]

Coleen Phillimore coleenp at openjdk.org
Mon Jan 27 15:33:47 UTC 2025


On Thu, 23 Jan 2025 17:40:29 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> Here is another, hopefully, closer to the final iteration of NMT benchmarking mechanism.
>> 
>> We create 2 static instances: one NMT_MemoryLogRecorder the other NMT_VirtualMemoryLogRecorder.
>> 
>> VM interacts with these through these APIs:
>> 
>>   ```
>>   NMT_LogRecorder::initialize(NMTRecordMemoryAllocations, NMTRecordVirtualMemoryAllocations);
>>   NMT_LogRecorder::replay(NMTBenchmarkRecordedDir, NMTBenchmarkRecordedPID);
>>   NMT_LogRecorder::logThreadName(name);
>>   NMT_LogRecorder::finish();
>> 
>> 
>> For controlling their liveness and through their "log" APIs for the actual logging.
>> 
>> For memory logger those are:
>> 
>> 
>>   NMT_MemoryLogRecorder::log_malloc(mem_tag, outer_size, outer_ptr, &stack);
>>   NMT_MemoryLogRecorder::log_realloc(mem_tag, new_outer_size, new_outer_ptr, header, &stack);
>>   NMT_MemoryLogRecorder::log_free(old_outer_ptr);
>> 
>> 
>> and for virtual memory logger, those are:
>> 
>> 
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_reserve((address)addr, size, stack, mem_tag);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_release((address)addr, size);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_uncommit((address)addr, size);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_reserve_and_commit((address)addr, size, stack, mem_tag);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_commit((address)addr, size, stack);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_split_reserved((address)addr, size, split, mem_tag, split_tag);
>>       NMT_VirtualMemoryLogRecorder::log_virtual_memory_tag((address)addr, mem_tag);
>> 
>> 
>> That's the entirety of the surface area of the new code.
>> 
>> The actual implementation extends one existing VM API:
>> 
>> `bool Arguments::copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen, int pid)
>> `
>> 
>> and adds a few APIs to permit_forbidden_function.hpp:
>> 
>> 
>>  inline char *strtok(char *str, const char *sep) { return ::strtok(str, sep); }
>>  inline long strtol(const char *str, char **endptr, int base) { return ::strtol(str, endptr, base); }
>> 
>>  #if defined(LINUX)
>>  inline size_t malloc_usable_size(void *_Nullable ptr) { return ::malloc_usable_size(ptr); }
>>  #elif defined(WINDOWS)
>>  inline size_t _msize(void *memblock) { return ::_msize(memblock); }
>>  #elif defined(__APPLE__)
>>  inline size_t malloc_size(const void *ptr) { return ::malloc_size(ptr); }
>>  #endif
>> 
>> 
>> Those are need if we want to calculate the memory overhead
>> 
>> To u...
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   more detail in summary

This change fails jcheck and GHA because it doesn't build.  Can you fix these problems before people start reviewing?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23115#issuecomment-2616076480


More information about the hotspot-dev mailing list