00001 package edu.rice.cs.hpc.data.experiment.metric; 00002 00003 import edu.rice.cs.hpc.data.experiment.scope.Scope; 00004 00005 public class CombineAggregateMetricVarMap extends MetricVarMap { 00006 private Scope scopes[]; 00007 private int iCounter; 00008 00009 00010 public CombineAggregateMetricVarMap() { 00011 this.scopes = new Scope[2]; 00012 iCounter = -1; 00013 } 00014 00015 public void setScopes(Scope s_source, Scope s_target) { 00016 scopes[0] = s_source; 00017 scopes[1] = s_target; 00018 iCounter = 0; 00019 } 00020 00025 public double getValue(String varName) { 00026 assert(iCounter==0 || iCounter==1); 00027 if (iCounter<0 || iCounter>1) { 00028 System.err.println("Unable to retrieve value.\n\tscopes=[" + scopes[0] + ", " + scopes[1]+"]\n\tscopes-id=[" + 00029 scopes[0].getCCTIndex() + "," + scopes[1].getCCTIndex() + "]\n\tcounter=" + iCounter ); 00030 throw new RuntimeException(); 00031 } 00032 00033 super.setScope(this.scopes[iCounter]); 00034 00035 this.iCounter++; 00036 return super.getValue(varName); 00037 } 00038 00039 }