ProcedureScope.java

Go to the documentation of this file.
00001 
00002 //                                  //
00003 //  ProcedureScope.java                     //
00004 //                                  //
00005 //  experiment.scope.ProcedureScope -- a procedure scope        //
00006 //  Last edited: August 10, 2001 at 2:22 pm             //
00007 //                                  //
00008 //  (c) Copyright 2001 Rice University. All rights reserved.    //
00009 //                                  //
00011 
00012 
00013 
00014 
00015 package edu.rice.cs.hpc.data.experiment.scope;
00016 
00017 import edu.rice.cs.hpc.data.experiment.BaseExperiment;
00018 import edu.rice.cs.hpc.data.experiment.scope.filters.MetricValuePropagationFilter;
00019 import edu.rice.cs.hpc.data.experiment.scope.visitors.AbstractFinalizeMetricVisitor;
00020 import edu.rice.cs.hpc.data.experiment.scope.visitors.IScopeVisitor;
00021 import edu.rice.cs.hpc.data.experiment.scope.visitors.PercentScopeVisitor;
00022 import edu.rice.cs.hpc.data.experiment.source.SourceFile;
00023 import edu.rice.cs.hpc.data.util.IUserData;
00024 
00025 
00026 
00027 
00029 //  CLASS PROCEDURE-SCOPE                       //
00031 
00039 public class ProcedureScope extends Scope  implements IMergedScope 
00040 {
00041 
00042 
00044 protected String procedureName;
00045 protected boolean isalien;
00046 // we assume that all procedure scope has the information on load module it resides
00047 protected LoadModuleScope objLoadModule;
00048 
00049 final static public String INLINE_NOTATION = "[I] ";
00050 
00054 //protected int iScopeID;
00055 
00057 //  INITIALIZATION  
00059 
00060 
00061 
00062 
00063 /*************************************************************************
00064  *  Creates a ProcedureScope.
00065  ************************************************************************/
00066     
00067 public ProcedureScope(BaseExperiment experiment, SourceFile file, int first, int last, 
00068         String proc, boolean _isalien, int cct_id, int flat_id, IUserData<String,String> userData)
00069 {
00070     super(experiment, file, first, last, cct_id, flat_id);
00071     this.isalien = _isalien;
00072     this.procedureName = proc;
00073 
00074     if (userData != null) {
00075         String newName = userData.get(proc);
00076         if (newName != null) 
00077             procedureName = newName;
00078     }
00079     this.objLoadModule = null;
00080 }
00081 
00082 
00093 public ProcedureScope(BaseExperiment experiment, LoadModuleScope loadModule, SourceFile file, 
00094         int first, int last, String proc, boolean _isalien, int cct_id, int flat_id, IUserData<String,String> userData)
00095 {
00096     this(experiment, file, first, last,proc,_isalien, cct_id, flat_id, userData);
00097     //this.iScopeID = sid;
00098     this.objLoadModule = loadModule;
00099 }
00100 
00101 public boolean equals(Object obj) {
00102     if (obj instanceof ProcedureScope) {
00103         ProcedureScope p = (ProcedureScope) obj;
00104         return this.getName().equals(p.getName()) && this.getSourceFile().getName().equals(p.getSourceFile().getName());
00105     } else return false;
00106 }
00107 
00109 //  SCOPE DISPLAY   
00111 
00112 
00113 
00114 
00115 /*************************************************************************
00116  *  Returns the user visible name for this scope.
00117  ************************************************************************/
00118     
00119 public String getName()
00120 {   
00121     if (isalien) {
00122         final String TheProcedureWhoShouldNotBeNamed = "-";
00123         if (procedureName.equals(TheProcedureWhoShouldNotBeNamed)) {
00124             return "inlined at " + this.getSourceCitation();
00125         } 
00126         String name = procedureName.isEmpty() ? "" : INLINE_NOTATION + procedureName;
00127         return name;
00128     } else return this.procedureName;
00129 }
00130 
00131 
00132 /*************************************************************************
00133  *  Return a duplicate of this procedure scope, 
00134  *  minus the tree information .
00135  ************************************************************************/
00136 
00137 public Scope duplicate() {
00138     return new ProcedureScope(this.experiment,
00139             this.objLoadModule,
00140             this.sourceFile, 
00141             this.firstLineNumber, 
00142             this.lastLineNumber,
00143             this.procedureName,
00144             this.isalien,
00145             getCCTIndex(), // Laks 2008.08.26: add the sequence ID
00146             this.flat_node_index,
00147             null);
00148 
00149 }
00150 
00151 public boolean isAlien() {
00152     return this.isalien;
00153 }
00154 
00156 //support for visitors                                                  //
00158 
00159 public void accept(IScopeVisitor visitor, ScopeVisitType vt) {
00160     visitor.visit(this, vt);
00161 }
00162 
00164 //support for Flat visitors                                             //
00166 
00167 public LoadModuleScope getLoadModule() {
00168     return this.objLoadModule;
00169 }
00170 /*
00171 public int getSID() {
00172     return this.iScopeID;
00173 } */
00174 
00175 public Object[] getAllChildren(AbstractFinalizeMetricVisitor finalizeVisitor, PercentScopeVisitor percentVisitor,
00176         MetricValuePropagationFilter inclusiveOnly,
00177         MetricValuePropagationFilter exclusiveOnly) {
00178 
00179     return this.getChildren();
00180 }
00181 
00182 
00183 }
00184 
00185 

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1