#include "common/os.h"
#include "${event_header}"
#include <fstream>
+#include <sstream>
namespace ArchRast
{
EventHandlerFile(uint32_t id)
{
#if defined(_WIN32)
+ DWORD pid = GetCurrentProcessId();
+ TCHAR procname[MAX_PATH];
+ GetModuleFileName(NULL, procname, MAX_PATH);
+ const char* pBaseName = strrchr(procname, '\\');
+ std::stringstream outDir;
+ outDir << KNOB_DEBUG_OUTPUT_DIR << pBaseName << "_" << pid << std::ends;
+ CreateDirectory(outDir.str().c_str(), NULL);
+
char buf[255];
// There could be multiple threads creating thread pools. We
// want to make sure they are uniquly identified by adding in
// the creator's thread id into the filename.
- sprintf(buf, "\\ar_event%d_%d.bin", GetCurrentThreadId(), id);
+ sprintf(buf, "%s\\ar_event%d_%d.bin", outDir.str().c_str(), GetCurrentThreadId(), id);
mFilename = std::string(buf);
#else
SWR_ASSERT(0);