*** empty log message ***

svn path=/trunk/boinc/; revision=10338
This commit is contained in:
Rom Walton 2006-06-14 07:44:51 +00:00
parent ab4df7f5bd
commit 3f1b440837
4 changed files with 105 additions and 131 deletions

View File

@ -5926,7 +5926,11 @@ Rom 14 June 2006
(From Frank S. Thomas)
- Reduce duplicate code in diagnostics.C.
- Change screensaver logging mechinisms.
- Display the detected CPU capabilities for those who want to
manually use an optimized application via app_info.xml
client/
client_state.C
client/win/
win_screensaver.cpp
clientgui/
@ -5945,3 +5949,14 @@ Charlie 14 June 2006
BOINCGUIApp.cpp
mac/
SetupSecurity.cpp,h
Rom 14 June 2006
- Reduce duplicate code in diagnostics.C.
- Display the detected CPU capabilities for those who want to
manually use an optimized application via app_info.xml
client/
client_state.C
lib/
diagnostics.C, .h

View File

@ -115,8 +115,16 @@ CLIENT_STATE::CLIENT_STATE() {
void CLIENT_STATE::show_host_info() {
char buf[256], buf2[256];
msg_printf(NULL, MSG_INFO,
"Processor: %d %s %s",
host_info.p_ncpus, host_info.p_vendor, host_info.p_model
"Processor: %s %s",
host_info.p_vendor, host_info.p_model
);
msg_printf(NULL, MSG_INFO,
"Processor count: %d",
host_info.p_ncpus
);
msg_printf(NULL, MSG_INFO,
"Processor capabilities: %s",
host_info.p_capabilities
);
nbytes_to_string(host_info.m_nbytes, 0, buf, sizeof(buf));

View File

@ -58,7 +58,6 @@
#ifdef _WIN32
int __cdecl boinc_message_reporting(int reportType, char *szMsg, int *retVal);
static _CrtMemState start_snapshot;
static _CrtMemState finish_snapshot;
@ -82,6 +81,42 @@ static char symstore[256];
static int aborted_via_gui;
#if defined(_WIN32) && defined(_DEBUG)
// Trap ASSERTs and TRACEs from the CRT and spew them to stderr.
//
int __cdecl boinc_message_reporting(int reportType, char *szMsg, int *retVal){
(*retVal) = 0;
switch(reportType){
case _CRT_WARN:
case _CRT_ERROR:
if (flags & BOINC_DIAG_TRACETOSTDERR) {
fprintf(stderr, szMsg);
}
if (flags & BOINC_DIAG_TRACETOSTDOUT) {
fprintf(stdout, szMsg);
}
break;
case _CRT_ASSERT:
fprintf(stderr, "ASSERT: %s\n", szMsg);
(*retVal) = 1;
break;
}
return(TRUE);
}
#endif // _WIN32 && _DEBUG
// stub function for initializing the diagnostics environment.
//
int boinc_init_diagnostics(int _flags) {
@ -444,132 +479,6 @@ int diagnostics_cycle_logs() {
}
#ifdef _WIN32
#ifdef _DEBUG
// Trap ASSERTs and TRACEs from the CRT and spew them to stderr.
//
int __cdecl boinc_message_reporting(int reportType, char *szMsg, int *retVal){
(*retVal) = 0;
switch(reportType){
case _CRT_WARN:
case _CRT_ERROR:
if (flags & BOINC_DIAG_TRACETOSTDERR) {
fprintf(stderr, szMsg);
fflush(stderr);
}
if (flags & BOINC_DIAG_TRACETOSTDOUT) {
fprintf(stdout, szMsg);
fflush(stdout);
}
break;
case _CRT_ASSERT:
fprintf(stderr, "ASSERT: %s\n", szMsg);
fflush(stderr);
(*retVal) = 1;
break;
}
return(TRUE);
}
// Converts the BOINCTRACE macro into a single string and report it
// to the CRT so it can be reported via the normal means.
//
void boinc_trace(const char *pszFormat, ...) {
static char szBuffer[4096];
static char szDate[64];
static char szTime[64];
// Trace messages should only be reported if running as a standalone
// application or told too.
if ((flags & BOINC_DIAG_TRACETOSTDERR) ||
(flags & BOINC_DIAG_TRACETOSTDOUT)) {
memset(szBuffer, 0, sizeof(szBuffer));
memset(szDate, 0, sizeof(szDate));
memset(szTime, 0, sizeof(szTime));
strdate(szDate);
strtime(szTime);
va_list ptr;
va_start(ptr, pszFormat);
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
va_end(ptr);
_CrtDbgReport(_CRT_WARN, NULL, NULL, NULL, "[%s %s] TRACE [%d]: %s", szDate, szTime, GetCurrentThreadId(), szBuffer);
}
}
#endif // _DEBUG
#else // _WIN32
#ifdef _DEBUG
// Converts the BOINCTRACE macro into a single string and report it
// to the CRT so it can be reported via the normal means.
//
void boinc_trace(const char *pszFormat, ...) {
static char szBuffer[4096];
static char szDate[64];
static char szTime[64];
// Trace messages should only be reported if running as a standalone
// application or told too.
if ((flags & BOINC_DIAG_TRACETOSTDERR) ||
(flags & BOINC_DIAG_TRACETOSTDOUT)) {
memset(szBuffer, 0, sizeof(szBuffer));
memset(szDate, 0, sizeof(szDate));
memset(szTime, 0, sizeof(szTime));
strdate(szDate);
strtime(szTime);
va_list ptr;
va_start(ptr, pszFormat);
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
va_end(ptr);
if (flags & BOINC_DIAG_TRACETOSTDERR) {
fprintf(stderr, "[%s %s] TRACE: %s", szDate, szTime, szBuffer);
fflush(stderr);
}
if (flags & BOINC_DIAG_TRACETOSTDOUT) {
fprintf(stdout, "[%s %s] TRACE: %s", szDate, szTime, szBuffer);
fflush(stdout);
}
}
}
#endif // _DEBUG
#endif // _WIN32
// Diagnostics for POSIX Compatible systems.
//
@ -652,6 +561,48 @@ void boinc_catch_signal(int signal) {
// Diagnostics Routines common to all Platforms
//
// Converts the BOINCTRACE macro into a single string and report it
// to the CRT so it can be reported via the normal means.
//
void boinc_trace(const char *pszFormat, ...) {
static char szBuffer[4096];
static char szDate[64];
static char szTime[64];
// Trace messages should only be reported if running as a standalone
// application or told too.
if ((flags & BOINC_DIAG_TRACETOSTDERR) ||
(flags & BOINC_DIAG_TRACETOSTDOUT)) {
memset(szBuffer, 0, sizeof(szBuffer));
memset(szDate, 0, sizeof(szDate));
memset(szTime, 0, sizeof(szTime));
strdate(szDate);
strtime(szTime);
va_list ptr;
va_start(ptr, pszFormat);
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
va_end(ptr);
#if defined(_WIN32) && defined(_DEBUG)
_CrtDbgReport(_CRT_WARN, NULL, NULL, NULL, "[%s %s] TRACE [%d]: %s", szDate, szTime, GetCurrentThreadId(), szBuffer);
#else
if (flags & BOINC_DIAG_TRACETOSTDERR) {
fprintf(stderr, "[%s %s] TRACE [%d]: %s\n", szDate, szTime, GetCurrentThreadId(), szBuffer);
}
if (flags & BOINC_DIAG_TRACETOSTDOUT) {
fprintf(stdout, "[%s %s] TRACE [%d]: %s\n", szDate, szTime, GetCurrentThreadId(), szBuffer);
}
#endif
}
}
// Converts the BOINCINFO macro into a single string and report it
// to stderr so it can be reported via the normal means.
//

View File

@ -163,10 +163,10 @@ extern void boinc_info(const char *pszFormat, ...);
#if defined(__MINGW32__) || defined(__CYGWIN32__)
#define BOINCASSERT(expr)
#define BOINCTRACE(...)
#define BOINCTRACE(...) boinc_trace
#else // __MINGW32__
#define BOINCASSERT(expr) __noop
#define BOINCTRACE __noop
#define BOINCTRACE boinc_trace
#endif // __MINGW32__
#endif // _DEBUG