Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-08-15 Thread Markus Gaisbauer
*"Hohensee, Paul" > *Cc: *"daniel.daughe...@oracle.com" , " > serviceability-dev@openjdk.java.net" , > "erik.osterl...@oracle.com" , " > robbin@oracle.com" > *Subject: *Re: ThreadMXBean::getCurrentThreadAllocatedByte

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-16 Thread Hohensee, Paul
: Markus Gaisbauer Date: Monday, July 16, 2018 at 12:50 PM To: "Hohensee, Paul" Cc: "daniel.daughe...@oracle.com" , "serviceability-dev@openjdk.java.net" , "erik.osterl...@oracle.com" , "robbin@oracle.com" Subject: Re: ThreadMXBean::getCurr

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-16 Thread Markus Gaisbauer
I saw Daniels comment too late, but using THREAD instead of JavaThread::current() indeed makes the new method again a bit simpler and faster (now 33 ns instead of 35 ns). JVM_ENTRY(jlong, jmm_GetCurrentThreadAllocatedMemory(JNIEnv *env)) return THREAD->cooked_allocated_bytes(); JVM_END On Mon,

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-16 Thread Markus Gaisbauer
Hi, Thank you for all the help. ​I added the code suggested by Paul and ran my small microbenchmark. The optimized getThreadAllocatedBytes now takes 57 ns if fed with the ID of the current thread. All calls that aren't for the current thread will be a bit slower. As far as I am concerned, adding

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-16 Thread Daniel D. Daugherty
" *Reply-To: *"daniel.daughe...@oracle.com" *Date: *Friday, July 13, 2018 at 1:53 PM *To: *Markus Gaisbauer , "serviceability-dev@openjdk.java.net" , Erik Österlund , Robbin Ehn *Subject: *Re: ThreadMXBean::getCurrentThreadAllocatedBytes Markus, I fil

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-16 Thread Hohensee, Paul
lf of "Daniel D. Daugherty" Reply-To: "daniel.daughe...@oracle.com" Date: Friday, July 13, 2018 at 1:53 PM To: Markus Gaisbauer , "serviceability-dev@openjdk.java.net" , Erik Österlund , Robbin Ehn Subject: Re: ThreadMXBean::getCurrentThreadAlloca

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-13 Thread Daniel D. Daugherty
Markus, I filed the following bug for you:     JDK-8207266 ThreadMXBean::getThreadAllocatedBytes() can be quicker for self thread     https://bugs.openjdk.java.net/browse/JDK-8207266 Dan On 7/13/18 4:46 PM, Daniel D. Daugherty wrote: On 7/13/18 2:44 PM, Daniel D. Daugherty wrote: On 7/13/

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-13 Thread Daniel D. Daugherty
On 7/13/18 2:44 PM, Daniel D. Daugherty wrote: On 7/13/18 12:35 PM, Markus Gaisbauer wrote: Hello, I am trying to use ThreadMXBean::getThreadAllocatedBytes (com.sun.management) to get the amount of allocated memory of the current thread in some performance critical code. Unfortunately, the

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-13 Thread Daniel D. Daugherty
On 7/13/18 12:35 PM, Markus Gaisbauer wrote: Hello, I am trying to use ThreadMXBean::getThreadAllocatedBytes (com.sun.management) to get the amount of allocated memory of the current thread in some performance critical code. Unfortunately, the current implementation can be rather slow and th

Re: ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-13 Thread Gary Adams
Here's the starting point for openjdk contributing: http://openjdk.java.net/contribute/ Here's your post in the mail archives : http://mail.openjdk.java.net/pipermail/serviceability-dev/2018-July/024441.html Most people will post a webrev to cr.openjdk.java.net for larger changesets. Most

ThreadMXBean::getCurrentThreadAllocatedBytes

2018-07-13 Thread Markus Gaisbauer
Hello, I am trying to use ThreadMXBean::getThreadAllocatedBytes (com.sun.management) to get the amount of allocated memory of the current thread in some performance critical code. Unfortunately, the current implementation can be rather slow and the duration of each call unpredictable. I ran a tes