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