15 Log(const char *filename) {
16 file = fopen(filename, "wt");
17 write("<?xml version='1.0' encoding='UTF-8'?>\n");
18 write("<?xml-stylesheet type='text/xsl' href='d3dtrace.xsl'?>\n");
27 void write(const char *s) {
31 void writef(const char *f, ...) {
34 vfprintf(file, f, ap);
42 void tag(const char *name) {
48 void tag_begin(const char *name) {
53 void tag_attr(const char *name, const char *value) {
65 void tag_close(const char *name) {
71 void call_begin(const char *function) {
74 tag_attr("name", function);
85 void param_begin(const char *type, const char *name) {
88 tag_attr("type", type);
89 tag_attr("name", name);
93 void param_end(void) {
98 void param_uint(const char *name, UINT value) {
99 param_begin("UINT", name);
104 void param_dword(const char *name, DWORD value) {
105 param_begin("DWORD", name);
106 writef("0x%08lx", value);
115 #endif /* LOG_HPP_ */