main.cc (3102:225b76c8ac68) | main.cc (3132:a7dbdfa5958f) |
---|---|
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 */ | 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 exitCallbacks; | 417CallbackQueue& 418exitCallbacks() 419{ 420 static CallbackQueue theQueue; 421 return theQueue; 422} |
418 419/** 420 * Register an exit callback. 421 */ 422void 423registerExitCallback(Callback *callback) 424{ | 423 424/** 425 * Register an exit callback. 426 */ 427void 428registerExitCallback(Callback *callback) 429{ |
425 exitCallbacks.add(callback); | 430 exitCallbacks().add(callback); |
426} 427 428BaseCPU * 429convertToBaseCPUPtr(SimObject *obj) 430{ 431 BaseCPU *ptr = dynamic_cast<BaseCPU *>(obj); 432 433 if (ptr == NULL) 434 warn("Casting to BaseCPU pointer failed"); 435 return ptr; 436} 437 438/** 439 * Do C++ simulator exit processing. Exported to SWIG to be invoked 440 * when simulator terminates via Python's atexit mechanism. 441 */ 442void 443doExitCleanup() 444{ | 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{ |
445 exitCallbacks.process(); 446 exitCallbacks.clear(); | 450 exitCallbacks().process(); 451 exitCallbacks().clear(); |
447 448 cout.flush(); 449 450 ParamContext::cleanupAllContexts(); 451 452 // print simulation stats 453 Stats::DumpNow(); 454} | 452 453 cout.flush(); 454 455 ParamContext::cleanupAllContexts(); 456 457 // print simulation stats 458 Stats::DumpNow(); 459} |