File: htmlPerformanceLog.cc

package info (click to toggle)
libosl 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 273,976 kB
  • sloc: cpp: 129,625; ansic: 7,145; ruby: 1,290; makefile: 558; perl: 413; sh: 35
file content (49 lines) | stat: -rw-r--r-- 1,395 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* htmlPerformanceLog.cc
 */
#include "osl/misc/log/htmlPerformanceLog.h"
#include "osl/record/csa.h"

osl::misc::log::HtmlPerformanceLog::
HtmlPerformanceLog(const char *filename, const char *title)
  : os(filename)
{
  os << "<html><head><title>" << title << "</title></head>\n<body>\n";
  os << "<table border=1>\n";
  os << "<tr><td></td><td>search result</td><td>correct move</td>"
     << "<td>#nodes</td><td>seconds</td><td>depth</td></tr>\n";
}

osl::misc::log::HtmlPerformanceLog::~HtmlPerformanceLog()
{
  os << "</table>\n";
  os << "</body>\n";
}

void osl::misc::log::HtmlPerformanceLog::
record(const char *name, Move correctMove, Move result, 
       unsigned int nodes, unsigned int qnodes, double seconds, int depth)
{
  if (correctMove == result)
    os << "<tr bgcolor=\"green\">";
  else
    os << "<tr>";
  os << "<td>" << name << "</td><td>";
  if (correctMove == result)
    os << "OK";
  else
  {
    csaShow(os, result);
  }
  os << "</td><td>";
  csaShow(os, correctMove);
  os << "</td>\n\t<td id=\"nodes\" align=right>" << nodes + qnodes << "</td>\n"
     << "\t<td id=\"seconds\" align=right>" << seconds << "</td>\n"
     << "\t<td id=\"depth\" align=right>" << depth << "</td></tr>\n"
     << std::flush;
}

/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: