static {
   try {
     HASH_CLOSE = DataProxy.sendMethodName(MSG_CLOSE);
     HASH_COMMIT = DataProxy.sendMethodName(MSG_COMMIT);
     HASH_AUTO_COMMIT_TRUE = DataProxy.sendMethodName(MSG_AUTO_COMMIT_TRUE);
     HASH_AUTO_COMMIT_FALSE = DataProxy.sendMethodName(MSG_AUTO_COMMIT_FALSE);
   } catch (Exception e) {
   }
 }
Exemple #2
0
  protected void process() {
    List<Step> steps = new ArrayList<Step>(totalCount);
    toArray(methods, steps);
    toArray(sqls, steps);
    toArray(apicalls, steps);
    toArray(sockets, steps);
    totalCount = 0;

    DataProxy.sendProfile(steps, context);
  }
Exemple #3
0
 /**
  * add xlog profile profile diplay like --> msg #value elapsed
  *
  * @param msg message
  * @param value any value to display on a profile.
  * @param elapsed any value to display on a profile.
  */
 public void hashProfile(String msg, int value, int elapsed) {
   HashedMessageStep step = new HashedMessageStep();
   step.hash = DataProxy.sendHashedMessage(msg);
   step.value = value;
   step.time = elapsed;
   step.start_time = (int) (System.currentTimeMillis() - ctx.startTime);
   if (ctx.profile_thread_cputime) {
     step.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu);
   }
   ctx.profile.add(step);
 }
Exemple #4
0
 public void run() {
   Logger.println("Version " + Version.getAgentFullVersion());
   long dateUnit = DateUtil.getDateUnit();
   while (running) {
     reload(false);
     // Text Data Reset..
     long nowUnit = DateUtil.getDateUnit();
     if (dateUnit != nowUnit) {
       dateUnit = nowUnit;
       DataProxy.reset();
     }
     ThreadUtil.sleep(3000);
   }
 }
Exemple #5
0
  @Override
  public MethodVisitor visitMethod(
      int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
    if (mv == null || mset.isA(name, desc) == false) {
      return mv;
    }
    if (AsmUtil.isSpecial(name)) {
      return mv;
    }

    Configure conf = Configure.getInstance();
    boolean isPublic = conf.hook_method_access_public;
    boolean isProtected = conf.hook_method_access_protected;
    boolean isPrivate = conf.hook_method_access_private;
    boolean isNone = conf.hook_method_access_none;
    switch (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE)) {
      case Opcodes.ACC_PUBLIC:
        if (isPublic == false) return mv;
        break;
      case Opcodes.ACC_PROTECTED:
        if (isProtected == false) return mv;
        break;
      case Opcodes.ACC_PRIVATE:
        if (isPrivate == false) return mv;
        break;
      default:
        if (isNone == false) return mv;
        break;
    }
    // check prefix, to ignore simple method such as getter,setter
    if (conf.isIgnoreMethodPrefix(name)) return mv;

    String fullname = AsmUtil.add(className, name, desc);
    int fullname_hash = DataProxy.sendMethodName(fullname);

    return new MethodMV(access, desc, mv, fullname, fullname_hash);
  }
Exemple #6
0
 public void error(String err) {
   if (ctx.error == 0) {
     ctx.error = DataProxy.sendError(err);
   }
 }