eventq.cc (10412:6400a2ab4e22) | eventq.cc (10905:a6ca6831e775) |
---|---|
1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * Copyright (c) 2008 The Hewlett-Packard Development Company 4 * Copyright (c) 2013 Advanced Micro Devices, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are --- 228 unchanged lines hidden (view full) --- 237 238 if (event->flags.isSet(Event::AutoDelete) && !event->scheduled()) 239 delete event; 240 241 return NULL; 242} 243 244void | 1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * Copyright (c) 2008 The Hewlett-Packard Development Company 4 * Copyright (c) 2013 Advanced Micro Devices, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are --- 228 unchanged lines hidden (view full) --- 237 238 if (event->flags.isSet(Event::AutoDelete) && !event->scheduled()) 239 delete event; 240 241 return NULL; 242} 243 244void |
245Event::serialize(std::ostream &os) | 245Event::serialize(CheckpointOut &cp) const |
246{ 247 SERIALIZE_SCALAR(_when); 248 SERIALIZE_SCALAR(_priority); 249 short _flags = flags; 250 SERIALIZE_SCALAR(_flags); 251} 252 253void | 246{ 247 SERIALIZE_SCALAR(_when); 248 SERIALIZE_SCALAR(_priority); 249 short _flags = flags; 250 SERIALIZE_SCALAR(_flags); 251} 252 253void |
254Event::unserialize(Checkpoint *cp, const string §ion) | 254Event::unserialize(CheckpointIn &cp) |
255{ 256} 257 258void | 255{ 256} 257 258void |
259Event::unserialize(Checkpoint *cp, const string §ion, EventQueue *eventq) | 259Event::unserializeEvent(CheckpointIn &cp, EventQueue *eventq) |
260{ 261 if (scheduled()) 262 eventq->deschedule(this); 263 264 UNSERIALIZE_SCALAR(_when); 265 UNSERIALIZE_SCALAR(_priority); 266 267 short _flags; --- 17 unchanged lines hidden (view full) --- 285 286 if (wasScheduled) { 287 DPRINTF(Config, "rescheduling at %d\n", _when); 288 eventq->schedule(this, _when); 289 } 290} 291 292void | 260{ 261 if (scheduled()) 262 eventq->deschedule(this); 263 264 UNSERIALIZE_SCALAR(_when); 265 UNSERIALIZE_SCALAR(_priority); 266 267 short _flags; --- 17 unchanged lines hidden (view full) --- 285 286 if (wasScheduled) { 287 DPRINTF(Config, "rescheduling at %d\n", _when); 288 eventq->schedule(this, _when); 289 } 290} 291 292void |
293EventQueue::serialize(ostream &os) | 293EventQueue::serialize(CheckpointOut &cp) const |
294{ 295 std::list<Event *> eventPtrs; 296 297 int numEvents = 0; 298 Event *nextBin = head; 299 while (nextBin) { 300 Event *nextInBin = nextBin; 301 302 while (nextInBin) { 303 if (nextInBin->flags.isSet(Event::AutoSerialize)) { 304 eventPtrs.push_back(nextInBin); | 294{ 295 std::list<Event *> eventPtrs; 296 297 int numEvents = 0; 298 Event *nextBin = head; 299 while (nextBin) { 300 Event *nextInBin = nextBin; 301 302 while (nextInBin) { 303 if (nextInBin->flags.isSet(Event::AutoSerialize)) { 304 eventPtrs.push_back(nextInBin); |
305 paramOut(os, csprintf("event%d", numEvents++), | 305 paramOut(cp, csprintf("event%d", numEvents++), |
306 nextInBin->name()); 307 } 308 nextInBin = nextInBin->nextInBin; 309 } 310 311 nextBin = nextBin->nextBin; 312 } 313 314 SERIALIZE_SCALAR(numEvents); 315 | 306 nextInBin->name()); 307 } 308 nextInBin = nextInBin->nextInBin; 309 } 310 311 nextBin = nextBin->nextBin; 312 } 313 314 SERIALIZE_SCALAR(numEvents); 315 |
316 for (std::list<Event *>::iterator it = eventPtrs.begin(); 317 it != eventPtrs.end(); ++it) { 318 (*it)->nameOut(os); 319 (*it)->serialize(os); 320 } | 316 for (Event *ev : eventPtrs) 317 ev->serializeSection(cp, ev->name()); |
321} 322 323void | 318} 319 320void |
324EventQueue::unserialize(Checkpoint *cp, const std::string §ion) | 321EventQueue::unserialize(CheckpointIn &cp) |
325{ 326 int numEvents; 327 UNSERIALIZE_SCALAR(numEvents); 328 329 std::string eventName; 330 for (int i = 0; i < numEvents; i++) { 331 // get the pointer value associated with the event | 322{ 323 int numEvents; 324 UNSERIALIZE_SCALAR(numEvents); 325 326 std::string eventName; 327 for (int i = 0; i < numEvents; i++) { 328 // get the pointer value associated with the event |
332 paramIn(cp, section, csprintf("event%d", i), eventName); | 329 paramIn(cp, csprintf("event%d", i), eventName); |
333 334 // create the event based on its pointer value 335 Serializable::create(cp, eventName); 336 } 337} 338 339void 340EventQueue::dump() const --- 147 unchanged lines hidden --- | 330 331 // create the event based on its pointer value 332 Serializable::create(cp, eventName); 333 } 334} 335 336void 337EventQueue::dump() const --- 147 unchanged lines hidden --- |