private static String info(SortedMap<String, Plugin> cyclics) {
   StringBuilder sb = new StringBuilder();
   for (Map.Entry<String, Plugin> entry : cyclics.entrySet()) {
     sb.append("- Plugin '").append(entry.getKey()).append("'").append("\n");
     sb.append("    - befores: ").append(entry.getValue().getBefore()).append("\n");
     sb.append("    - afters: ").append(entry.getValue().getAfter()).append("\n");
   }
   return sb.toString();
 }
Example #2
0
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    String nl = String.format("%n");
    String nlIndent = String.format("%n%38s", "");
    if (hasNormalData()) {
      int pos = 0;
      HotSpotMethodDataAccessor data;
      while ((data = getNormalData(pos)) != null) {
        if (pos != 0) {
          sb.append(nl);
        }
        int bci = data.getBCI(this, pos);
        sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
        sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
        pos = pos + data.getSize(this, pos);
      }
    }

    if (hasExtraData()) {
      int pos = getExtraDataBeginOffset();
      HotSpotMethodDataAccessor data;
      while ((data = getExtraData(pos)) != null) {
        if (pos == getExtraDataBeginOffset()) {
          sb.append(nl).append("--- Extra data:");
        }
        int bci = data.getBCI(this, pos);
        sb.append(
            String.format("%n%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
        sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
        pos = pos + data.getSize(this, pos);
      }
    }
    return sb.toString();
  }
Example #3
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   int entries = getLength(data, pos) / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
   sb.append(format("entries(%d)", entries));
   for (int i = 0; i < entries; i++) {
     sb.append(
         format(
             "%n  %d: count(%d) displacement(%d)",
             i,
             data.readUnsignedInt(pos, getCountOffset(i)),
             data.readUnsignedInt(pos, getDisplacementOffset(i))));
   }
   return sb;
 }
Example #4
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   RawItemProfile<ResolvedJavaMethod> profile = getRawMethodProfile(data, pos);
   super.appendTo(
           sb.append(format("exception_seen(%s) ", getExceptionSeen(data, pos))), data, pos)
       .append(format("%nmethod_entries(%d)", profile.entries));
   for (int i = 0; i < profile.entries; i++) {
     long count = profile.counts[i];
     sb.append(
         format(
             "%n  %s (%d, %4.2f)",
             profile.items[i].format("%H.%n(%p)"), count, (double) count / profile.totalCount));
   }
   return sb;
 }
Example #5
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   return sb.append(
       format(
           "taken(%d) displacement(%d)",
           getExecutionCount(data, pos), getTakenDisplacement(data, pos)));
 }
Example #6
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   return sb.append(
       format(
           "count(%d) null_seen(%s) exception_seen(%s)",
           getCounterValue(data, pos), getNullSeen(data, pos), getExceptionSeen(data, pos)));
 }
Example #7
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos);
   TriState nullSeen = getNullSeen(data, pos);
   TriState exceptionSeen = getExceptionSeen(data, pos);
   sb.append(
       format(
           "count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)",
           getCounterValue(data, pos),
           nullSeen,
           exceptionSeen,
           getTypesNotRecordedExecutionCount(data, pos),
           profile.entries));
   for (int i = 0; i < profile.entries; i++) {
     long count = profile.counts[i];
     sb.append(
         format(
             "%n  %s (%d, %4.2f)",
             profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
   }
   return sb;
 }
Example #8
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   long taken = data.readUnsignedInt(pos, TAKEN_COUNT_OFFSET);
   long notTaken = data.readUnsignedInt(pos, NOT_TAKEN_COUNT_OFFSET);
   double takenProbability = getBranchTakenProbability(data, pos);
   return sb.append(
       format(
           "taken(%d, %4.2f) not_taken(%d, %4.2f) displacement(%d)",
           taken,
           takenProbability,
           notTaken,
           1.0D - takenProbability,
           getTakenDisplacement(data, pos)));
 }
  private File createDelimitedFile(Set<TestBean> theBeans) {

    File aDelimitedFile = null;

    try {

      // Create a temporary file ...
      aDelimitedFile = createTempFile(this.getClass().getName(), ".csv");
      aDelimitedFile.deleteOnExit();

      // Write the set of beans out to the file ...
      BufferedWriter aWriter = new BufferedWriter(new FileWriter(aDelimitedFile));
      for (TestBean aBean : theBeans) {

        StringBuilder aStringBuilder = new StringBuilder();

        aStringBuilder.append(aBean.getFirstName());
        aStringBuilder.append(DEFAULT_DELIMITER);
        aStringBuilder.append(aBean.getLastName());
        aStringBuilder.append(DEFAULT_DELIMITER);
        aStringBuilder.append(aBean.getFavoriteColor());

        aWriter.append(aStringBuilder);
        aWriter.newLine();
      }

      // File all buffers and close up shop ...
      aWriter.flush();
      aWriter.close();

    } catch (IOException e) {

      fail("Failed to create test delimited file.", e);
    }

    return aDelimitedFile;
  }
Example #10
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   return sb.append(format("length(%d)", getLength(data, pos)));
 }
Example #11
0
 @Override
 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
   return sb.append(format("exception_seen(%s)", getExceptionSeen(data, pos)));
 }