Package org.eurekaJ.agent.model

Examples of org.eurekaJ.agent.model.MethodInstrumentation


    if (currClass.getName().endsWith("Servlet")) {
      log.info("\t\tInstrumenting Servlet: " + currClass.getName());
    }
   
    try {
      MethodInstrumentation mi = cii.getMethod(method.getName());
      if (currClass.getName().endsWith("Servlet")) {
        log.info("\t\tInstrumenting Servlet Method: " + mi + " :: " + method.getName());
      }
      if (method.getMethodInfo().isConstructor() || method.getName().startsWith("class") ||
          method.getName().startsWith("get") || method.getName().startsWith("set") ||
          method.getName().startsWith("is")) {
        // Simple methods and constructors not supported yet.
      } else if (mi != null) {
        if (mi.getClassType().equalsIgnoreCase("Increment")) {
          addIncrement(currClass, method.getName(), cii);
        } else if (mi.getClassType().equalsIgnoreCase("Decrement")) {
          addDecrement(currClass, method.getName(), cii);
        } else {
          addTiming(currClass, method.getName(), cii);
          /*
           * TODO: if (valueInstrumentation) {
View Full Code Here


  private void addTiming(CtClass clas, String mname, ClassInstrumentationInfo cii) throws NotFoundException, CannotCompileException, IOException {
    // get the method information
    StringBuffer before = new StringBuffer().append("{");
    StringBuffer after = new StringBuffer().append("{");
   
    MethodInstrumentation mi = cii.getMethod(mname);
    CtMethod oldMethod = clas.getDeclaredMethod(mname);
    oldMethod.addLocalVariable("_eurekaJTimingStart", CtClass.longType);
    //CtClass stackTraceClass = classPool.get("org.eurekaJ.agent.model.CallStackTraceBuilder");
    //oldMethod.addLocalVariable("_eurekaJStackTraceBuilder", stackTraceClass);
   
    if (clas.getPackageName().endsWith("sql") || clas.getName().endsWith("Statement")) {
      log.info("\n\n\n\t\t\tSQL Instrumetation: " + clas.getPackageName() + " ::: " + clas.getName());
    }
   
    before.append("_eurekaJTimingStart = System.currentTimeMillis();\n");
    //before.append("org.eurekaJ.agent.model.CallStackTraceBuilderFactory.getCallStackTraceBuilder().enter(\"" + mname + "\", \"" + oldMethod.getSignature() + "\", \"" + clas.getName() + "\", \"" + mi.getClassType() + "\", \"" + cii.getPath() + "\",_eurekaJTimingStart);\n");
   
    // Report statistic for this classtype only (overall)
    after.append("org.eurekaJ.agent.EurekaJStringLogger.addGroupStatistics(\"" + mi.getClassType()
        + "\", (System.currentTimeMillis() - _eurekaJTimingStart), _eurekaJTimingStart, \"" + mi.getClassType() + "\");\n");
    // Report statistic for this classtype and path (overall)
    after.append("org.eurekaJ.agent.EurekaJStringLogger.addGroupStatistics(\"" + mi.getClassType() + ":" + cii.getPath()
        + "\", (System.currentTimeMillis() - _eurekaJTimingStart), _eurekaJTimingStart, \"" + mi.getClassType() + "\");\n");
    // Report statistic for this classtype, path and class (overall)
    after.append("org.eurekaJ.agent.EurekaJStringLogger.addGroupStatistics(\"" + mi.getClassType() + ":" + cii.getPath() + ":" + clas.getName()
        + "\", (System.currentTimeMillis() - _eurekaJTimingStart), _eurekaJTimingStart, \"" + mi.getClassType() + "\");\n");
    // Report statistic for this method call (classtype, path, class and method)
    after.append("org.eurekaJ.agent.EurekaJStringLogger.addStatistic(\"" + clas.getName() + " " + mname
        + "\", (System.currentTimeMillis() - _eurekaJTimingStart), _eurekaJTimingStart, \"" + mi.getClassType() + "\", \"" + cii.getPath() + "\");\n");
   
   
    //after.append("org.eurekaJ.agent.model.CallStackTraceBuilderFactory.getCallStackTraceBuilder().leave(System.currentTimeMillis() - _eurekaJTimingStart);\n");
   
    oldMethod.insertBefore(before.append("}").toString());
View Full Code Here

        }
       
        if (cii.isDoesImplement() || cii.isDoesExtend()) {
          ClassInstrumentationInfo oldCii = subtypeInstrumentationHash.get(sb.toString());
          if (oldCii != null) { //Add method to existing instrumentation
            oldCii.getMethodNameHash().put(methodName, new MethodInstrumentation(methodName, classType));
          } else { //Add new ClassInstrumentationInfo
            subtypeInstrumentationHash.put(sb.toString(), cii);
          }
        } else {
          ClassInstrumentationInfo oldCii = instrumentationHash.get(sb.toString());
          if (oldCii != null) { //Add method to existing instrumentation
            oldCii.getMethodNameHash().put(methodName, new MethodInstrumentation(methodName, classType));
          } else { //Add new ClassInstrumentationInfo
            instrumentationHash.put(sb.toString(), cii);
          }
        }
       
View Full Code Here

TOP

Related Classes of org.eurekaJ.agent.model.MethodInstrumentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.