Commit 353b85a9 authored by Ondrej Vysocky's avatar Ondrej Vysocky

FIX fixed error of printing HDEEM samples

parent b799743e
......@@ -31,7 +31,7 @@ void DetailedTimeStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iSt
energy = new double [HDEEM::PROBE_NUMBER];
minWatts = new double [HDEEM::PROBE_NUMBER];
maxWatts = new double [HDEEM::PROBE_NUMBER];
msg = HDEEM::getData(mutils::timeToDouble(_records[iStarts.back()].time - _start), duration, &firstBlade, &lastBlade, &firstVR, &lastVR, energy, minWatts, maxWatts);
msg = HDEEM::getData(mutils::timeToDouble(_records[iStarts.back()].time), duration, &firstBlade, &lastBlade, &firstVR, &lastVR, energy, minWatts, maxWatts);
if (msg != "")
std::cerr << msg << _name[_records[iStarts.back()].region]<< std::endl;
......@@ -49,8 +49,9 @@ void DetailedTimeStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iSt
ss << "# Blade samples" << std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(0, firstBlade, lastBlade, samples);
for (size_t it = firstBlade; it < lastBlade; it++)
ss << it << "," << samples[it] << std::endl;
size_t it = firstBlade;
for (size_t i = 0; i < samples.size(); i++)
ss << it++ << "," << samples[i] << std::endl;
}
avgWatts = energy[0]/(lastBlade-firstBlade);
energyConsumption = duration * avgWatts;
......@@ -82,8 +83,10 @@ void DetailedTimeStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iSt
ss << "# Voltage regulator (" << HDEEM::vrSensorLabel[sensorID] << ") samples" << std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(sensorID, firstVR, lastVR, samples);
for (size_t it = firstVR; it < lastVR; it++)
ss << it << "," << samples[it] << std::endl;
size_t it = firstVR;
for (size_t i = 0; i < samples.size(); i++)
ss << it++ << "," << samples[i] << std::endl;
}
avgWatts = energy[sensorID]/(lastVR-firstVR);
energyConsumption = duration * avgWatts;
......
......@@ -143,8 +143,9 @@ template <class TSystem> void TimeStore<TSystem>::saveInterval(std::ofstream &ss
ss << "# Blade samples" << std::endl;
std::vector<double> samples;
TSystem::getSamplesList(0, firstBlade, lastBlade, samples);
for (size_t it = firstBlade; it < lastBlade; it++)
ss << it << "," << samples[it] << std::endl;
size_t it = firstBlade;
for (size_t i = 0; i < samples.size(); i++)
ss << it++ << "," << samples[i] << std::endl;
}
avgWatts = energy[0]/(lastBlade-firstBlade);
energyConsumption = duration * avgWatts;
......
......@@ -22,13 +22,12 @@ void HDEEM::setTimeAdjustment(timespec start)
std::string HDEEM::getData(double startTime, double duration, size_t *firstBlade, size_t *lastBlade, size_t *firstVR, size_t *lastVR, double energy[], double minWatts[], double maxWatts[])
{
std::string errMessage = "";
*firstBlade = std::ceil((startTime-_startTime) * FREQUENCY) + _timeAdjustment;
*lastBlade = std::floor(duration * FREQUENCY) + *firstBlade;
//MERIC_INFO << "FIRST " << *firstBlade << std::endl;
//MERIC_INFO << "LAST " << *lastBlade << std::endl;
MERIC_INFO << "FIRST " << *firstBlade << std::endl;
MERIC_INFO << "LAST " << *lastBlade << std::endl;
if (*lastBlade > _samples.nb_blade_values) //TODO
{
......@@ -50,7 +49,10 @@ std::string HDEEM::getData(double startTime, double duration, size_t *firstBlade
auto getEnergySamples = [&] (size_t firstSample, size_t lastSample, size_t sensorID)
{
maxWatts[sensorID] = _samples.blade_power[firstSample].value[sensorID];
if (sensorID == 0)
maxWatts[sensorID] = _samples.blade_power[firstSample].value[sensorID];
else
maxWatts[sensorID] = _samples.vr_power[firstSample].value[sensorID-1];
minWatts[sensorID] = maxWatts[sensorID];
double valTmp;
for (size_t it = firstSample; it < lastSample; it++)
......@@ -58,7 +60,7 @@ std::string HDEEM::getData(double startTime, double duration, size_t *firstBlade
if (sensorID == 0)
valTmp = _samples.blade_power[it].value[sensorID];
else
valTmp = _samples.vr_power[it].value[sensorID];
valTmp = _samples.vr_power[it].value[sensorID-1];
if (valTmp > maxWatts[sensorID])
maxWatts[sensorID] = valTmp;
else if (valTmp < minWatts[sensorID])
......@@ -105,7 +107,6 @@ void HDEEM::getSamplesList(size_t sensorId, size_t first, size_t last, std::vect
for (size_t i = first; i < last; i++)
samples.push_back(_samples.vr_power[i].value[sensorId-1]);
}
std::cerr << "samples_size " << samples.size() << std::endl;
}
double HDEEM::getResultValue(double startValue, double stopValue, double runtime, std::string counter)
......@@ -136,7 +137,7 @@ size_t HDEEM::energy = 0;
//TODO spojit tyto 3 polozky v jednu
std::string HDEEM::storeLabel = "hdeem";
std::vector<std::string> HDEEM::vrSensorLabel = {"CPU0", "CPU1", "DDR AB", "DDR CD", "DDR EF", "DDR GH"};
std::vector<std::string> HDEEM::vrSensorLabel = {"blade", "CPU0", "CPU1", "DDR AB", "DDR CD", "DDR EF", "DDR GH"};
//const int HDEEM::PROBE_NUMBER = vrSensorLabel.size() + 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment