test/processingMeasures.cpp
/*
 * Iterate the measures map
 * how are the data stored right now?

 *  for each entry
        grab feature-vector and policy

  Convert to a data structure matching the output data
     feaure 1, feature 2, policy0, policy 1, policy 2, exec_count, time_total, time_average


 *  Need to know total policy count
 * */


for each entry
grab feature-vector and policy

Convert to a data structure matching the output data
feaure 1, feature 2, policy0, policy 1, policy 2, exec_count, time_total, time_average

Need to know total policy count
for each entry grab feature - vector and policy Convert to a data structure matching the output data feaure 1 feature 2 policy0 policy 1 policy 2 exec_count time_total time_average Need to know total policy count
void 
Region::generatePlotDataFile(const string & outputfile)
{
  stringstream trace_out; 
  trace_out <<"feature0";
  for (size_t i =0;i< max_policy_id+1; i++)
    trace_out<<"\tpolicy#"<<i;
  trace_out <<endl;
  std::map<std::pair< std::vector<float>, int >,
              std::unique_ptr<Region::Measure> >::iterator iter;
  iter= measures.begin();
  while (iter!=measures.end())
  {
    vector<float> features = iter->first.first;
    float feature1_val = features[0];
    trace_out<< features[0]<<"\t";
    int count= max_policy_id +1 ;
    while (count-- && iter!=measures.end())
    {
      assert (feature1_val== iter->first.first[0]);
      trace_out<<iter->second->time_total<<"\t";
      iter++;
    }
    trace_out<<endl;
  }
  ofstream fout (outputfile);
  fout<< trace_out.str();
  fout.close();
}
void Region :: generatePlotDataFile ( const string & outputfile ) { stringstream trace_out ; trace_out << " " ; for ( size_t i = 0 ; i < max_policy_id + 1 ; i ++ ) trace_out << " \t " << i ; trace_out << endl ; std :: map < std :: pair < std :: vector < float > , int > , std :: unique_ptr < Region :: Measure > > :: iterator iter ; iter = measures . begin ( ) ; while ( iter != measures . end ( ) ) { vector < float > features = iter -> first . first ; float feature1_val = features [ 0 ] ; trace_out << features [ 0 ] << " \t " ; int count = max_policy_id + 1 ; while ( count -- && iter != measures . end ( ) ) { assert ( feature1_val == iter -> first . first [ 0 ] ) ; trace_out << iter -> second -> time_total << " \t " ; iter ++ ; } trace_out << endl ; } ofstream fout ( outputfile ) ; fout << trace_out . str ( ) ; fout . close ( ) ; }
Iterate the measures map
 how are the data stored right now?
Iterate the measures map how are the data stored right now?
// TODO: multiple features, how to output them? // we only need total value in this case // for (auto &e: measures) //for (iter=measures.begin(); iter!=measures.end(); iter++) // cout<<"inside while ..."<<endl;  // we grab max_policy_count of records each time // go through policy count of record to grab the total execution time // the batch should have the same feature value // Currently the total time is picked.  // TODO: an option to grab time_avg instead.