static unsigned dwCounter = 0;
+ char szProcessPath[PATH_MAX];
+ char *lpProcessName;
+ char *lpProcessExt;
+
+ GetModuleFileNameA(NULL, szProcessPath, sizeof(szProcessPath)/sizeof(szProcessPath[0]));
+
+ lpProcessName = strrchr(szProcessPath, '\\');
+ lpProcessName = lpProcessName ? lpProcessName + 1 : szProcessPath;
+ lpProcessExt = strrchr(lpProcessName, '.');
+ if(lpProcessExt)
+ *lpProcessExt = '\0';
+
for(;;) {
FILE *file;
if(dwCounter)
- snprintf(g_szFileName, PATH_MAX, "%s.%u.%s.gz", szName, dwCounter, szExtension);
+ snprintf(g_szFileName, PATH_MAX, "%s.%s.%u.%s.gz", lpProcessName, szName, dwCounter, szExtension);
else
- snprintf(g_szFileName, PATH_MAX, "%s.%s.gz", szName, szExtension);
+ snprintf(g_szFileName, PATH_MAX, "%s.%s.%s.gz", lpProcessName, szName, szExtension);
file = fopen(g_szFileName, "rb");
if(file == NULL)
Text(szBuffer);
}
+static LARGE_INTEGER frequency = {0};
+static LARGE_INTEGER startcounter;
+
void BeginCall(const char *function) {
EnterCriticalSection(&CriticalSection);
Indent(1);
BeginTag("call", "name", function);
NewLine();
+
+ if(!frequency.QuadPart)
+ QueryPerformanceFrequency(&frequency);
+
+ QueryPerformanceCounter(&startcounter);
}
void EndCall(void) {
+ LARGE_INTEGER endcounter;
+ LONGLONG usecs;
+
+ QueryPerformanceCounter(&endcounter);
+ usecs = (endcounter.QuadPart - startcounter.QuadPart)*1000000/frequency.QuadPart;
+
+ Indent(2);
+ BeginTag("duration");
+ TextF("%llu", usecs);
+ EndTag("duration");
+ NewLine();
+
Indent(1);
EndTag("call");
NewLine();
else if(c == '\r')
Text("\\r");
else if(c == '\n')
- Text("\\n");
+ Text(" ");
else {
unsigned char octal0 = c & 0x7;
unsigned char octal1 = (c >> 3) & 0x7;
else if(c == '\r')
Text("\\r");
else if(c == '\n')
- Text("\\n");
+ Text(" ");
else {
unsigned octal0 = c & 0x7;
unsigned octal1 = (c >> 3) & 0x7;