コード例 #1
0
 /**
  * 将profile数据写到log中
  *
  * @return
  */
 private void dumpProfileData() {
   ThreadData[] threadData = Profiler.threadProfile;
   for (int index = 0; index < threadData.length; index++) {
     ThreadData profilerData = threadData[index];
     if (profilerData == null) {
       continue;
     }
     ProfStack<long[]> profile = profilerData.profileData;
     while (profile.size() > 0) {
       long[] data = profile.pop();
       StringBuilder sb = new StringBuilder();
       // thread id
       sb.append(index);
       sb.append('\t');
       // stack number
       sb.append(data[1]);
       sb.append('\t');
       // method id
       sb.append(data[0]);
       sb.append('\t');
       // use time
       sb.append(data[2]);
       sb.append('\n');
       fileWriter.append(sb.toString());
     }
     fileWriter.flushAppend();
     profilerData.clear();
   }
   fileWriter.append("=\n");
   fileWriter.flushAppend();
 }
コード例 #2
0
ファイル: Profiler.java プロジェクト: ContinXiao/TProfiler
 public static void clearData() {
   for (int index = 0; index < threadProfile.length; index++) {
     ThreadData profilerData = threadProfile[index];
     if (profilerData == null) {
       continue;
     }
     profilerData.clear();
   }
 }