sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.button/src/com/nokia/carbide/cpp/pi/button/BupTrace.java
changeset 2 b9ab3b238396
child 5 844b047e260d
equal deleted inserted replaced
1:1050670c6980 2:b9ab3b238396
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.carbide.cpp.pi.button;
       
    19 
       
    20 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository;
       
    21 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTrace;
       
    22 import com.nokia.carbide.cpp.internal.pi.test.AnalysisInfoHandler;
       
    23 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
       
    24 import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
       
    25 
       
    26 
       
    27 public class BupTrace extends GenericSampledTrace
       
    28 {
       
    29 	
       
    30 	private static final long serialVersionUID = -2398791759386296139L;
       
    31 	
       
    32 	private double scale = 0.0;
       
    33 	private double min = 0.0;
       
    34 	private double max = 0.0;
       
    35 	private double synchValue = 0.0;
       
    36 
       
    37 	private transient BupTraceGraph[] graphs;
       
    38 	private transient IBupEventMap map;
       
    39 		
       
    40 	public GenericTraceGraph getTraceGraph(int graphIndex)
       
    41 	{
       
    42 		if (graphs == null) {
       
    43 			graphs = new BupTraceGraph[3];
       
    44 			
       
    45 			BupUpdater.getInstance().convertToLatest(this.samples);
       
    46 			
       
    47 			AnalysisInfoHandler handler = NpiInstanceRepository.getInstance().activeUidGetAnalysisInfoHandler();
       
    48 			BupEventMapManager.getInstance().releaseMap(getCurrentBupMapInUse());
       
    49 			IBupEventMapProfile profile;
       
    50 			profile = ButtonPlugin.getDefault().getBupMapProfileFromInfoHandler(handler);
       
    51 			map = BupEventMapManager.getInstance().captureMap(profile);
       
    52 		}
       
    53 
       
    54 		if (   (graphIndex == PIPageEditor.THREADS_PAGE)
       
    55 			|| (graphIndex == PIPageEditor.BINARIES_PAGE)
       
    56 			|| (graphIndex == PIPageEditor.FUNCTIONS_PAGE)) {
       
    57 			if (graphs[graphIndex] == null)
       
    58 				graphs[graphIndex] = new BupTraceGraph(graphIndex, this);
       
    59 			return graphs[graphIndex];
       
    60 		}
       
    61 	
       
    62 		return null;
       
    63 	}
       
    64 
       
    65 	public double getScale()
       
    66 	{
       
    67 		return scale;
       
    68 	}
       
    69 
       
    70 	public double getMin()
       
    71 	{
       
    72 		return min;
       
    73 	}
       
    74 
       
    75 	public double getMax()
       
    76 	{
       
    77 		return max;
       
    78 	}
       
    79 
       
    80 	public double getSynchValue()
       
    81 	{
       
    82 		return synchValue;
       
    83 	}
       
    84 
       
    85 	public void setSynchValue(double aSynchValue)
       
    86 	{
       
    87 		synchValue = aSynchValue;
       
    88 	}
       
    89 
       
    90 	public void addSample(BupSample sample)
       
    91 	{
       
    92 		this.samples.add(sample);
       
    93 	}
       
    94 
       
    95 	public BupSample getBupSample(int number)
       
    96 	{
       
    97 		return (BupSample)this.samples.elementAt(number);
       
    98 	}
       
    99 
       
   100 	/**
       
   101 	 * @return
       
   102 	 */
       
   103 	public IBupEventMap getCurrentBupMapInUse() {
       
   104 		return map;
       
   105 	}
       
   106 	
       
   107 	public void setCurrentBupMapInUse(IBupEventMap newMap) {
       
   108 		map = newMap;
       
   109 	}
       
   110 
       
   111 }