]> git.cworth.org Git - apitrace/commitdiff
Move local writer definitions to a separate header file.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 27 Dec 2011 19:02:57 +0000 (19:02 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 27 Dec 2011 20:10:05 +0000 (20:10 +0000)
cgltrace.py
common/trace_writer.hpp
common/trace_writer_local.cpp
common/trace_writer_local.hpp [new file with mode: 0644]
d3d10trace.py
d3d8trace.py
d3d9trace.py
ddrawtrace.py
egltrace.py
glxtrace.py
wgltrace.py

index 21007237d9e8e725152550e5ffd4a9d8da99c7b7..e2e98745fe4808b2fa309d6a447bb27d973c76f1 100644 (file)
@@ -45,7 +45,7 @@ if __name__ == '__main__':
     print '#include <stdlib.h>'
     print '#include <string.h>'
     print
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print
     print '// To validate our prototypes'
     print '#define GL_GLEXT_PROTOTYPES'
index f7105880d0d63c31cf0d82dda214d15f7e1bd8bd..e012a9b24a0cf25787f7b95182066ad96ef0cc56 100644 (file)
@@ -105,46 +105,6 @@ namespace trace {
 
     };
 
-    extern const FunctionSig memcpy_sig;
-    extern const FunctionSig malloc_sig;
-    extern const FunctionSig free_sig;
-    extern const FunctionSig realloc_sig;
-
-    /**
-     * A specialized Writer class, mean to trace the current process.
-     *
-     * In particular:
-     * - it creates a trace file based on the current process name
-     * - uses mutexes to allow tracing from multiple threades
-     * - flushes the output to ensure the last call is traced in event of
-     *   abnormal termination
-     */
-    class LocalWriter : public Writer {
-    protected:
-        int acquired;
-
-    public:
-        /**
-         * Should never called directly -- use localWriter singleton below instead.
-         */
-        LocalWriter();
-        ~LocalWriter();
-
-        void open(void);
-
-        unsigned beginEnter(const FunctionSig *sig);
-        void endEnter(void);
-
-        void beginLeave(unsigned call);
-        void endLeave(void);
-
-        void flush(void);
-    };
-
-    /**
-     * Singleton.
-     */
-    extern LocalWriter localWriter;
-}
+} /* namespace trace */
 
 #endif /* _TRACE_WRITER_HPP_ */
index e72d5c085a1454f279ff03fcb32e0428171ec2fd..52962c8b50e256adbc2841b9ad2af6c440834132 100644 (file)
@@ -34,7 +34,7 @@
 #include "os_thread.hpp"
 #include "os_string.hpp"
 #include "trace_file.hpp"
-#include "trace_writer.hpp"
+#include "trace_writer_local.hpp"
 #include "trace_format.hpp"
 
 
diff --git a/common/trace_writer_local.hpp b/common/trace_writer_local.hpp
new file mode 100644 (file)
index 0000000..7c70580
--- /dev/null
@@ -0,0 +1,82 @@
+/**************************************************************************
+ *
+ * Copyright 2007-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * Trace writing functions.
+ */
+
+#ifndef _TRACE_WRITER_LOCAL_HPP_
+#define _TRACE_WRITER_LOCAL_HPP_
+
+
+#include "trace_writer.hpp"
+
+
+namespace trace {
+
+    extern const FunctionSig memcpy_sig;
+    extern const FunctionSig malloc_sig;
+    extern const FunctionSig free_sig;
+    extern const FunctionSig realloc_sig;
+
+    /**
+     * A specialized Writer class, mean to trace the current process.
+     *
+     * In particular:
+     * - it creates a trace file based on the current process name
+     * - uses mutexes to allow tracing from multiple threades
+     * - flushes the output to ensure the last call is traced in event of
+     *   abnormal termination
+     */
+    class LocalWriter : public Writer {
+    protected:
+        int acquired;
+
+    public:
+        /**
+         * Should never called directly -- use localWriter singleton below instead.
+         */
+        LocalWriter();
+        ~LocalWriter();
+
+        void open(void);
+
+        unsigned beginEnter(const FunctionSig *sig);
+        void endEnter(void);
+
+        void beginLeave(unsigned call);
+        void endLeave(void);
+
+        void flush(void);
+    };
+
+    /**
+     * Singleton.
+     */
+    extern LocalWriter localWriter;
+
+} /* namespace trace */
+
+#endif /* _TRACE_WRITER_LOCAL_HPP_ */
index edcf38a8df6ab4c19e2ca635378e2c3755878e6e..b94527c5ca99e70adce070d5b1abd5329fc50b28 100644 (file)
@@ -29,7 +29,7 @@ from trace import DllTracer
 
 
 if __name__ == '__main__':
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print '#include "os.hpp"'
     print
     print '#include <windows.h>'
index 65e13edb09447886c43f66d220545a28c51bd62f..d3754e5eb1ff3988b1b7af57266bc4750909b1c5 100644 (file)
@@ -44,7 +44,7 @@ if __name__ == '__main__':
     print '#include <d3d8.h>'
     print '#include "d3dshader.hpp"'
     print
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print '#include "os.hpp"'
     print
     tracer = D3D8Tracer('d3d8.dll')
index e6bf0001b6b70db15784135f5d33301fe3fb54cd..27fbc354a088383608f35ec8f3385f7658fe0cce 100644 (file)
@@ -40,7 +40,7 @@ class D3D9Tracer(DllTracer):
 
 
 if __name__ == '__main__':
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print '#include "os.hpp"'
     print
     print '#include "d3d9imports.hpp"'
index fb8f2a583927f8a4f654735daaf04e959d7605ff..7022e1304cfc764aae1f594c6b9dabccab793696 100644 (file)
@@ -74,7 +74,7 @@ if __name__ == '__main__':
 #endif
 
 '''
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print '#include "os.hpp"'
     print
     tracer = DDrawTracer('ddraw.dll')
index de90799bf1ccc35056d94f50886e04efec3cc986..8fa313a2117b37a5d4c4298b62fbffa90f6a7b59 100644 (file)
@@ -76,7 +76,7 @@ if __name__ == '__main__':
     print '#include <string.h>'
     print '#include <dlfcn.h>'
     print
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print
     print '// To validate our prototypes'
     print '#define GL_GLEXT_PROTOTYPES'
index c9e9518f00df5d00ee387ad686d4f994d1392c87..9adcaaf98a50f8b89b5ff39650b5018e92662b4f 100644 (file)
@@ -58,7 +58,7 @@ if __name__ == '__main__':
     print '#endif'
     print '#include <dlfcn.h>'
     print
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print
     print '// To validate our prototypes'
     print '#define GL_GLEXT_PROTOTYPES'
index d5a5248f9e1a018738a5da22ea898ae03147c6f9..9dab406360918a11aaaadccc988c78b576b57463 100644 (file)
@@ -66,7 +66,7 @@ if __name__ == '__main__':
     print '#include <string.h>'
     print '#include <windows.h>'
     print
-    print '#include "trace_writer.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print '#include "os.hpp"'
     print
     print '// To validate our prototypes'