cp_annotate.cc (10470:2c6a72e919f6) | cp_annotate.cc (10905:a6ca6831e775) |
---|---|
1/* 2 * Copyright (c) 2006-2009 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 1049 unchanged lines hidden (view full) --- 1058 add(OP_DEQUEUE, flags, cpuid, sm, qi, count); 1059 DPRINTF(AnnotateQ, "Dequeing in queue %s size now %d/%d\n", 1060 q, qSize[qi-1], qBytes[qi-1]); 1061} 1062 1063 1064 1065void | 1/* 2 * Copyright (c) 2006-2009 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 1049 unchanged lines hidden (view full) --- 1058 add(OP_DEQUEUE, flags, cpuid, sm, qi, count); 1059 DPRINTF(AnnotateQ, "Dequeing in queue %s size now %d/%d\n", 1060 q, qSize[qi-1], qBytes[qi-1]); 1061} 1062 1063 1064 1065void |
1066CPA::serialize(std::ostream &os) | 1066CPA::serialize(CheckpointOut &cp) const |
1067{ 1068 1069 SERIALIZE_SCALAR(numSm); 1070 SERIALIZE_SCALAR(numSmt); 1071 arrayParamOut(os, "numSt", numSt); 1072 arrayParamOut(os, "numQ", numQ); 1073 SERIALIZE_SCALAR(numSys); 1074 SERIALIZE_SCALAR(numQs); 1075 SERIALIZE_SCALAR(conId); 1076 arrayParamOut(os, "qSize", qSize); 1077 arrayParamOut(os, "qSize", qSize); 1078 arrayParamOut(os, "qBytes", qBytes); 1079 | 1067{ 1068 1069 SERIALIZE_SCALAR(numSm); 1070 SERIALIZE_SCALAR(numSmt); 1071 arrayParamOut(os, "numSt", numSt); 1072 arrayParamOut(os, "numQ", numQ); 1073 SERIALIZE_SCALAR(numSys); 1074 SERIALIZE_SCALAR(numQs); 1075 SERIALIZE_SCALAR(conId); 1076 arrayParamOut(os, "qSize", qSize); 1077 arrayParamOut(os, "qSize", qSize); 1078 arrayParamOut(os, "qBytes", qBytes); 1079 |
1080 std::list<AnnDataPtr>::iterator ai; 1081 | |
1082 SCache::iterator i; 1083 int x = 0, y = 0; 1084 1085 // smtCache (SCache) 1086 x = 0; 1087 y = 0; 1088 i = smtCache.begin(); 1089 while (i != smtCache.end()) { --- 116 unchanged lines hidden (view full) --- 1206 paramOut(os, csprintf("qMap%d.id", x), qMap[x].second.second); 1207 } 1208 1209 // qData (vector<AnnotateList>) 1210 for(x = 0; x < qData.size(); x++) { 1211 if (!qData[x].size()) 1212 continue; 1213 y = 0; | 1080 SCache::iterator i; 1081 int x = 0, y = 0; 1082 1083 // smtCache (SCache) 1084 x = 0; 1085 y = 0; 1086 i = smtCache.begin(); 1087 while (i != smtCache.end()) { --- 116 unchanged lines hidden (view full) --- 1204 paramOut(os, csprintf("qMap%d.id", x), qMap[x].second.second); 1205 } 1206 1207 // qData (vector<AnnotateList>) 1208 for(x = 0; x < qData.size(); x++) { 1209 if (!qData[x].size()) 1210 continue; 1211 y = 0; |
1214 ai = qData[x].begin(); 1215 while (ai != qData[x].end()) { 1216 nameOut(os, csprintf("%s.Q%d_%d", name(), x, y)); 1217 (*ai)->serialize(os); 1218 ai++; | 1212 for (auto &ann : qData[x]) { 1213 ann->serializeSection(os, csprintf("Q%d_%d", x, y)); |
1219 y++; 1220 } 1221 } 1222} 1223 1224void | 1214 y++; 1215 } 1216 } 1217} 1218 1219void |
1225CPA::unserialize(Checkpoint *cp, const std::string §ion) | 1220CPA::unserialize(CheckpointIn &cp) |
1226{ 1227 UNSERIALIZE_SCALAR(numSm); 1228 UNSERIALIZE_SCALAR(numSmt); | 1221{ 1222 UNSERIALIZE_SCALAR(numSm); 1223 UNSERIALIZE_SCALAR(numSmt); |
1229 arrayParamIn(cp, section, "numSt", numSt); 1230 arrayParamIn(cp, section, "numQ", numQ); | 1224 UNSERIALIZE_CONTAINER(numSt); 1225 UNSERIALIZE_CONTAINER(numQ); |
1231 UNSERIALIZE_SCALAR(numSys); 1232 UNSERIALIZE_SCALAR(numQs); 1233 UNSERIALIZE_SCALAR(conId); | 1226 UNSERIALIZE_SCALAR(numSys); 1227 UNSERIALIZE_SCALAR(numQs); 1228 UNSERIALIZE_SCALAR(conId); |
1234 arrayParamIn(cp, section, "qSize", qSize); 1235 arrayParamIn(cp, section, "qBytes", qBytes); | 1229 UNSERIALIZE_CONTAINER(qSize); 1230 UNSERIALIZE_CONTAINER(qBytes); |
1236 1237 1238 // smtCache (SCache 1239 string str; 1240 int smi; 1241 for (int x = 0; x < numSmt; x++) { | 1231 1232 1233 // smtCache (SCache 1234 string str; 1235 int smi; 1236 for (int x = 0; x < numSmt; x++) { |
1242 paramIn(cp, section, csprintf("smtCache%d.str", x), str); 1243 paramIn(cp, section, csprintf("smtCache%d.int", x), smi); | 1237 paramIn(cp, csprintf("smtCache%d.str", x), str); 1238 paramIn(cp, csprintf("smtCache%d.int", x), smi); |
1244 smtCache[str] = smi; 1245 } 1246 1247 // stCache (StCache) 1248 stCache.resize(numSmt); 1249 for (int x = 0; x < numSmt; x++) { 1250 for (int y = 0; y < numSt[x]; y++) { | 1239 smtCache[str] = smi; 1240 } 1241 1242 // stCache (StCache) 1243 stCache.resize(numSmt); 1244 for (int x = 0; x < numSmt; x++) { 1245 for (int y = 0; y < numSt[x]; y++) { |
1251 paramIn(cp, section, csprintf("stCache%d_%d.str", x,y), str); 1252 paramIn(cp, section, csprintf("stCache%d_%d.int", x,y), smi); | 1246 paramIn(cp, csprintf("stCache%d_%d.str", x,y), str); 1247 paramIn(cp, csprintf("stCache%d_%d.int", x,y), smi); |
1253 stCache[x][str] = smi; 1254 } 1255 } 1256 1257 // qCache (IdCache) 1258 uint64_t id; 1259 qCache.resize(numSys); 1260 for (int x = 0; x < numSys; x++) { 1261 for (int y = 0; y < numQ[x]; y++) { | 1248 stCache[x][str] = smi; 1249 } 1250 } 1251 1252 // qCache (IdCache) 1253 uint64_t id; 1254 qCache.resize(numSys); 1255 for (int x = 0; x < numSys; x++) { 1256 for (int y = 0; y < numQ[x]; y++) { |
1262 paramIn(cp, section, csprintf("qCache%d_%d.str", x,y), str); 1263 paramIn(cp, section, csprintf("qCache%d_%d.id", x,y), id); 1264 paramIn(cp, section, csprintf("qCache%d_%d.int", x,y), smi); | 1257 paramIn(cp, csprintf("qCache%d_%d.str", x,y), str); 1258 paramIn(cp, csprintf("qCache%d_%d.id", x,y), id); 1259 paramIn(cp, csprintf("qCache%d_%d.int", x,y), smi); |
1265 qCache[x][Id(str,id)] = smi; 1266 } 1267 } 1268 1269 // smCache (IdCache) 1270 smCache.resize(numSys); 1271 for (int x = 0; x < numSys; x++) { 1272 int size; | 1260 qCache[x][Id(str,id)] = smi; 1261 } 1262 } 1263 1264 // smCache (IdCache) 1265 smCache.resize(numSys); 1266 for (int x = 0; x < numSys; x++) { 1267 int size; |
1273 paramIn(cp, section, csprintf("smCache%d", x), size); | 1268 paramIn(cp, csprintf("smCache%d", x), size); |
1274 for (int y = 0; y < size; y++) { | 1269 for (int y = 0; y < size; y++) { |
1275 paramIn(cp, section, csprintf("smCache%d_%d.str", x,y), str); 1276 paramIn(cp, section, csprintf("smCache%d_%d.id", x,y), id); 1277 paramIn(cp, section, csprintf("smCache%d_%d.int", x,y), smi); | 1270 paramIn(cp, csprintf("smCache%d_%d.str", x,y), str); 1271 paramIn(cp, csprintf("smCache%d_%d.id", x,y), id); 1272 paramIn(cp, csprintf("smCache%d_%d.int", x,y), smi); |
1278 smCache[x][Id(str,id)] = smi; 1279 } 1280 } 1281 1282 // scLinks (ScCache) -- data not serialized, just creating one per sys 1283 for (int x = 0; x < numSys; x++) 1284 scLinks.push_back(ScHCache()); 1285 1286 // nameCache (NameCache) 1287 for (int x = 0; x < numSys; x++) { 1288 System *sys; 1289 SimObject *sptr; 1290 string str; 1291 int sysi; 1292 | 1273 smCache[x][Id(str,id)] = smi; 1274 } 1275 } 1276 1277 // scLinks (ScCache) -- data not serialized, just creating one per sys 1278 for (int x = 0; x < numSys; x++) 1279 scLinks.push_back(ScHCache()); 1280 1281 // nameCache (NameCache) 1282 for (int x = 0; x < numSys; x++) { 1283 System *sys; 1284 SimObject *sptr; 1285 string str; 1286 int sysi; 1287 |
1293 objParamIn(cp, section, csprintf("nameCache%d.name", x), sptr); | 1288 objParamIn(cp, csprintf("nameCache%d.name", x), sptr); |
1294 sys = dynamic_cast<System*>(sptr); 1295 | 1289 sys = dynamic_cast<System*>(sptr); 1290 |
1296 paramIn(cp, section, csprintf("nameCache%d.str", x), str); 1297 paramIn(cp, section, csprintf("nameCache%d.int", x), sysi); | 1291 paramIn(cp, csprintf("nameCache%d.str", x), str); 1292 paramIn(cp, csprintf("nameCache%d.int", x), sysi); |
1298 nameCache[sys] = std::make_pair(str, sysi); 1299 } 1300 1301 //smStack (SmStack) 1302 int smStack_size; | 1293 nameCache[sys] = std::make_pair(str, sysi); 1294 } 1295 1296 //smStack (SmStack) 1297 int smStack_size; |
1303 paramIn(cp, section, "smStackIdCount", smStack_size); | 1298 paramIn(cp, "smStackIdCount", smStack_size); |
1304 for (int x = 0; x < smStack_size; x++) { 1305 int sysi; 1306 uint64_t frame; 1307 int count; | 1299 for (int x = 0; x < smStack_size; x++) { 1300 int sysi; 1301 uint64_t frame; 1302 int count; |
1308 paramIn(cp, section, csprintf("smStackId%d.sys", x), sysi); 1309 paramIn(cp, section, csprintf("smStackId%d.frame", x), frame); 1310 paramIn(cp, section, csprintf("smStackId%d.count", x), count); | 1303 paramIn(cp, csprintf("smStackId%d.sys", x), sysi); 1304 paramIn(cp, csprintf("smStackId%d.frame", x), frame); 1305 paramIn(cp, csprintf("smStackId%d.count", x), count); |
1311 StackId sid = StackId(sysi, frame); 1312 for (int y = 0; y < count; y++) { | 1306 StackId sid = StackId(sysi, frame); 1307 for (int y = 0; y < count; y++) { |
1313 paramIn(cp, section, csprintf("smStackId%d_%d", x, y), smi); | 1308 paramIn(cp, csprintf("smStackId%d_%d", x, y), smi); |
1314 smStack[sid].push_back(smi); 1315 } 1316 } 1317 1318 // lnMap (LinkMap) 1319 int lsmi; 1320 int lnMap_size; | 1309 smStack[sid].push_back(smi); 1310 } 1311 } 1312 1313 // lnMap (LinkMap) 1314 int lsmi; 1315 int lnMap_size; |
1321 paramIn(cp, section, "lnMapSize", lnMap_size); | 1316 paramIn(cp, "lnMapSize", lnMap_size); |
1322 for (int x = 0; x < lnMap_size; x++) { | 1317 for (int x = 0; x < lnMap_size; x++) { |
1323 paramIn(cp, section, csprintf("lnMap%d.smi", x), smi); 1324 paramIn(cp, section, csprintf("lnMap%d.lsmi", x), lsmi); | 1318 paramIn(cp, csprintf("lnMap%d.smi", x), smi); 1319 paramIn(cp, csprintf("lnMap%d.lsmi", x), lsmi); |
1325 lnMap[smi] = lsmi; 1326 } 1327 1328 // swExpl (vector) 1329 int swExpl_size; | 1320 lnMap[smi] = lsmi; 1321 } 1322 1323 // swExpl (vector) 1324 int swExpl_size; |
1330 paramIn(cp, section, "swExplCount", swExpl_size); | 1325 paramIn(cp, "swExplCount", swExpl_size); |
1331 for (int x = 0; x < swExpl_size; x++) { 1332 int sysi; 1333 uint64_t frame; 1334 bool b; | 1326 for (int x = 0; x < swExpl_size; x++) { 1327 int sysi; 1328 uint64_t frame; 1329 bool b; |
1335 paramIn(cp, section, csprintf("swExpl%d.sys", x), sysi); 1336 paramIn(cp, section, csprintf("swExpl%d.frame", x), frame); 1337 paramIn(cp, section, csprintf("swExpl%d.swexpl", x), b); | 1330 paramIn(cp, csprintf("swExpl%d.sys", x), sysi); 1331 paramIn(cp, csprintf("swExpl%d.frame", x), frame); 1332 paramIn(cp, csprintf("swExpl%d.swexpl", x), b); |
1338 StackId sid = StackId(sysi, frame); 1339 swExpl[sid] = b; 1340 } 1341 1342 // lastState (IMap) 1343 int sti; 1344 int lastState_size; | 1333 StackId sid = StackId(sysi, frame); 1334 swExpl[sid] = b; 1335 } 1336 1337 // lastState (IMap) 1338 int sti; 1339 int lastState_size; |
1345 paramIn(cp, section, "lastStateSize", lastState_size); | 1340 paramIn(cp, "lastStateSize", lastState_size); |
1346 for (int x = 0; x < lastState_size; x++) { | 1341 for (int x = 0; x < lastState_size; x++) { |
1347 paramIn(cp, section, csprintf("lastState%d.smi", x), smi); 1348 paramIn(cp, section, csprintf("lastState%d.sti", x), sti); | 1342 paramIn(cp, csprintf("lastState%d.smi", x), smi); 1343 paramIn(cp, csprintf("lastState%d.sti", x), sti); |
1349 lastState[smi] = sti; 1350 } 1351 1352 1353 //smMap (IdMap) 1354 smMap.resize(numSm); 1355 for (int x = 0; x < smMap.size(); x++) { | 1344 lastState[smi] = sti; 1345 } 1346 1347 1348 //smMap (IdMap) 1349 smMap.resize(numSm); 1350 for (int x = 0; x < smMap.size(); x++) { |
1356 paramIn(cp, section, csprintf("smMap%d.sys", x), smMap[x].first); 1357 paramIn(cp, section, csprintf("smMap%d.smname", x), smMap[x].second.first); 1358 paramIn(cp, section, csprintf("smMap%d.id", x), smMap[x].second.second); | 1351 paramIn(cp, csprintf("smMap%d.sys", x), smMap[x].first); 1352 paramIn(cp, csprintf("smMap%d.smname", x), smMap[x].second.first); 1353 paramIn(cp, csprintf("smMap%d.id", x), smMap[x].second.second); |
1359 } 1360 1361 //qMap (IdMap) 1362 qMap.resize(numQs); 1363 for (int x = 0; x < qMap.size(); x++) { | 1354 } 1355 1356 //qMap (IdMap) 1357 qMap.resize(numQs); 1358 for (int x = 0; x < qMap.size(); x++) { |
1364 paramIn(cp, section, csprintf("qMap%d.sys", x), qMap[x].first); 1365 paramIn(cp, section, csprintf("qMap%d.qname", x), qMap[x].second.first); 1366 paramIn(cp, section, csprintf("qMap%d.id", x), qMap[x].second.second); | 1359 paramIn(cp, csprintf("qMap%d.sys", x), qMap[x].first); 1360 paramIn(cp, csprintf("qMap%d.qname", x), qMap[x].second.first); 1361 paramIn(cp, csprintf("qMap%d.id", x), qMap[x].second.second); |
1367 } 1368 1369 1370 // qData (vector<AnnotateList>) 1371 qData.resize(qSize.size()); 1372 for (int x = 0; x < qSize.size(); x++) { 1373 if (!qSize[x]) 1374 continue; 1375 for (int y = 0; y < qSize[x]; y++) { 1376 AnnDataPtr a = std::make_shared<AnnotateData>(); | 1362 } 1363 1364 1365 // qData (vector<AnnotateList>) 1366 qData.resize(qSize.size()); 1367 for (int x = 0; x < qSize.size(); x++) { 1368 if (!qSize[x]) 1369 continue; 1370 for (int y = 0; y < qSize[x]; y++) { 1371 AnnDataPtr a = std::make_shared<AnnotateData>(); |
1377 a->unserialize(cp, csprintf("%s.Q%d_%d", section, x, y)); | 1372 a->unserializeSection(cp, csprintf("Q%d_%d", x, y)); |
1378 data.push_back(a); 1379 qData[x].push_back(a); 1380 } 1381 } 1382} 1383 1384void | 1373 data.push_back(a); 1374 qData[x].push_back(a); 1375 } 1376 } 1377} 1378 1379void |
1385CPA::AnnotateData::serialize(std::ostream &os) | 1380CPA::AnnotateData::serialize(CheckpointOut &cp) const |
1386{ 1387 SERIALIZE_SCALAR(time); 1388 SERIALIZE_SCALAR(data); 1389 SERIALIZE_SCALAR(sm); 1390 SERIALIZE_SCALAR(stq); 1391 SERIALIZE_SCALAR(op); 1392 SERIALIZE_SCALAR(flag); 1393 SERIALIZE_SCALAR(cpu); 1394} 1395 1396void | 1381{ 1382 SERIALIZE_SCALAR(time); 1383 SERIALIZE_SCALAR(data); 1384 SERIALIZE_SCALAR(sm); 1385 SERIALIZE_SCALAR(stq); 1386 SERIALIZE_SCALAR(op); 1387 SERIALIZE_SCALAR(flag); 1388 SERIALIZE_SCALAR(cpu); 1389} 1390 1391void |
1397CPA::AnnotateData::unserialize(Checkpoint *cp, const std::string §ion) | 1392CPA::AnnotateData::unserialize(CheckpointIn &cp) |
1398{ 1399 UNSERIALIZE_SCALAR(time); 1400 UNSERIALIZE_SCALAR(data); 1401 orig_data = data; 1402 UNSERIALIZE_SCALAR(sm); 1403 UNSERIALIZE_SCALAR(stq); 1404 UNSERIALIZE_SCALAR(op); 1405 UNSERIALIZE_SCALAR(flag); 1406 UNSERIALIZE_SCALAR(cpu); 1407 dump = true; 1408} 1409 1410CPA* 1411CPAParams::create() 1412{ 1413 return new CPA(this); 1414} 1415 | 1393{ 1394 UNSERIALIZE_SCALAR(time); 1395 UNSERIALIZE_SCALAR(data); 1396 orig_data = data; 1397 UNSERIALIZE_SCALAR(sm); 1398 UNSERIALIZE_SCALAR(stq); 1399 UNSERIALIZE_SCALAR(op); 1400 UNSERIALIZE_SCALAR(flag); 1401 UNSERIALIZE_SCALAR(cpu); 1402 dump = true; 1403} 1404 1405CPA* 1406CPAParams::create() 1407{ 1408 return new CPA(this); 1409} 1410 |