stattest.cc (2716:b9114064d77a) stattest.cc (5584:e08e65fd0f76)
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;

--- 16 unchanged lines hidden (view full) ---

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 <iomanip>
32#include <iostream>
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;

--- 16 unchanged lines hidden (view full) ---

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 <iomanip>
32#include <iostream>
33#include <fstream>
34#include <string>
33#include <string>
35#include <unistd.h>
36
37#include "base/cprintf.hh"
38#include "base/misc.hh"
39#include "base/statistics.hh"
40#include "base/stats/text.hh"
41#include "base/stats/mysql.hh"
42#include "sim/host.hh"
43
44using namespace std;
45using namespace Stats;
46
34
35#include "base/cprintf.hh"
36#include "base/misc.hh"
37#include "base/statistics.hh"
38#include "base/stats/text.hh"
39#include "base/stats/mysql.hh"
40#include "sim/host.hh"
41
42using namespace std;
43using namespace Stats;
44
47Tick curTick = 0;
48Tick ticksPerSecond = ULL(2000000000);
49
50Scalar<> s1;
51Scalar<> s2;
52Average<> s3;
53Scalar<> s4;
54Vector<> s5;
55Distribution<> s6;
56Vector<> s7;
57AverageVector<> s8;

--- 9 unchanged lines hidden (view full) ---

67Formula f1;
68Formula f2;
69Formula f3;
70Value f4;
71Value f5;
72Formula f6;
73Formula f7;
74
45Scalar<> s1;
46Scalar<> s2;
47Average<> s3;
48Scalar<> s4;
49Vector<> s5;
50Distribution<> s6;
51Vector<> s7;
52AverageVector<> s8;

--- 9 unchanged lines hidden (view full) ---

62Formula f1;
63Formula f2;
64Formula f3;
65Value f4;
66Value f5;
67Formula f6;
68Formula f7;
69
75ostream *outputStream = &cout;
76
77double
78testfunc()
79{
80 return 9.8;
81}
82
83class TestClass {
84 public:
85 double operator()() { return 9.7; }
86};
87
70double
71testfunc()
72{
73 return 9.8;
74}
75
76class TestClass {
77 public:
78 double operator()() { return 9.7; }
79};
80
88char *progname = "";
81const char *progname = "";
89
90void
91usage()
92{
93 panic("incorrect usage.\n"
94 "usage:\n"
95 "\t%s [-t [-c] [-d]]\n", progname);
96}
97
98int
99main(int argc, char *argv[])
100{
101 bool descriptions = false;
102 bool compat = false;
103 bool text = false;
82
83void
84usage()
85{
86 panic("incorrect usage.\n"
87 "usage:\n"
88 "\t%s [-t [-c] [-d]]\n", progname);
89}
90
91int
92main(int argc, char *argv[])
93{
94 bool descriptions = false;
95 bool compat = false;
96 bool text = false;
97
98#if USE_MYSQL
104 string mysql_name;
99 string mysql_name;
100 string mysql_db;
105 string mysql_host;
106 string mysql_user = "binkertn";
107 string mysql_passwd;
101 string mysql_host;
102 string mysql_user = "binkertn";
103 string mysql_passwd;
104#endif
108
109 char c;
110 progname = argv[0];
105
106 char c;
107 progname = argv[0];
111 while ((c = getopt(argc, argv, "cdh:P:p:s:tu:")) != -1) {
108 while ((c = getopt(argc, argv, "cD:dh:P:p:s:tu:")) != -1) {
112 switch (c) {
113 case 'c':
114 compat = true;
115 break;
116 case 'd':
117 descriptions = true;
118 break;
109 switch (c) {
110 case 'c':
111 compat = true;
112 break;
113 case 'd':
114 descriptions = true;
115 break;
116 case 't':
117 text = true;
118 break;
119#if USE_MYSQL
120 case 'D':
121 mysql_db = optarg;
122 break;
119 case 'h':
120 mysql_host = optarg;
121 break;
122 case 'P':
123 mysql_passwd = optarg;
124 break;
125 case 's':
126 mysql_name = optarg;
127 break;
123 case 'h':
124 mysql_host = optarg;
125 break;
126 case 'P':
127 mysql_passwd = optarg;
128 break;
129 case 's':
130 mysql_name = optarg;
131 break;
128 case 't':
129 text = true;
130 break;
131 case 'u':
132 mysql_user = optarg;
133 break;
132 case 'u':
133 mysql_user = optarg;
134 break;
135#endif
134 default:
135 usage();
136 }
137 }
138
139 if (!text && (compat || descriptions))
140 usage();
141

--- 398 unchanged lines hidden (view full) ---

540
541 if (text) {
542 Text out(cout);
543 out.descriptions = descriptions;
544 out.compat = compat;
545 out();
546 }
547
136 default:
137 usage();
138 }
139 }
140
141 if (!text && (compat || descriptions))
142 usage();
143

--- 398 unchanged lines hidden (view full) ---

542
543 if (text) {
544 Text out(cout);
545 out.descriptions = descriptions;
546 out.compat = compat;
547 out();
548 }
549
550#if USE_MYSQL
548 if (!mysql_name.empty()) {
549 MySql out;
551 if (!mysql_name.empty()) {
552 MySql out;
550 out.connect(mysql_host, mysql_user, mysql_passwd, "m5stats",
553 out.connect(mysql_host, mysql_db, mysql_user, mysql_passwd, "test",
551 mysql_name, "test");
552 out();
553 }
554 mysql_name, "test");
555 out();
556 }
557#endif
554
555 return 0;
556}
558
559 return 0;
560}