1/* 2 * Copyright (c) 2000-2005 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; --- 400 unchanged lines hidden (view full) --- 409unserializeAll(const std::string &cpt_dir) 410{ 411 Serializable::unserializeAll(cpt_dir); 412} 413 414/** 415 * Queue of C++ callbacks to invoke on simulator exit. 416 */ |
417CallbackQueue& 418exitCallbacks() 419{ 420 static CallbackQueue theQueue; 421 return theQueue; 422} |
423 424/** 425 * Register an exit callback. 426 */ 427void 428registerExitCallback(Callback *callback) 429{ |
430 exitCallbacks().add(callback); |
431} 432 433BaseCPU * 434convertToBaseCPUPtr(SimObject *obj) 435{ 436 BaseCPU *ptr = dynamic_cast<BaseCPU *>(obj); 437 438 if (ptr == NULL) 439 warn("Casting to BaseCPU pointer failed"); 440 return ptr; 441} 442 443/** 444 * Do C++ simulator exit processing. Exported to SWIG to be invoked 445 * when simulator terminates via Python's atexit mechanism. 446 */ 447void 448doExitCleanup() 449{ |
450 exitCallbacks().process(); 451 exitCallbacks().clear(); |
452 453 cout.flush(); 454 455 ParamContext::cleanupAllContexts(); 456 457 // print simulation stats 458 Stats::DumpNow(); 459} |