1919
2020#include " XMLTree.h"
2121
22+ #include < algorithm>
23+
2224using namespace std ;
2325
2426static const list<RteDeviceProperty*> EMPTY_PROPERTY_LIST;
@@ -813,6 +815,23 @@ RteDeviceProperty* RteDeviceItem::GetSingleEffectiveProperty(const string& tag,
813815 return nullptr ;
814816}
815817
818+ std::list<RteDeviceProperty*> RteDeviceItem::GetAllEffectiveProperties (const std::string& tag)
819+ {
820+ // Make a copy, simpler to merge with potential processor specific memories
821+ list<RteDeviceProperty*> properties = GetEffectiveProperties (tag, RteUtils::EMPTY_STRING);
822+ // Iterate over processors
823+ for (auto [pname, _] : GetProcessors ()) {
824+ // Collect processor - unique memories
825+ const list<RteDeviceProperty*>& procProps = GetEffectiveProperties (tag, pname);
826+ for (auto p : procProps) {
827+ if (std::find (properties.begin (), properties.end (), p) == properties.end ()) {
828+ properties.push_back (p);
829+ }
830+ }
831+ }
832+ return properties;
833+ }
834+
816835
817836void RteDeviceItem::GetEffectiveFilterAttributes (const string& pName, XmlItem& attributes)
818837{
@@ -1175,9 +1194,6 @@ string RteDeviceItemAggregate::GetSummaryString() const
11751194 list<RteDeviceProperty*> processors;
11761195 item->GetEffectiveProcessors (processors);
11771196
1178- // Make a copy, simpler to merge with potential processor specific memories
1179- list<RteDeviceProperty*> mems = item->GetEffectiveProperties (" memory" , RteUtils::EMPTY_STRING);
1180-
11811197 // Iterate over processors
11821198 for (auto it = processors.begin (); it != processors.end (); ++it) {
11831199 procProperties = *it;
@@ -1205,39 +1221,21 @@ string RteDeviceItemAggregate::GetSummaryString() const
12051221 }
12061222 summary += GetScaledClockFrequency (dclock);
12071223 }
1208-
1209- // Collect unique memory attributes
1210- const list<RteDeviceProperty*>& procMems = item->GetEffectiveProperties (" memory" , procProperties->GetAttribute (" Pname" ));
1211- list<RteDeviceProperty*> addMems;
1212- for (auto procMemIt = procMems.begin (); procMemIt != procMems.end (); ++procMemIt) {
1213- auto memsIt = mems.begin ();
1214- for (; memsIt != mems.end (); ++memsIt) {
1215- if ((*memsIt) == (*procMemIt)) {
1216- break ;
1217- }
1218- }
1219- if (memsIt == mems.end ()) {
1220- addMems.push_back (*procMemIt);
1221- }
1222- }
1223-
1224- if (!addMems.empty ()) {
1225- mems.insert (mems.end (), addMems.begin (), addMems.end ());
1226- }
12271224 }
12281225
12291226 // Memory (RAM/ROM)
1230- unsigned int ramSize = 0 , romSize = 0 ;
1231-
1227+ unsigned long long ramSize = 0 , romSize = 0 ;
1228+ // Get all memory properties
1229+ list<RteDeviceProperty*> mems = item->GetAllEffectiveProperties (" memory" );
12321230 for (auto memsIt = mems.begin (); memsIt != mems.end (); ++memsIt) {
12331231 RteDeviceMemory* mem = dynamic_cast <RteDeviceMemory*>(*memsIt);
12341232 if (!mem) {
12351233 continue ;
12361234 }
12371235 if (mem->IsWriteAccess ()) {
1238- ramSize += mem->GetAttributeAsUnsigned (" size" );
1236+ ramSize += mem->GetAttributeAsULL (" size" );
12391237 } else if (mem->IsReadAccess ()) {
1240- romSize += mem->GetAttributeAsUnsigned (" size" );
1238+ romSize += mem->GetAttributeAsULL (" size" );
12411239 }
12421240 }
12431241
@@ -1258,24 +1256,24 @@ string RteDeviceItemAggregate::GetSummaryString() const
12581256 return summary;
12591257}
12601258
1261- string RteDeviceItemAggregate::GetMemorySizeString (unsigned int size)
1259+ string RteDeviceItemAggregate::GetMemorySizeString (unsigned long long size)
12621260{
12631261 if (size == 0 ) {
12641262 return RteUtils::EMPTY_STRING;
12651263 }
12661264
12671265 if (size < 1024 ) {
1268- return (to_string (( unsigned long long ) size) + " Byte" );
1266+ return (to_string (size) + " Byte" );
12691267 }
12701268
12711269 size >>= 10 ; // Scale to kByte
12721270 if (size < 1024 || size % 1024 ) {
12731271 // Less than a MByte or division with rest => show kByte
1274- return (to_string (( unsigned long long ) size) + " kB " );
1272+ return (to_string (size) + " KiB " );
12751273 }
12761274
12771275 size >>= 10 ; // Scale to MByte
1278- return (to_string (( unsigned long long ) size) + " MB " );
1276+ return (to_string (size) + " MiB " );
12791277}
12801278
12811279string RteDeviceItemAggregate::GetScaledClockFrequency (const string& dclock)
0 commit comments