00001 package edu.rice.cs.hpc.data.experiment.scope.filters; 00002 00003 import edu.rice.cs.hpc.data.experiment.Experiment; 00004 import edu.rice.cs.hpc.data.experiment.metric.MetricType; 00005 import edu.rice.cs.hpc.data.experiment.scope.CallSiteScope; 00006 import edu.rice.cs.hpc.data.experiment.scope.LineScope; 00007 import edu.rice.cs.hpc.data.experiment.scope.Scope; 00008 00009 //only propagagate inclusive metrics 00010 public class InclusiveOnlyMetricPropagationFilter implements MetricValuePropagationFilter { 00012 protected Experiment _experiment; 00013 00014 public InclusiveOnlyMetricPropagationFilter(Experiment experiment) { 00015 this._experiment = experiment; 00016 } 00017 00018 public boolean doPropagation(Scope source, Scope target, int src_idx, int targ_idx) { 00019 //------------------------------------------------------------------------- 00020 // This part looks suspicious: the target (flat) will never be the same as the 00021 // source (cct). So far there is no proof that there is a path that return false 00022 //------------------------------------------------------------------------- 00023 if ((source instanceof LineScope)) { 00024 Scope parent = source.getParentScope(); 00025 if ((parent != null) && (parent instanceof CallSiteScope)) { 00026 if ((target != null) && (target == parent.getParentScope())) 00027 return false; 00028 } 00029 } 00030 return ( _experiment.getMetric(src_idx).getMetricType() == MetricType.INCLUSIVE ); 00031 } 00032 }