diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h index 2e8d282878e012516a9f20bb76698428ef8d6d7b..406a1cd0113026ab1934e8c01b7d7f00327b1102 100644 --- a/simulators/c++2/src_simulator/definitions.h +++ b/simulators/c++2/src_simulator/definitions.h @@ -225,6 +225,71 @@ using std::max; #define TAG_ENERGYo "<energy>" #define TAG_ENERGYc "</energy>" +// Issue #4 HTML Trace Constants +#define SCHED_CSS_FILE_NAME "schedstyle.css" +#define SCHED_HTML_DOC "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +#define SCHED_HTML_BEG_HTML "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n" +#define SCHED_HTML_END_HTML "</html>\n" +#define SCHED_HTML_BEG_HEAD "<head>\n" +#define SCHED_HTML_END_HEAD "</head>\n" +#define SCHED_HTML_META "<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n" +#define SCHED_HTML_BEG_TITLE "<title>" +#define SCHED_HTML_END_TITLE "</title>\n" +#define SCHED_HTML_BEG_BODY "<body>\n" +#define SCHED_HTML_END_BODY "</body>\n" +#define SCHED_HTML_BEG_STYLE "<style>\n" +#define SCHED_HTML_END_STYLE "</style>\n" +#define SCHED_HTML_CSS_LINK "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + +#define SCHED_HTML_CSS_CONTENT "table{ \ + border-collapse: collapse; \ + empty-cells: show; \ + margin: 0.4cm; \ +} \ +td{ \ + padding: 10px 5px; \ + border: 1px solid black; \ +} \ +th{ \ + padding: 5px; \ + border-left: 1px dotted black; \ + border-right: 1px dotted black; \ +} \ +.sc{ \ + border-style: none; \ + padding: 0px; \ +} \ +h2 { \ + border-bottom: 1px solid #666; \ +} \ +h2 span { \ + position: relative; \ + left: -0.3em; \ + bottom: -0.6em; \ + padding: 1px 0.5em; \ + border-style: solid; \ + border-width: 1px 1px 1px 0.8em; \ + border-color: #666 #666 #666 #008; \ + background-color: #ddd; \ +} \ +.space{border-style: none;} \ +.not{background-color: white;} \ +.t1{background-color: yellow;} \ +.t2{background-color: purple;} \ +.t3{background-color: red;} \ +.t4{background-color: silver;} \ +.t5{background-color: teal;} \ +.t6{background-color: aqua;} \ +.t7{background-color: olive;} \ +.t8{background-color: navy;} \ +.t9{background-color: maroon;} \ +.t10{background-color: lime;} \ +.t11{background-color: green;} \ +.t12{background-color: gray;} \ +.t13{background-color: fuchsia;} \ +.t14{background-color: blue;} \ +.t15{background-color: black;} \ +.t16{background-color: white;}" class TMLTask; class TMLTransaction; diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp index 3f510478132a95a1e479ae2a18577d23255178b6..0ee4dcb4d38a63b517946e5677737d371831d3ee 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.cpp +++ b/simulators/c++2/src_simulator/sim/Simulator.cpp @@ -282,14 +282,26 @@ void Simulator::latencies2XML(std::ostringstream& glob, int id1, int id2) { } } - void Simulator::schedule2HTML(std::string& iTraceFileName) const{ struct timeval aBegin,aEnd; gettimeofday(&aBegin,NULL); std::ofstream myfile (iTraceFileName.c_str()); - if (myfile.is_open()){ - myfile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; - myfile << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"schedstyle.css\" />\n<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n<title>Scheduling</title>\n</head>\n<body>\n"; + + if (myfile.is_open()) { + // DB: Issue #4 + myfile << SCHED_HTML_DOC; // <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n + myfile << SCHED_HTML_BEG_HTML; // <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n + myfile << SCHED_HTML_BEG_HEAD; // <head>\n + myfile << SCHED_HTML_BEG_STYLE; // <style>\n"; + myfile << SCHED_HTML_CSS_CONTENT; + myfile << SCHED_HTML_END_STYLE; // <style>\n"; + myfile << SCHED_HTML_META; // <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n + myfile << SCHED_HTML_BEG_TITLE; // <title> + myfile << "Scheduling"; + myfile << SCHED_HTML_END_TITLE; // </title>\n + myfile << SCHED_HTML_END_HEAD; // </head>\n + myfile << SCHED_HTML_BEG_BODY; // <body>\n + //for(CPUList::const_iterator i=_simComp->getCPUIterator(false); i != _simComp->getCPUIterator(true); ++i){ for(CPUList::const_iterator i=_simComp->getCPUList().begin(); i != _simComp->getCPUList().end(); ++i){ (*i)->schedule2HTML(myfile); @@ -299,11 +311,16 @@ void Simulator::schedule2HTML(std::string& iTraceFileName) const{ (*j)->schedule2HTML(myfile); } //for_each(iCPUlist.begin(), iCPUlist.end(),std::bind2nd(std::mem_fun(&CPU::schedule2HTML),myfile)); - myfile << "</body>\n</html>\n"; + + myfile << SCHED_HTML_END_BODY; // </body>\n + myfile << SCHED_HTML_END_HTML; // </html>\n + myfile.close(); } - else + else { std::cout << "Unable to open HTML output file." << std::endl; + } + gettimeofday(&aEnd,NULL); std::cout << "The HTML output took " << getTimeDiff(aBegin,aEnd) << "usec. File: " << iTraceFileName << std::endl; }