stattest.cc (10055:6153b582c9b5) | stattest.cc (11988:665cd5f8b52b) |
---|---|
1/* 2 * Copyright (c) 2003-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; --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Nathan Binkert 29 */ 30 | 1/* 2 * Copyright (c) 2003-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; --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Nathan Binkert 29 */ 30 |
31#include "pybind11/pybind11.h" 32 |
|
31#include <iomanip> 32#include <iostream> 33#include <string> 34 35#include "base/cprintf.hh" 36#include "base/misc.hh" 37#include "base/statistics.hh" 38#include "base/types.hh" 39#include "sim/core.hh" | 33#include <iomanip> 34#include <iostream> 35#include <string> 36 37#include "base/cprintf.hh" 38#include "base/misc.hh" 39#include "base/statistics.hh" 40#include "base/types.hh" 41#include "sim/core.hh" |
42#include "sim/init.hh" |
|
40#include "sim/stat_control.hh" 41 | 43#include "sim/stat_control.hh" 44 |
45namespace py = pybind11; 46 |
|
42// override the default main() code for this unittest 43const char *m5MainCommands[] = { 44 "import m5.stattestmain", 45 "m5.stattestmain.main()", 46 0 // sentinel is required 47}; 48 49using namespace std; 50using namespace Stats; 51 52double testfunc(); 53struct StatTest; 54StatTest & __stattest(); | 47// override the default main() code for this unittest 48const char *m5MainCommands[] = { 49 "import m5.stattestmain", 50 "m5.stattestmain.main()", 51 0 // sentinel is required 52}; 53 54using namespace std; 55using namespace Stats; 56 57double testfunc(); 58struct StatTest; 59StatTest & __stattest(); |
55void stattest_init(); 56void stattest_run(); | |
57 58 59double 60testfunc() 61{ 62 return 9.8; 63} 64 --- 53 unchanged lines hidden (view full) --- 118StatTest & 119__stattest() 120{ 121 static StatTest st; 122 return st; 123} 124 125void | 60 61 62double 63testfunc() 64{ 65 return 9.8; 66} 67 --- 53 unchanged lines hidden (view full) --- 121StatTest & 122__stattest() 123{ 124 static StatTest st; 125 return st; 126} 127 128void |
126stattest_init() 127{ 128 __stattest().init(); 129} 130 131void 132stattest_run() 133{ 134 __stattest().run(); 135} 136 137void | |
138StatTest::init() 139{ 140 EventQueue *q = getEventQueue(0); 141 curEventQueue(q); 142 143 cprintf("sizeof(Scalar) = %d\n", sizeof(Scalar)); 144 cprintf("sizeof(Vector) = %d\n", sizeof(Vector)); 145 cprintf("sizeof(Distribution) = %d\n", sizeof(Distribution)); --- 529 unchanged lines hidden (view full) --- 675 } 676 677 s19[0] = 1; 678 s19[1] = 100000; 679 s20[0] = 100000; 680 s20[1] = 1; 681 682} | 129StatTest::init() 130{ 131 EventQueue *q = getEventQueue(0); 132 curEventQueue(q); 133 134 cprintf("sizeof(Scalar) = %d\n", sizeof(Scalar)); 135 cprintf("sizeof(Vector) = %d\n", sizeof(Vector)); 136 cprintf("sizeof(Distribution) = %d\n", sizeof(Distribution)); --- 529 unchanged lines hidden (view full) --- 666 } 667 668 s19[0] = 1; 669 s19[1] = 100000; 670 s20[0] = 100000; 671 s20[1] = 1; 672 673} |
674 675static void 676stattest_init_pybind(py::module &m_internal) 677{ 678 py::module m = m_internal.def_submodule("stattest"); 679 680 m 681 .def("stattest_init", []() { __stattest().init(); }) 682 .def("stattest_run", []() { __stattest().run(); }) 683 ; 684} 685 686static EmbeddedPyBind embed_("stattest", stattest_init_pybind); |
|