Example #1
0
 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);
 }
Example #2
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);
 }
Example #3
0
  public static synchronized void boot() {
    if (booted) return;
    booted = true;

    CounterExecutingManager.load();
    ReqestHandlingProxy.load();

    Configure.getInstance().printConfig();

    long seed = System.currentTimeMillis() ^ (((long) SysJMX.getProcessPID()) << 32);
    KeyGen.setSeed(seed);
    Logger.println("A100", "agent boot seed=" + Hexa32.toString32(seed));
    PluginLoader.getInstance();
  }
Example #4
0
  public TraceContext createChild() {
    TraceContext child = new TraceContext(this.isSummary);
    child.parent = this;
    child.txid = this.txid;
    child.thread = this.thread;
    child.threadId = this.threadId;
    child.gxid = this.gxid;

    // child.profile = this.profile;

    child.startTime = this.startTime;

    if (this.profile_thread_cputime) {
      child.startCpu = SysJMX.getCurrentThreadCPU();
    }
    child.bytes = this.bytes;
    child.status = this.status;

    child.xType = this.xType;
    child.serviceHash = this.serviceHash;
    child.serviceName = this.serviceName;
    child.remoteIp = this.remoteIp;

    child.http_method = this.http_method;
    child.http_query = this.http_query;
    child.http_content_type = this.http_content_type;

    // child.sqlCount = this.sqlCount;
    // child.sqlTime = this.sqlTime;
    // child.sqltext = this.sqltext;
    // child.apicall_name = this.apicall_name;
    // child.apicall_count = this.apicall_count;
    // child.apicall_time = this.apicall_time;

    // child.rs_start = this.rs_start;
    // child.rs_count = this.rs_count;
    // child.sql = this.sql;

    child.userid = this.userid;
    child.userAgent = this.userAgent;
    child.referer = this.referer;
    // child.opencon = this.opencon;
    child.profile_thread_cputime = this.profile_thread_cputime;
    child.is_child_tx = this.is_child_tx;
    child.caller = this.caller;
    child.callee = this.callee;

    return child;
  }
Example #5
0
  public final void setAutoCommit(boolean a0) throws java.sql.SQLException {
    this.inner.setAutoCommit(a0);

    TraceContext ctx = TraceContextManager.getLocalContext();
    if (ctx == null) return;

    MethodStep p = new MethodStep();
    p.hash = a0 ? HASH_AUTO_COMMIT_TRUE : HASH_AUTO_COMMIT_FALSE;
    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);
  }
Example #6
0
 public synchronized void resetObjInfo() {
   String detected =
       ObjTypeDetector.drivedType != null
           ? ObjTypeDetector.drivedType
           : ObjTypeDetector.objType != null ? ObjTypeDetector.objType : CounterConstants.JAVA;
   this.obj_type = getValue("obj_type", detected);
   detected = CounterConstants.HOST;
   if (SystemUtil.IS_LINUX) {
     detected = CounterConstants.LINUX;
   } else if (SystemUtil.IS_WINDOWS) {
     detected = CounterConstants.WINDOWS;
   } else if (SystemUtil.IS_MAC_OSX) {
     detected = CounterConstants.OSX;
   } else if (SystemUtil.IS_AIX) {
     detected = CounterConstants.AIX;
   } else if (SystemUtil.IS_HP_UX) {
     detected = CounterConstants.HPUX;
   }
   this.obj_host_type = getValue("obj_host_type", detected);
   this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName());
   this.objHostName = "/" + this.obj_host_name;
   this.objHostHash = HashUtil.hash(objHostName);
   this.obj_name_auto_pid_enabled = getBoolean("obj_name_auto_pid_enabled", false);
   String defaultName;
   if (this.obj_name_auto_pid_enabled == true) {
     defaultName = "" + SysJMX.getProcessPID();
   } else {
     defaultName = this.obj_type + "1";
   }
   this.obj_name = getValue("obj_name", System.getProperty("jvmRoute", defaultName));
   this.objName = objHostName + "/" + this.obj_name;
   this.objHash = HashUtil.hash(objName);
   System.setProperty("scouter.objname", this.objName);
   System.setProperty("scouter.objtype", this.obj_type);
   System.setProperty("scouter.dir", new File(".").getAbsolutePath());
 }
Example #7
0
  public final void commit() throws java.sql.SQLException {
    long stime = System.currentTimeMillis();
    this.inner.commit();
    long etime = System.currentTimeMillis();

    TraceContext ctx = TraceContextManager.getLocalContext();
    if (ctx == null) return;

    MethodStep p = new MethodStep();
    p.hash = HASH_COMMIT;
    p.start_time = (int) (stime - ctx.startTime);
    if (ctx.profile_thread_cputime) {
      p.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu);
    }
    p.elapsed = (int) (etime - stime);
    ctx.profile.add(p);
  }