[PATCH] EnableTracing: output from multiple threads may be mixed together
云达(Yunda)
yunda.mly at taobao.com
Thu May 2 06:49:58 PDT 2013
Rickard,
Thanks for the review!
Regards,
Yunda
________________________________________
From: Rickard Bäckman [rickard.backman at oracle.com]
Sent: Thursday, May 02, 2013 13:11
To: 云达(Yunda)
Cc: hotspot-runtime-dev at openjdk.java.net; serviceability-dev at openjdk.java.net
Subject: Re: [PATCH] EnableTracing: output from multiple threads may be mixed together
Yunda,
the change looks good (not a Reviewer).
/R
On May 2, 2013, at 5:07 AM, 云达(Yunda) wrote:
> Could anyone review this for me, please?
>
> Regards,
> Yunda
>
> From: 云达(Yunda)
> Sent: Friday, April 19, 2013 4:26 PM
> To: hotspot-runtime-dev at openjdk.java.net; serviceability-dev at openjdk.java.net
> Subject: [PATCH] EnableTracing: output from multiple threads may be mixed together
>
> Hi all,
>
> I found that the output from multiple threads may be mixed together when using EnableTracing. It happens many times in my test case like this:
>
> Allocation outside TLAB: [Allocation in new TLAB: [Allocation in new TLAB: [Allocation in new TLAB: [Class = [C, Allocation in new TLAB: [Class = [I, Allocation in new TLAB: [Java Monitor Wait: [Class = java/lang/String, Allocation Size = 24, Allocation Size = 24, Class = java/lang/String, Class = [I, Allocation in new TLAB: [Class = [C, Allocation in new TLAB: [Allocation Size = 192]
> Class = com/sun/org/apache/xerces/internal/dom/DeferredElementNSImpl, Allocation Size = 24, Allocation Size = 24, TLAB Size = 23712280]
> TLAB Size = 24607080]
> Allocation Size = 24, Monitor Class = java/lang/ref/Reference$Lock, TLAB Size = 25054480]
> TLAB Size = 25054480]
> Allocation in new TLAB: [Class = [CTLAB Size = 24607080]
> Allocation Size = 72, Class = [C, TLAB Size = 24159728]
> , Allocation Size = 32, TLAB Size = 23712288]
>
> It's very confusing and it's even not easy to tell how many events there are. I think the reason is that the writeEvent() method of each Event* class output the fields of event one by one without using any lock. So I made a small patch which add ttyLocker to writeEvent() method and after applying this patch there's no output mixed together in my test case(againsthttp://hg.openjdk.java.net/hsx/hsx24/hotspot/):
> diff -r edd1619a3ae4 src/share/vm/trace/traceEventClasses.xsl
> --- a/src/share/vm/trace/traceEventClasses.xsl Thu Apr 18 13:50:58 2013 -0700
> +++ b/src/share/vm/trace/traceEventClasses.xsl Fri Apr 19 16:12:38 2013 +0800
> @@ -132,6 +132,7 @@
> void writeEvent(void) {
> ResourceMark rm;
> HandleMark hm;
> + ttyLocker ttyl;
> TraceStream ts(*tty);
> ts.print("<xsl:value-of select="@label"/>: [");
> <xsl:apply-templates select="value|structvalue" mode="write-data"/>
>
>
> I searched before sending this mail I didn't find anyone who covering thisJ
>
> Regards,
> Yunda
>
>
>
> This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.
>
> 本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。
More information about the serviceability-dev
mailing list