
bridge41
package comet.agent ; import net.bytebuddy.agent.builder.AgentBuilder ; import net.bytebuddy.asm.Advice ; import net.bytebuddy.description.type.TypeDescription ; import net.bytebuddy.dynamic.DynamicType ; import net.bytebuddy.matcher.ElementMatchers ; import net.bytebuddy.utility.JavaModule ; import java.lang.instrument.Instrumentation ; import java.io.* ; import java.nio.file.* ; import java.util.* ; import java.util.concurrent.* ; import java.util.concurrent.atomic.LongAdder ; import java.text.SimpleDateFormat ; import java.util.jar.JarFile ; public class ProfilerAgent { // MUST BE PUBLIC: To be seen by instrumented classes public static final ConcurrentHashMap < String , Stats > metrics = new ConcurrentHashMap <>(); private static final SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ); public static void agentmain ( String agentArgs , Instrumentation inst ) { try { File agentJar = new File ( ProfilerAgent . class . getProtectionDomain () . getCodeSource (). getL
Continue reading on Dev.to
Opens in a new tab



