00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "yapi.h"
00012 #include "scaling.h"
00013 #include "parse_options.h"
00014
00015 #ifdef GCC_2
00016 #include <fstream.h>
00017 #else
00018 #include <fstream>
00019 using namespace std;
00020 #endif
00021
00022 int main(int argc, char* argv[])
00023 {
00024 static struct
00025 {
00026 char* path;
00027 char* fefile;
00028 char* scfile;
00029 char* befile;
00030 } cmdl;
00031 char fefile[256];
00032 char scfile[256];
00033 char befile[256];
00034
00035 option_t options[] =
00036 {
00037 { "-path", "str", "srcdir", &cmdl.path, "Environment variable containing path to files"},
00038 { "-fe-file", "str", "scaling.fe.ini", &cmdl.fefile, "Ini file for frontend"},
00039 { "-sc-file", "str", "scaling.sc.ini", &cmdl.scfile, "Ini file for scaler"},
00040 { "-be-file", "str", "scaling.be.ini", &cmdl.befile, "Ini file for backend"},
00041 { NULL, NULL, NULL, NULL, NULL}
00042 };
00043
00044 if (parse_options("scaling", argc, argv, options))
00045 {
00046 #ifdef VERBOSE
00047 fprintf(stderr, "(use \"-help\" for help)\n");
00048 #endif
00049 exit(1);
00050 }
00051 #ifdef VERBOSE
00052 print_option_values("scaling", options);
00053 #endif
00054
00055 if (getenv(cmdl.path))
00056 {
00057 strcpy(fefile, getenv(cmdl.path));
00058 strcat(fefile, "/");
00059 strcat(fefile, cmdl.fefile);
00060
00061 strcpy(scfile, getenv(cmdl.path));
00062 strcat(scfile, "/");
00063 strcat(scfile, cmdl.scfile);
00064
00065 strcpy(befile, getenv(cmdl.path));
00066 strcat(befile, "/");
00067 strcat(befile, cmdl.befile);
00068 }
00069 else
00070 {
00071 strcpy(fefile, cmdl.fefile);
00072 strcpy(scfile, cmdl.scfile);
00073 strcpy(befile, cmdl.befile);
00074 }
00075
00076
00077 RTE rte;
00078
00079
00080 ofstream f("./Results/scaling.out");
00081 rte.setOutStream(f);
00082
00083
00084 ofstream g("./Results/scaling.err");
00085 rte.setErrorStream(g);
00086
00087 Scaling *scaling = new Scaling(
00088 id("scaling"),
00089 fefile,
00090 scfile,
00091 befile
00092 );
00093
00094
00095
00096 rte.start(*scaling);
00097
00098
00099 ofstream h("./Results/scaling.workload");
00100 printWorkload(*scaling, h);
00101
00102
00103 ofstream i("./Results/scaling.dot");
00104 printDotty(*scaling, i);
00105
00106 f.close();
00107 g.close();
00108 h.close();
00109 i.close();
00110
00111 delete scaling;
00112
00113 return 0;
00114 }