Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 197176 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/hyades/trace/views/internal/MethodDetailsStatistic.java (-68 / +108 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation, Intel Corporation.
2
 * Copyright (c) 2005, 2008 IBM Corporation, Intel Corporation.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-19 Link Here
13
13
14
import java.util.HashMap;
14
import java.util.HashMap;
15
import java.util.Iterator;
15
import java.util.Iterator;
16
16
import org.eclipse.hyades.models.trace.TRCAggregatedMethodInvocation;
17
import org.eclipse.hyades.models.trace.TRCMethod;
17
import org.eclipse.hyades.models.trace.TRCMethod;
18
import org.eclipse.hyades.models.trace.TRCMethodInvocation;
18
import org.eclipse.hyades.models.trace.TRCMethodInvocation;
19
import org.eclipse.hyades.trace.ui.internal.util.TString;
19
import org.eclipse.hyades.trace.ui.internal.util.TString;
Lines 275-290 Link Here
275
		       	  Iterator children = inv.getInvokes().iterator();
275
		       	  Iterator children = inv.getInvokes().iterator();
276
		       	  while(children.hasNext())
276
		       	  while(children.hasNext())
277
		       	  {
277
		       	  {
278
		       	  	 TRCMethod m = ((TRCMethodInvocation)children.next()).getMethod();
278
		       		 TRCMethodInvocation child_inv = (TRCMethodInvocation)children.next();
279
		       	  	 TRCMethod m = child_inv.getMethod();
279
		       	  	 
280
		       	  	 
281
				  	 int count = 1;
282
				  	 if (child_inv instanceof TRCAggregatedMethodInvocation) {
283
				  		 count = ((TRCAggregatedMethodInvocation) child_inv).getCount();
284
				  	 }		     
285
280
		    	  	 Object value = tmpMap.get(m);
286
		    	  	 Object value = tmpMap.get(m);
281
		    	  	 if(value != null)   
287
		    	  	 if(value != null) {	
282
		    	  	 {	
288
		        	  	 tmpMap.put(m, new Integer(((Integer)value).intValue() + count));
283
		    	  	 	 int i = ((Integer)value).intValue()+1;
289
		    	  	 }
284
		        	  	 tmpMap.put(m, new Integer(i));
290
		    	  	 else {
291
		    	  	 	 tmpMap.put(m, new Integer(count));
285
		    	  	 }
292
		    	  	 }
286
		    	  	 else
287
		    	  	 	tmpMap.put(m, new Integer(1));       	  	 
288
		       	  }
293
		       	  }
289
		       }
294
		       }
290
		       
295
		       
Lines 317-339 Link Here
317
		       Iterator iterator = method.getInvocations().iterator();
322
		       Iterator iterator = method.getInvocations().iterator();
318
		       while(iterator.hasNext())
323
		       while(iterator.hasNext())
319
		       {
324
		       {
320
		       	  TRCMethodInvocation inv = (TRCMethodInvocation) iterator.next();
325
					 TRCMethodInvocation inv = (TRCMethodInvocation) iterator.next();
321
		       	  
326
					
322
		       	   if(inv.getInvokedBy() == null)
327
					 if(inv.getInvokedBy() == null)
323
		       	   	continue;
328
					   continue;
324
		       	   
329
					   
325
			  	 TRCMethod m = inv.getInvokedBy().getMethod();
330
					 TRCMethod m = inv.getInvokedBy().getMethod();
326
			  	 
331
					 
327
			  	 Object value = tmpMap.get(m);
332
					 int count = 1;
328
			  	 if(value != null)   
333
					 if (inv instanceof TRCAggregatedMethodInvocation) {
329
			  	 {	
334
						 count = ((TRCAggregatedMethodInvocation) inv).getCount();
330
			  	 	 int i = ((Integer)value).intValue()+1;
335
					 }
331
		    	  	 tmpMap.put(m, new Integer(i));
336
					 
332
			  	 }
337
					 Object value = tmpMap.get(m);
333
			  	 else
338
					 if(value != null)   
334
			  	 	tmpMap.put(m, new Integer(1));
339
					 {	
335
		        }
340
					  	 tmpMap.put(m, new Integer(((Integer)value).intValue() + count));
336
		       
341
					 }
342
					 else {
343
					 	 tmpMap.put(m, new Integer(count));
344
					 }
345
		       }
346
		         
337
		       Iterator methods = tmpMap.keySet().iterator();
347
		       Iterator methods = tmpMap.keySet().iterator();
338
		       while(methods.hasNext())
348
		       while(methods.hasNext())
339
		       {
349
		       {
Lines 388-395 Link Here
388
							while(i.hasNext())
398
							while(i.hasNext())
389
							{
399
							{
390
								TRCMethodInvocation mi = ((TRCMethodInvocation)i.next()).getInvokedBy();
400
								TRCMethodInvocation mi = ((TRCMethodInvocation)i.next()).getInvokedBy();
391
								if(mi != null && mi.getMethod().equals(selection))
401
								if(mi != null && mi.getMethod().equals(selection)) {
392
									nb++;
402
									if (mi instanceof TRCAggregatedMethodInvocation) {
403
										nb += ((TRCAggregatedMethodInvocation) mi).getCount();
404
									}
405
									else {
406
										nb++;
407
									}
408
								}
393
								
409
								
394
							}
410
							}
395
							
411
							
Lines 407-415 Link Here
407
							Iterator i = selection.getInvocations().iterator();
423
							Iterator i = selection.getInvocations().iterator();
408
							while(i.hasNext())
424
							while(i.hasNext())
409
							{
425
							{
410
								TRCMethodInvocation mi = ((TRCMethodInvocation)i.next()).getInvokedBy();
426
							   TRCMethodInvocation mi = ((TRCMethodInvocation)i.next());
411
								if(mi != null && mi.getMethod().equals(m))
427
																
412
									nb++;
428
								if(mi != null && mi.getInvokedBy().getMethod().equals(m)) {
429
									if (mi instanceof TRCAggregatedMethodInvocation) {
430
										nb += ((TRCAggregatedMethodInvocation) mi).getCount();
431
									}
432
									else {
433
										nb++;
434
									}
435
								}
413
								
436
								
414
							}
437
							}
415
							
438
							
Lines 523-571 Link Here
523
				   	 else if(_methodDetailsType == CHILDREN_DETAILS)
546
				   	 else if(_methodDetailsType == CHILDREN_DETAILS)
524
				   	 {				   		 
547
				   	 {				   		 
525
							//get nb of invocations called by the selected method
548
							//get nb of invocations called by the selected method
526
							if(selection != null)
549
				   		 	
550
				   		if(selection != null)
551
						{
552
							
553
							Iterator i1 = ((TRCMethod)e1).getInvocations().iterator();
554
							while(i1.hasNext())
527
							{
555
							{
528
								
556
								TRCMethodInvocation mi = ((TRCMethodInvocation)i1.next()).getInvokedBy();
529
								Iterator i1 = ((TRCMethod)e1).getInvocations().iterator();
557
								if(mi != null && mi.getMethod().equals(selection)) {
530
								while(i1.hasNext())
558
									if (mi instanceof TRCAggregatedMethodInvocation) {
531
								{
559
										nb1 += ((TRCAggregatedMethodInvocation) mi).getCount();
532
									TRCMethodInvocation mi = ((TRCMethodInvocation)i1.next()).getInvokedBy();
560
									}
533
									if(mi != null && mi.getMethod().equals(selection))
561
									else {
534
										nb1++;
562
										nb1++;
535
									
563
									}
536
								}
564
								}
537
								
565
								
538
								
566
							}
539
								Iterator i2 = ((TRCMethod)e2).getInvocations().iterator();
567
							
540
								while(i1.hasNext())
568
							Iterator i2 = ((TRCMethod)e2).getInvocations().iterator();
541
								{
569
							while(i2.hasNext())
542
									TRCMethodInvocation mi = ((TRCMethodInvocation)i2.next()).getInvokedBy();
570
							{
543
									if(mi != null && mi.getMethod().equals(selection))
571
								TRCMethodInvocation mi = ((TRCMethodInvocation)i2.next()).getInvokedBy();
572
								if(mi != null && mi.getMethod().equals(selection)) {
573
									if (mi instanceof TRCAggregatedMethodInvocation) {
574
										nb2 += ((TRCAggregatedMethodInvocation) mi).getCount();
575
									}
576
									else {
544
										nb2++;
577
										nb2++;
545
									
578
									}
546
								}
579
								}
547
								
580
								
548
							}
581
							}
549
							
582
							
583
						}
584
							
550
							return _sortSequence * (nb1-nb2);
585
							return _sortSequence * (nb1-nb2);
551
				   	 }
586
				   	 }
552
				   	 else if(_methodDetailsType == PARENT_DETAILS)
587
				   	 else if(_methodDetailsType == PARENT_DETAILS)
553
				   	 {				   		 
588
				   	 {				   		 
554
							//get nb of invocations called by the selected method
589
							//get nb of invocations called by the selected method
555
							if(selection != null)
590
				   		 
556
							{								
591
				   		if(selection != null)
557
								Iterator i = selection.getInvocations().iterator();
592
						{							
558
								while(i.hasNext())
593
							Iterator i = selection.getInvocations().iterator();
559
								{
594
							while(i.hasNext())
560
									TRCMethodInvocation mi = ((TRCMethodInvocation)i.next()).getInvokedBy();
595
							{
561
									if(mi != null && mi.getMethod().equals(e1))
596
							   TRCMethodInvocation mi = ((TRCMethodInvocation)i.next());
597
																
598
								if(mi != null && mi.getInvokedBy().getMethod().equals(e1)) {
599
									if (mi instanceof TRCAggregatedMethodInvocation) {
600
										nb1 += ((TRCAggregatedMethodInvocation) mi).getCount();
601
									}
602
									else {
562
										nb1++;
603
										nb1++;
563
									
604
									}
564
									if(mi != null && mi.getMethod().equals(e2))
605
								}
565
										nb2++;									
606
								
566
								}																
607
								if(mi != null && mi.getInvokedBy().getMethod().equals(e2)) {
608
									if (mi instanceof TRCAggregatedMethodInvocation) {
609
										nb2 += ((TRCAggregatedMethodInvocation) mi).getCount();
610
									}
611
									else {
612
										nb2++;
613
									}
614
								}
615
								
567
							}
616
							}
568
							
617
							
618
						}
619
							
569
							return _sortSequence * (nb1-nb2);
620
							return _sortSequence * (nb1-nb2);
570
				   	 }
621
				   	 }
571
				   	 
622
				   	 
Lines 630-639 Link Here
630
	{
681
	{
631
		super.showPercentUpdate();
682
		super.showPercentUpdate();
632
		
683
		
633
//		_callsCol.update(isShowPercent(), _totalCalls);
634
		
635
//		updateColumnLabelShowPercentage(_callsCol,isShowPercent());
636
//		updateColumnLabelTotalCalls(_callsCol,_totalCalls);
637
	}
684
	}
638
685
639
	/**
686
	/**
Lines 669-679 Link Here
669
		redrawTable();
716
		redrawTable();
670
	}
717
	}
671
718
672
//	public IContextLabelFormatProvider getContextFormatter(Object object, String attributeId)
673
//	{
674
//		if (object instanceof MethodCallDetails)
675
//			return super.getContextFormatter(((MethodCallDetails)object).getMethod(), attributeId);
676
//		else
677
//			return super.getContextFormatter(object, attributeId);
678
//	}	
679
}
719
}

Return to bug 197176