Example #1
0
// busy intervals are produced from Intervals.fixed
void ScheduleToXML::BusyToXML(ofstream &f){
	int inc = 0;
	// for each resource type
	for (unsigned i = 0; i < data.resources.size(); i++){
		Intervals windows;
		// get intervals of this resource type
		data.resources[i].GetCurrentWindows(windows);
		// get fixed intervals 
		vector <BusyIntervals> fixed = windows.GetFixedIntervals();
		// for each resource
		for (unsigned j = 0; j < fixed.size(); j++){
			// get pointer to resource's intervals
			BusyIntervals::iterator bIt = fixed[j].begin();
			// loop on different cores
			for (;bIt != fixed[j].end(); bIt++){
				int coreNum = bIt->first-1;
				coreNum += inc;
				// loop on different intervals
				for (vector<pair<int,int>>::size_type k = 0; k < bIt->second.size(); k++){
					int tBegin = bIt->second[k].first;
					int tEnd = bIt->second[k].second;
					f << "\t\t<node_statistics>" << endl;
					f << "\t\t	<node_property name=\"id\" value=\""<< coreNum <<"\"/>" << endl;
					f << "\t\t	<node_property name=\"type\" value=\"busy\"/>" << endl;
					f << "\t\t	<node_property name=\"start_time\" value=\"" << tBegin << "\"/>" << endl;
					f << "\t\t	<node_property name=\"end_time\" value=\"" << tEnd << "\"/>" << endl;
					f << "\t\t	<configuration>" << endl;
					f << "\t\t	  <conf_property name=\"cluster_id\" value=\"0\"/>" << endl;
					f << "\t\t	  <conf_property name=\"host_nb\" value=\"1\"/>" << endl;
					f << "\t\t	  <host_lists>" << endl;
					f << "\t\t	    <hosts start=\"" << coreNum << "\" nb=\"1\"/>" << endl;
					f << "\t\t	  </host_lists>" << endl;
					f << "\t\t	</configuration>" << endl;
					f << "\t\t</node_statistics>" << endl;
				}
			}
			inc += fixed[j].size();
			
		}
	}
}