1320 | | debugError("TODO: Implement getPeakValue(%s)\n", dest.c_str()); |
---|
1321 | | /*if((unsigned)source >= m_sources.size()) { |
---|
1322 | | debugWarning("source id out of range (%d)\n", source); |
---|
1323 | | return false; |
---|
1324 | | } |
---|
1325 | | Source s = m_sources.at(source); |
---|
1326 | | |
---|
1327 | | if((unsigned)dest >= m_destinations.size()) { |
---|
1328 | | debugWarning("destination id out of range (%d)\n", dest); |
---|
1329 | | return false; |
---|
1330 | | } |
---|
1331 | | Destination d = m_destinations.at(dest); |
---|
1332 | | |
---|
1333 | | debugOutput(DEBUG_LEVEL_VERBOSE, "getting peak info for [%d] %s => [%d] %s\n", |
---|
1334 | | source, s.name.c_str(), |
---|
1335 | | dest, d.name.c_str()); |
---|
1336 | | |
---|
1337 | | // update the peak information |
---|
1339 | | |
---|
1340 | | // construct the routing entry to find |
---|
1341 | | RouterConfig::Route r = {s.src, s.srcChannel, d.dst, d.dstChannel, 0}; |
---|
1342 | | |
---|
1343 | | // find the appropriate entry |
---|
1344 | | int idx = m_peak.getRouteIndex(r); |
---|
1345 | | |
---|
1346 | | if (idx < 0) { |
---|
1347 | | // the route is not present |
---|
1348 | | return -1; |
---|
1349 | | } else { |
---|
1350 | | // the route is present |
---|
1351 | | r = m_peak.getRoute(idx); |
---|
1352 | | return r.peak; |
---|
1353 | | }*/ |
---|
1354 | | return -1; |
---|
1355 | | |
---|
| 1323 | unsigned char dst = m_destinations[dest]; |
---|
| 1324 | return m_peak.getPeak(dst); |
---|
1361 | | debugError("TODO: implement getPeakValues()\n"); |
---|
1362 | | /*m_peak.read(); |
---|
1363 | | Control::CrossbarRouter::PeakValues values; |
---|
1364 | | for (unsigned int i=0; i<m_peak.getNbRoutes(); ++i) { |
---|
1365 | | Control::CrossbarRouter::PeakValue tmp; |
---|
1366 | | RouterConfig::Route route = m_peak.getRoute(i); |
---|
1367 | | tmp.destination = getDestinationIndex(route.dst, route.dstChannel); |
---|
1368 | | tmp.peakvalue = route.peak; |
---|
1369 | | values.push_back(tmp); |
---|
1370 | | } |
---|
1371 | | return values;*/ |
---|
1372 | | return std::map<std::string, double>(); |
---|
| 1330 | m_peak.read(); |
---|
| 1331 | std::map<std::string, double> ret; |
---|
| 1332 | std::map<unsigned char, int> peaks = m_peak.getPeaks(); |
---|
| 1333 | for (std::map<unsigned char, int>::iterator it=peaks.begin(); it!=peaks.end(); ++it) { |
---|
| 1334 | ret[getDestinationName(it->first)] = it->second; |
---|
| 1335 | } |
---|
| 1336 | return ret; |
---|
1592 | | debugError("PeakSpace::show() is currently not implemented!\n"); |
---|
1593 | | #if 0 |
---|
1594 | | for ( RouteVectorIterator it = m_routes.begin(); |
---|
1595 | | it != m_routes.end(); |
---|
1596 | | ++it ) |
---|
1597 | | { |
---|
1598 | | struct Route r = *it; |
---|
1599 | | printMessage("%s:%02d => %s:%02d : %06d\n", |
---|
1600 | | srcBlockToString(r.src), r.srcChannel, |
---|
1601 | | dstBlockToString(r.dst), r.dstChannel, |
---|
1602 | | r.peak); |
---|
1603 | | } |
---|
1604 | | #endif |
---|
| 1546 | printMessage(" %i peaks\n", m_peaks.size()); |
---|
| 1547 | for (std::map<unsigned char, int>::iterator it=m_peaks.begin(); it!=m_peaks.end(); ++it) { |
---|
| 1548 | printMessage("0x%02x : %i\n", it->first, it->second); |
---|
| 1549 | } |
---|
| 1550 | } |
---|
| 1551 | |
---|
| 1552 | int |
---|
| 1553 | EAP::PeakSpace::getPeak(unsigned char dst) { |
---|
| 1554 | int ret = m_peaks[dst]; |
---|
| 1555 | m_peaks.erase(dst); |
---|
| 1556 | return ret; |
---|
| 1557 | } |
---|
| 1558 | |
---|
| 1559 | std::map<unsigned char, int> |
---|
| 1560 | EAP::PeakSpace::getPeaks() { |
---|
| 1561 | // Create a new empty map |
---|
| 1562 | std::map<unsigned char, int> ret; |
---|
| 1563 | // Swap the peak map with the new and empty one |
---|
| 1564 | ret.swap(m_peaks); |
---|
| 1565 | // Return the now filled map of the peaks :-) |
---|
| 1566 | return ret; |
---|