1 21 22 package org.apache.derbyTesting.functionTests.util; 23 24 29 public class StatParser 30 { 31 public static String getScanCols(String runTimeStats) 32 throws Throwable 33 { 34 if (runTimeStats == null) 35 { 36 return "The RunTimeStatistics string passed in is null"; 37 } 38 39 int startIndex; 40 int endIndex = 0; 41 int indexIndex; 42 43 StringBuffer strbuf = new StringBuffer (); 44 45 48 if ((indexIndex = runTimeStats.indexOf("Index Scan ResultSet")) != -1) 49 { 50 int textend = runTimeStats.indexOf("\n", indexIndex); 51 strbuf.append(runTimeStats.substring(indexIndex, textend+1)); 52 } 53 else 54 { 55 strbuf.append("TableScan\n"); 56 } 57 58 int count = 0; 59 while ((startIndex = runTimeStats.indexOf("Bit set of columns fetched", endIndex)) != -1) 60 { 61 count++; 62 endIndex = runTimeStats.indexOf("}", startIndex); 63 if (endIndex == -1) 64 { 65 endIndex = runTimeStats.indexOf("All", startIndex); 66 if (endIndex == -1) 67 { 68 throw new Throwable ("couldn't find the closing } on "+ 69 "columnFetchedBitSet in "+runTimeStats); 70 } 71 endIndex+=5; 72 } 73 else 74 { 75 endIndex++; 76 } 77 strbuf.append(runTimeStats.substring(startIndex, endIndex)); 78 strbuf.append("\n"); 79 } 80 if (count == 0) 81 { 82 throw new Throwable ("couldn't find string 'Bit set of columns fetched' in :\n"+ 83 runTimeStats); 84 } 85 86 return strbuf.toString(); 87 } 88 } 89 | Popular Tags |