summaryrefslogtreecommitdiff
path: root/src/gpuwattch/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpuwattch/main.cc')
-rw-r--r--src/gpuwattch/main.cc104
1 files changed, 55 insertions, 49 deletions
diff --git a/src/gpuwattch/main.cc b/src/gpuwattch/main.cc
index 03d3e7c..c370e32 100644
--- a/src/gpuwattch/main.cc
+++ b/src/gpuwattch/main.cc
@@ -28,68 +28,74 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.”
*
***************************************************************************/
+#include "io.h"
#include <iostream>
+#include "xmlParser.h"
#include "XML_Parse.h"
-#include "globalvar.h"
-#include "io.h"
#include "processor.h"
+#include "globalvar.h"
#include "version.h"
-#include "xmlParser.h"
+
using namespace std;
-void print_usage(char *argv0);
+void print_usage(char * argv0);
+
+int main(int argc,char *argv[])
+{
+ char * fb ;
+ bool infile_specified = false;
+ int plevel = 2;
+ opt_for_clk =true;
+ //cout.precision(10);
+ if (argc <= 1 || argv[1] == string("-h") || argv[1] == string("--help"))
+ {
+ print_usage(argv[0]);
+ }
-int main(int argc, char *argv[]) {
- char *fb;
- bool infile_specified = false;
- int plevel = 2;
- opt_for_clk = true;
- // cout.precision(10);
- if (argc <= 1 || argv[1] == string("-h") || argv[1] == string("--help")) {
- print_usage(argv[0]);
- }
+ for (int32_t i = 0; i < argc; i++)
+ {
+ if (argv[i] == string("-infile"))
+ {
+ infile_specified = true;
+ i++;
+ fb = argv[ i];
+ }
- for (int32_t i = 0; i < argc; i++) {
- if (argv[i] == string("-infile")) {
- infile_specified = true;
- i++;
- fb = argv[i];
- }
+ if (argv[i] == string("-print_level"))
+ {
+ i++;
+ plevel = atoi(argv[i]);
+ }
- if (argv[i] == string("-print_level")) {
- i++;
- plevel = atoi(argv[i]);
- }
+ if (argv[i] == string("-opt_for_clk"))
+ {
+ i++;
+ opt_for_clk = (bool)atoi(argv[i]);
+ }
+ }
+ if (infile_specified == false)
+ {
+ print_usage(argv[0]);
+ }
- if (argv[i] == string("-opt_for_clk")) {
- i++;
- opt_for_clk = (bool)atoi(argv[i]);
- }
- }
- if (infile_specified == false) {
- print_usage(argv[0]);
- }
- cout << "McPAT (version " << VER_MAJOR << "." << VER_MINOR << " of "
- << VER_UPDATE << ") is computing the target processor...\n " << endl;
+ cout<<"McPAT (version "<< VER_MAJOR <<"."<< VER_MINOR
+ << " of " << VER_UPDATE << ") is computing the target processor...\n "<<endl;
- // parse XML-based interface
- ParseXML *p1 = new ParseXML();
- p1->parse(fb);
- Processor proc(p1);
- proc.displayEnergy(2, plevel);
- delete p1;
- return 0;
+ //parse XML-based interface
+ ParseXML *p1= new ParseXML();
+ p1->parse(fb);
+ Processor proc(p1);
+ proc.displayEnergy(2, plevel);
+ delete p1;
+ return 0;
}
-void print_usage(char *argv0) {
- cerr << "How to use McPAT:" << endl;
- cerr << " mcpat -infile <input file name> -print_level < level of details "
- "0~5 > -opt_for_clk < 0 (optimize for ED^2P only)/1 (optimzed for "
- "target clock rate)>"
- << endl;
- // cerr << " Note:default print level is at processor level, please
- // increase it to see the details" << endl;
- exit(1);
+void print_usage(char * argv0)
+{
+ cerr << "How to use McPAT:" << endl;
+ cerr << " mcpat -infile <input file name> -print_level < level of details 0~5 > -opt_for_clk < 0 (optimize for ED^2P only)/1 (optimzed for target clock rate)>"<< endl;
+ //cerr << " Note:default print level is at processor level, please increase it to see the details" << endl;
+ exit(1);
}