public static void open(File file) { TraceContext ctx = TraceContextManager.getContext(); if (ctx != null) { MessageStep m = new MessageStep(); m.start_time = (int) (System.currentTimeMillis() - ctx.startTime); m.message = "FILE " + file.getName(); ctx.profile.add(m); } }
break; case MESSAGE: mainValue = ((MessageStep) step).getMessage(); break; case SOCKET:
break; case MESSAGE: mainValue = ((MessageStep) step).getMessage(); break; case SOCKET:
public static void open(File file) { TraceContext ctx = TraceContextManager.getContext(); if (ctx != null) { MessageStep m = new MessageStep(); m.start_time = (int) (System.currentTimeMillis() - ctx.startTime); m.message = "FILE " + file.getName(); ctx.profile.add(m); } }
public void profile(String msg) { MessageStep p = new MessageStep(); p.message = msg; p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } ctx.profile.add(p); }
public void profile(String msg) { MessageStep p = new MessageStep(); p.message = msg; p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } ctx.profile.add(p); }
public static void userTxOpen() { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; ctx.userTransaction++; MessageStep ms = new MessageStep("utx-begin"); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); }
public static void userTxClose(String method) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; if (ctx.userTransaction > 0) { ctx.userTransaction--; } MessageStep ms = new MessageStep("utx-" + method); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); }
public static void userTxOpen() { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; ctx.userTransaction++; MessageStep ms = new MessageStep("utx-begin"); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); }
public static void userTxClose(String method) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; if (ctx.userTransaction > 0) { ctx.userTransaction--; } MessageStep ms = new MessageStep("utx-" + method); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); }
public static void addMessage(String msg) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; MessageStep p = new MessageStep(); p.message = msg; p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } ctx.profile.add(p); }
public static void addMessage(String msg) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; MessageStep p = new MessageStep(); p.message = msg; p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } ctx.profile.add(p); }
public static void startSpringControllerMethod(String className, String methodName, String methodDesc, Object this1, Object[] arg) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; if (conf.profile_spring_controller_method_parameter_enabled) { if (arg == null) { return; } int start_time = (int) (System.currentTimeMillis() - ctx.startTime); for (int i = 0; i < arg.length; i++) { if (arg[i] == null) continue; String value = new StringBuilder().append("param: ").append(StringUtil.limiting(arg[i].toString(), 1024)).toString(); MessageStep step = new MessageStep(value); step.start_time = start_time; ctx.profile.add(step); } } PluginSpringControllerCaptureTrace.capArgs(ctx, new HookArgs(className, methodName, methodDesc, this1, arg)); }
public static void startSpringControllerMethod(String className, String methodName, String methodDesc, Object this1, Object[] arg) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return; if (conf.profile_spring_controller_method_parameter_enabled) { if (arg == null) { return; } int start_time = (int) (System.currentTimeMillis() - ctx.startTime); for (int i = 0; i < arg.length; i++) { if (arg[i] == null) continue; String value = new StringBuilder().append("param: ").append(StringUtil.limiting(arg[i].toString(), 1024)).toString(); MessageStep step = new MessageStep(value); step.start_time = start_time; ctx.profile.add(step); } } PluginSpringControllerCaptureTrace.capArgs(ctx, new HookArgs(className, methodName, methodDesc, this1, arg)); }
public static Object dbcOpenStart(int hash, String msg, Object pool) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return null; if (conf.profile_connection_open_enabled == false) return null; MethodStep p = new MethodStep(); p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } DBURL dbUrl = getUrl(ctx, msg, pool); if (dbUrl != unknown) { hash = DataProxy.sendMethodName(dbUrl.description); int urlHash = DataProxy.sendObjName(dbUrl.url); ctx.lastDbUrl = urlHash; } else { ctx.lastDbUrl = 0; } p.hash = hash; ctx.profile.push(p); if (conf.profile_connection_open_fullstack_enabled) { String stack = ThreadUtil.getStackTrace(Thread.currentThread().getStackTrace(), 2); MessageStep ms = new MessageStep(stack); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); } LocalContext lctx = new LocalContext(ctx, p); return lctx; }
public static Object dbcOpenStart(int hash, String msg, Object pool) { TraceContext ctx = TraceContextManager.getContext(); if (ctx == null) return null; if (conf.profile_connection_open_enabled == false) return null; MethodStep p = new MethodStep(); p.start_time = (int) (System.currentTimeMillis() - ctx.startTime); if (ctx.profile_thread_cputime) { p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu); } DBURL dbUrl = getUrl(ctx, msg, pool); if (dbUrl != unknown) { hash = DataProxy.sendMethodName(dbUrl.description); int urlHash = DataProxy.sendObjName(dbUrl.url); ctx.lastDbUrl = urlHash; } else { ctx.lastDbUrl = 0; } p.hash = hash; ctx.profile.push(p); if (conf.profile_connection_open_fullstack_enabled) { String stack = ThreadUtil.getStackTrace(Thread.currentThread().getStackTrace(), 2); MessageStep ms = new MessageStep(stack); ms.start_time = (int) (System.currentTimeMillis() - ctx.startTime); ctx.profile.add(ms); } LocalContext lctx = new LocalContext(ctx, p); return lctx; }
String stack = ThreadUtil.getStackTrace(Thread.currentThread().getStackTrace(), 2); AutoServiceStartAnalyzer.put(classMethod, stack); MessageStep m = new MessageStep(); m.message = "SERVICE BACKSTACK:\n" + stack; ((LocalContext) localContext).context.profile.add(m);
public static void endSocket(Object stat, Throwable thr) { if (stat == null) { return; } try { LocalContext lctx = (LocalContext) stat; TraceContext tctx = lctx.context; SocketStep step = (SocketStep) lctx.stepSingle; step.elapsed = (int) (System.currentTimeMillis() - tctx.startTime) - step.start_time; if (thr != null) { String msg = thr.toString(); step.error = DataProxy.sendError(msg); if (tctx.error == 0) { tctx.error = step.error; } tctx.offerErrorEntity(ErrorEntity.of(thr, step.error, 0, 0)); } tctx.profile.add(step); SocketTable.add(step.ipaddr, step.port, tctx.serviceHash, tctx.txid); Configure conf = Configure.getInstance(); if (conf.profile_socket_open_fullstack_enabled) { if (conf.profile_socket_open_fullstack_port == 0 || conf.profile_socket_open_fullstack_port == step.port) { tctx.profile.add(new MessageStep(step.start_time, ThreadUtil.getThreadStack())); } } } catch (Throwable t) { Logger.println("A142", "socket trace close error", t); } } public static void open(File file) {
String stack = ThreadUtil.getStackTrace(Thread.currentThread().getStackTrace(), 2); AutoServiceStartAnalyzer.put(classMethod, stack); MessageStep m = new MessageStep(); m.message = "SERVICE BACKSTACK:\n" + stack; ((LocalContext) localContext).context.profile.add(m);
public static void endSocket(Object stat, Throwable thr) { if (stat == null) { return; } try { LocalContext lctx = (LocalContext) stat; TraceContext tctx = lctx.context; SocketStep step = (SocketStep) lctx.stepSingle; step.elapsed = (int) (System.currentTimeMillis() - tctx.startTime) - step.start_time; if (thr != null) { String msg = thr.toString(); step.error = DataProxy.sendError(msg); if (tctx.error == 0) { tctx.error = step.error; } tctx.offerErrorEntity(ErrorEntity.of(thr, step.error, 0, 0)); } tctx.profile.add(step); SocketTable.add(step.ipaddr, step.port, tctx.serviceHash, tctx.txid); Configure conf = Configure.getInstance(); if (conf.profile_socket_open_fullstack_enabled) { if (conf.profile_socket_open_fullstack_port == 0 || conf.profile_socket_open_fullstack_port == step.port) { tctx.profile.add(new MessageStep(step.start_time, ThreadUtil.getThreadStack())); } } } catch (Throwable t) { Logger.println("A142", "socket trace close error", t); } } public static void open(File file) {