1 24 25 26 30 31 32 package org.objectweb.clif.analyser; 33 34 import java.io.*; 35 import java.util.*; 36 import org.objectweb.clif.analyser.api.AnalyserControl; 37 38 39 public class View 40 { 41 42 private String name; 46 private String testId; 47 private String blade; 48 private int numthread; 49 private String paramX; 50 private String paramY; 51 private long datedebut; 52 private long datefin; 53 private String result; 54 private int option; 55 56 public View() 57 { 58 } 59 60 public View(String name,String testId,String bladename,int numthread,String paramX,String paramY,long datedebut, long datefin) 61 { 62 } 63 64 65 public View(String name,String testId,String bladename,int numthread,String paramX,String paramY,long datedebut, long datefin, int option){ 67 this.name=name; 69 this.testId=testId; 70 this.blade=bladename; 71 this.numthread=numthread; 72 this.paramX=paramX; 73 this.paramY=paramY; 74 this.datedebut=datedebut; 75 this.datefin=datefin; 76 this.result = "" ; 77 this.option = option; 78 if(paramX.equals("Testing time")) CreerfctTesttime(name,testId,bladename,numthread,paramX,paramY,datedebut,datefin,option); 81 } 82 83 public String getName() { return this.name; } 84 public String getTestId() { return this.testId; } 85 public String getNommachine() { return this.blade; } 86 public int getNumthread() { return this.numthread; } 87 public String getParamX() { return this.paramX; } 88 public String getParamY() { return this.paramY; } 89 public long getDatedebut() { return this.datedebut; } 90 public long getDatefin() { return this.datefin; } 91 public String getResult() { return this.result; } 92 93 public void setName(String name) { this.name = name; } 94 public void setTestId(String testId) { this.testId = testId; } 95 public void setNommachine(String bladename) { this.blade = bladename; } 96 public void setNumthread(int numthread) { this.numthread = numthread; } 97 public void setParamX(String paramX) { this.paramX = paramX; } 98 public void setParamY(String paramY) { this.paramY = paramY; } 99 public void setDatedebut(long datedebut) { this.datedebut = datedebut; } 100 public void setDatefin(long datefin) { this.datefin = datefin; } 101 public void setResult(String result) { this.result = this.result +"\n" +result; } 102 103 104 105 106 107 108 public void CreerfctTesttime(String name,String testId,String bladename,int numthread,String paramX,String paramY,long datedebut, long datefin, int option) 113 { 114 115 FileInputStream fileInput; 116 FileOutputStream fileoutput; 117 BufferedReader file ; 118 PrintStream fileout; 119 StringTokenizer st; 120 String line = null ; 121 int[] numColonne = new int[8]; 122 int i=0; 123 int[] regul = new int[2]; 124 long tempdate =0; 125 String tempstring1 = null; 126 int tempint = 0; 127 String entete = null; 128 long unitoftime = 0; 129 long temptime = 0; 130 int compteur=0; 131 132 133 if(option == 1) unitoftime = 1000; else if(option == 2) unitoftime = 10000; else if(option == 3) unitoftime = 60000; else if(option == 4) unitoftime = -1; 138 try { 139 140 fileInput = new FileInputStream("report/"+testId + "/archive.clif"); 141 fileoutput = new FileOutputStream("report/"+testId + "/vues/" + name + ".view"); 142 file = new BufferedReader(new InputStreamReader(fileInput)); 143 fileout = new PrintStream(fileoutput); 144 145 146 entete = "#|"+name+"|"+testId+"|testing time|"+paramY+"|"+bladename+"|"+numthread+"|"+datedebut+"|"+datefin ; 148 fileout.println(entete); 149 line = file.readLine() ; 150 while(line != null) 151 { 152 st = new StringTokenizer(line,";") ; 153 tempdate = (new Integer (st.nextToken())).intValue() ; 154 if ((tempdate >= datedebut)&&(tempdate <= datefin)) 155 { 156 if( (unitoftime!=-1) && (tempdate > unitoftime + temptime) ) 157 { 158 if(temptime!=0) 159 { 160 fileout.println(tempdate +"\t"+ compteur + "\t" +tempdate); 161 compteur=0; 162 } 163 temptime = tempdate; 164 165 } 166 tempstring1 = st.nextToken() ; 167 if(tempstring1.equals("action")) 168 { 169 tempstring1 = st.nextToken() ; 170 if(tempstring1.matches(bladename)) 171 { 172 tempint = (new Integer (st.nextToken())).intValue() ; 173 if((numthread == -1) || (tempint == numthread)) 174 { 175 st.nextToken();st.nextToken();st.nextToken(); 176 tempint = (new Integer (st.nextToken())).intValue(); 177 if(st.nextToken().matches(paramY)){ 178 if(option==4){ 179 fileout.println(tempdate +"\t"+ tempint + "\t" +tempdate); 180 } 181 else compteur++; 182 } 183 } 184 } 185 186 } 187 188 } 189 190 line = file.readLine() ; 191 } 192 } 193 catch (Exception e) { 194 e.printStackTrace() ; 195 System.exit(0) ; 196 } 197 198 199 } 200 201 202 203 public void Creerfct_generic(String name,String testId,String servername,int numthread,int paramX,int paramY,long datedebut, long datefin) 208 { 209 210 FileInputStream fileInput; 211 FileOutputStream fileoutput; 212 BufferedReader file ; 213 PrintStream fileout; 214 StringTokenizer st; 215 String line = null ; 216 int[] numColonne = new int[8]; 217 int i=0; 218 int[] regul = new int[2]; 219 long tempdate =0; 220 String tempstring = null; 221 int tempint = 0; 222 String entete = null; 223 224 try { 225 226 fileInput = new FileInputStream(testId + "_rapport/archive.clif"); 227 fileoutput = new FileOutputStream(testId + "_rapport/vues/" + name + ".view"); 228 file = new BufferedReader(new InputStreamReader(fileInput)); 229 fileout = new PrintStream(fileoutput); 230 231 entete = "#|"+name+"|"+testId+"|0|"+paramY+"|"+servername+"|"+numthread+"|"+datedebut+"|"+datefin ; 232 fileout.println(entete); 233 line = file.readLine() ; 234 while(line != null) 235 { 236 st = new StringTokenizer(line,";") ; 237 tempdate = (new Integer (st.nextToken())).intValue() ; 238 if ((tempdate >= datedebut)&&(tempdate <= datefin)) 239 { tempint = (new Integer (st.nextToken())).intValue() ; 241 if(tempint == paramY) 242 { tempstring = st.nextToken() ; 244 if(true) { tempint = (new Integer (st.nextToken())).intValue() ; 247 if((numthread == -1) || (tempint == numthread)) 248 { tempstring = regul[0]+"\t"; 251 if(paramY == 4) {st.nextToken(); st.nextToken();} 252 if(paramY == 7) st.nextToken(); 253 tempint = (new Integer (st.nextToken())).intValue() ; 254 tempstring = tempstring + tempint + "\t" +tempdate; 255 fileout.println(tempstring); 256 regul[1] = tempint; 257 } 258 } 259 260 } 261 else if(tempint == paramX) 262 { tempstring = st.nextToken() ; 264 if(true) { tempint = (new Integer (st.nextToken())).intValue() ; 267 if((numthread == -1) || (tempint == numthread)) 268 { if(paramX == 4) {st.nextToken(); st.nextToken();} 271 if(paramX == 7) st.nextToken(); 272 tempint = (new Integer (st.nextToken())).intValue() ; 273 tempstring = tempint + "\t"+regul[1]+"\t" +tempdate; 274 fileout.println(tempstring); 275 regul[0] = tempint; 276 } 277 } 278 } 279 } 280 281 line = file.readLine() ; 282 } 283 } 284 catch (Exception e) { 285 e.printStackTrace() ; 286 System.exit(0) ; 287 } 288 289 290 } 291 292 293 294 295 296 301 public void CreerfctTesttime_Nbuser(String name,String testId,String servername,int numthread,long datedebut,long datefin) 302 { 303 304 FileInputStream fileInput; 305 FileOutputStream fileoutput; 306 BufferedReader file ; 307 PrintStream fileout; 308 StringTokenizer st; 309 String line = null ; 310 int i=0; 311 int compteur = 0; 312 long tempdate =0; 313 String tempstring = null; 314 String templine = null; 315 int tempint = 0; 316 String entete = null; 317 318 319 320 321 try { 322 323 fileInput = new FileInputStream(testId + "_rapport/archive.clif"); 324 fileoutput = new FileOutputStream(testId + "_rapport/vues/" + name + ".view"); 325 326 file = new BufferedReader(new InputStreamReader(fileInput)); 327 fileout = new PrintStream(fileoutput); 328 329 entete = "#|"+name+"|"+testId+"|0|2|"+"|"+servername+"|"+numthread+"|"+datedebut+"|"+datefin ; 330 fileout.println(entete); 331 line = file.readLine() ; 332 while(line != null) 333 { 334 335 st = new StringTokenizer(line,";") ; 336 tempdate = (new Integer (st.nextToken())).intValue() ; 337 if ((tempdate >= datedebut)&&(tempdate <= datefin)) 338 { tempint = (new Integer (st.nextToken())).intValue() ; 340 if(tempint == 2) { tempstring = st.nextToken() ; 343 if(true) { tempint = (new Integer (st.nextToken())).intValue() ; 346 if((numthread == -1) || (tempint == numthread)) 347 { templine = tempdate+"\t" ; 350 st.nextToken(); 351 tempstring = st.nextToken(); 352 if(tempstring.equalsIgnoreCase("connection")) compteur++; 353 if(tempstring.equalsIgnoreCase("deconnection")) compteur--; 354 templine = templine + compteur + "\t" + tempdate; 355 fileout.println(templine); 356 357 } 358 } 359 } 360 } 361 362 line = file.readLine() ; 363 } 364 } 365 catch (Exception e) { 366 e.printStackTrace() ; 367 System.exit(0) ; 368 } 369 } 370 371 } 372 | Popular Tags |