]> git.cworth.org Git - apitrace/blobdiff - common/trace_writer_local.cpp
First stab at tracing thread IDs.
[apitrace] / common / trace_writer_local.cpp
index 9d0429b4890c90eb198c8a1e37d4e6703a8f7071..bb06d90f74783f53f9d7bed795811fc7ac9fa251 100644 (file)
@@ -31,7 +31,8 @@
 #include <string.h>
 
 #include "os.hpp"
-#include "os_path.hpp"
+#include "os_thread.hpp"
+#include "os_string.hpp"
 #include "trace_file.hpp"
 #include "trace_writer.hpp"
 #include "trace_format.hpp"
@@ -74,7 +75,7 @@ LocalWriter::~LocalWriter()
 
 void
 LocalWriter::open(void) {
-    os::Path szFileName;
+    os::String szFileName;
 
     const char *lpFileName;
 
@@ -82,22 +83,22 @@ LocalWriter::open(void) {
     if (!lpFileName) {
         static unsigned dwCounter = 0;
 
-        os::Path process = os::getProcessName();
+        os::String process = os::getProcessName();
 #ifdef _WIN32
         process.trimExtension();
 #endif
         process.trimDirectory();
 
-        os::Path prefix = os::getCurrentDir();
+        os::String prefix = os::getCurrentDir();
         prefix.join(process);
 
         for (;;) {
             FILE *file;
 
             if (dwCounter)
-                szFileName = os::Path::format("%s.%u.trace", prefix.str(), dwCounter);
+                szFileName = os::String::format("%s.%u.trace", prefix.str(), dwCounter);
             else
-                szFileName = os::Path::format("%s.trace", prefix.str());
+                szFileName = os::String::format("%s.trace", prefix.str());
 
             lpFileName = szFileName;
             file = fopen(lpFileName, "rb");
@@ -131,7 +132,9 @@ unsigned LocalWriter::beginEnter(const FunctionSig *sig) {
         open();
     }
 
-    return Writer::beginEnter(sig);
+    os::thread::id id = os::this_thread::get_id();
+
+    return Writer::beginEnter(sig, static_cast<unsigned>(id));
 }
 
 void LocalWriter::endEnter(void) {