mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Re-open debug.log every ten minutes instead of every printf; fixes performance problem with Mac FileVault.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@181 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
parent
222e3de4be
commit
026c5f7617
19
util.cpp
19
util.cpp
@ -157,10 +157,19 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// print to debug.log
|
// print to debug.log
|
||||||
char pszFile[MAX_PATH+100];
|
static FILE* fileout = NULL;
|
||||||
GetDataDir(pszFile);
|
static int64 nOpenTime = 0;
|
||||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
|
||||||
FILE* fileout = fopen(pszFile, "a");
|
if (GetTime()-nOpenTime > 10 * 60)
|
||||||
|
{
|
||||||
|
if (fileout)
|
||||||
|
fclose(fileout);
|
||||||
|
char pszFile[MAX_PATH+100];
|
||||||
|
GetDataDir(pszFile);
|
||||||
|
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||||
|
fileout = fopen(pszFile, "a");
|
||||||
|
nOpenTime = GetTime();
|
||||||
|
}
|
||||||
if (fileout)
|
if (fileout)
|
||||||
{
|
{
|
||||||
//// Debug print useful for profiling
|
//// Debug print useful for profiling
|
||||||
@ -169,7 +178,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
|||||||
va_start(arg_ptr, pszFormat);
|
va_start(arg_ptr, pszFormat);
|
||||||
ret = vfprintf(fileout, pszFormat, arg_ptr);
|
ret = vfprintf(fileout, pszFormat, arg_ptr);
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
fclose(fileout);
|
fflush(fileout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user