35,36d34
< #include "base/stats/mysql.hh"
< #include "base/stats/text.hh"
43a42,48
> // override the default main() code for this unittest
> const char *m5MainCommands[] = {
> "import m5.stattestmain",
> "m5.stattestmain.main()",
> 0 // sentinel is required
> };
>
58,61c63
< const char *progname = "";
<
< void
< usage()
---
> struct StatTest
63,118d64
< panic("incorrect usage.\n"
< "usage:\n"
< "\t%s [-t [-c] [-d]]\n", progname);
< }
<
< int
< main(int argc, char *argv[])
< {
< bool descriptions = false;
< bool text = false;
<
< #if USE_MYSQL
< string mysql_name;
< string mysql_db;
< string mysql_host;
< string mysql_user = "binkertn";
< string mysql_passwd;
< #endif
<
< char c;
< progname = argv[0];
< while ((c = getopt(argc, argv, "cD:dh:P:p:s:tu:")) != -1) {
< switch (c) {
< case 'd':
< descriptions = true;
< break;
< case 't':
< text = true;
< break;
< #if USE_MYSQL
< case 'D':
< mysql_db = optarg;
< break;
< case 'h':
< mysql_host = optarg;
< break;
< case 'P':
< mysql_passwd = optarg;
< break;
< case 's':
< mysql_name = optarg;
< break;
< case 'u':
< mysql_user = optarg;
< break;
< #endif
< default:
< usage();
< }
< }
<
< if (!text && descriptions)
< usage();
<
< initSimStats();
<
155a102,121
> void run();
> void init();
> };
>
> StatTest __stattest;
> void
> stattest_init()
> {
> __stattest.init();
> }
>
> void
> stattest_run()
> {
> __stattest.run();
> }
>
> void
> StatTest::init()
> {
388a355
> }
390,392c357,359
< enable();
< reset();
<
---
> void
> StatTest::run()
> {
659,677d625
<
< prepare();
<
< if (text) {
< Text out(cout);
< out.descriptions = descriptions;
< out();
< }
<
< #if USE_MYSQL
< if (!mysql_name.empty()) {
< MySql out;
< out.connect(mysql_host, mysql_db, mysql_user, mysql_passwd, "test",
< mysql_name, "test");
< out();
< }
< #endif
<
< return 0;