Deleted Added
sdiff udiff text old ( 10470:2c6a72e919f6 ) new ( 10905:a6ca6831e775 )
full compact
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)
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;
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++;
1219 y++;
1220 }
1221 }
1222}
1223
1224void
1225CPA::unserialize(Checkpoint *cp, const std::string &section)
1226{
1227 UNSERIALIZE_SCALAR(numSm);
1228 UNSERIALIZE_SCALAR(numSmt);
1229 arrayParamIn(cp, section, "numSt", numSt);
1230 arrayParamIn(cp, section, "numQ", numQ);
1231 UNSERIALIZE_SCALAR(numSys);
1232 UNSERIALIZE_SCALAR(numQs);
1233 UNSERIALIZE_SCALAR(conId);
1234 arrayParamIn(cp, section, "qSize", qSize);
1235 arrayParamIn(cp, section, "qBytes", qBytes);
1236
1237
1238 // smtCache (SCache
1239 string str;
1240 int smi;
1241 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);
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++) {
1251 paramIn(cp, section, csprintf("stCache%d_%d.str", x,y), str);
1252 paramIn(cp, section, 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++) {
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);
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;
1273 paramIn(cp, section, csprintf("smCache%d", x), size);
1274 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);
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
1293 objParamIn(cp, section, csprintf("nameCache%d.name", x), sptr);
1294 sys = dynamic_cast<System*>(sptr);
1295
1296 paramIn(cp, section, csprintf("nameCache%d.str", x), str);
1297 paramIn(cp, section, csprintf("nameCache%d.int", x), sysi);
1298 nameCache[sys] = std::make_pair(str, sysi);
1299 }
1300
1301 //smStack (SmStack)
1302 int smStack_size;
1303 paramIn(cp, section, "smStackIdCount", smStack_size);
1304 for (int x = 0; x < smStack_size; x++) {
1305 int sysi;
1306 uint64_t frame;
1307 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);
1311 StackId sid = StackId(sysi, frame);
1312 for (int y = 0; y < count; y++) {
1313 paramIn(cp, section, 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;
1321 paramIn(cp, section, "lnMapSize", lnMap_size);
1322 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);
1325 lnMap[smi] = lsmi;
1326 }
1327
1328 // swExpl (vector)
1329 int swExpl_size;
1330 paramIn(cp, section, "swExplCount", swExpl_size);
1331 for (int x = 0; x < swExpl_size; x++) {
1332 int sysi;
1333 uint64_t frame;
1334 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);
1338 StackId sid = StackId(sysi, frame);
1339 swExpl[sid] = b;
1340 }
1341
1342 // lastState (IMap)
1343 int sti;
1344 int lastState_size;
1345 paramIn(cp, section, "lastStateSize", lastState_size);
1346 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);
1349 lastState[smi] = sti;
1350 }
1351
1352
1353 //smMap (IdMap)
1354 smMap.resize(numSm);
1355 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);
1359 }
1360
1361 //qMap (IdMap)
1362 qMap.resize(numQs);
1363 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);
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>();
1377 a->unserialize(cp, csprintf("%s.Q%d_%d", section, x, y));
1378 data.push_back(a);
1379 qData[x].push_back(a);
1380 }
1381 }
1382}
1383
1384void
1385CPA::AnnotateData::serialize(std::ostream &os)
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
1397CPA::AnnotateData::unserialize(Checkpoint *cp, const std::string &section)
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