Skip to content

Commit

Permalink
[#10547] add zgc(java gc) type to the agent
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehong-kim committed Dec 21, 2023
1 parent bb04317 commit 600bb2b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public JvmGcType map(final PJvmGcType type) {
return JvmGcType.CMS;
case JVM_GC_TYPE_G1:
return JvmGcType.G1;
case JVM_GC_TYPE_ZGC:
return JvmGcType.ZGC;
default:
return JvmGcType.UNKNOWN;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2023 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.mapper.grpc.stat;

import com.navercorp.pinpoint.common.server.bo.JvmGcType;
import com.navercorp.pinpoint.grpc.trace.PJvmGcType;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class GrpcJvmGcTypeMapperTest {

@Test
public void map() throws Exception {
GrpcJvmGcTypeMapper mapper = new GrpcJvmGcTypeMapper();
JvmGcType jvmGcType = mapper.map(PJvmGcType.JVM_GC_TYPE_CMS);
assertEquals(jvmGcType, JvmGcType.CMS);
jvmGcType = mapper.map(PJvmGcType.JVM_GC_TYPE_G1);
assertEquals(jvmGcType, JvmGcType.G1);
jvmGcType = mapper.map(PJvmGcType.JVM_GC_TYPE_SERIAL);
assertEquals(jvmGcType, JvmGcType.SERIAL);
jvmGcType = mapper.map(PJvmGcType.JVM_GC_TYPE_PARALLEL);
assertEquals(jvmGcType, JvmGcType.PARALLEL);
jvmGcType = mapper.map(PJvmGcType.JVM_GC_TYPE_ZGC);
assertEquals(jvmGcType, JvmGcType.ZGC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum JvmGcType {
SERIAL(1),
PARALLEL(2),
CMS(3),
G1(4);
G1(4),
ZGC(5);

private final int typeCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PJvmGcType convertJvmGcType(final JvmGcType jvmGcType) {
return PJvmGcType.JVM_GC_TYPE_CMS;
case G1:
return PJvmGcType.JVM_GC_TYPE_G1;
case ZGC:
return PJvmGcType.JVM_GC_TYPE_ZGC;
default:
return PJvmGcType.JVM_GC_TYPE_UNKNOWN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public enum GarbageCollectorType {
SERIAL(JvmGcType.SERIAL, "MarkSweepCompact", "Copy"),
PARALLEL(JvmGcType.PARALLEL, "PS MarkSweep", "PS Scavenge"),
CMS(JvmGcType.CMS, "ConcurrentMarkSweep", "ParNew"),
G1(JvmGcType.G1, "G1 Old Generation", "G1 Young Generation");
G1(JvmGcType.G1, "G1 Old Generation", "G1 Young Generation"),

ZGC(JvmGcType.ZGC, "ZGC Major Pauses", "ZGC Minor Pauses");

private final JvmGcType jvmGcType;
private final String oldGenName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public enum JvmGcType {
SERIAL(1),
PARALLEL(2),
CMS(3),
G1(4);
G1(4),
ZGC(5);

private final int value;

Expand Down

0 comments on commit 600bb2b

Please sign in to comment.