Changeset 1991 for trunk/packages
- Timestamp:
- Dec 8, 2010, 6:06:20 PM (14 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/PerfQuery.h
r1984 r1991 32 32 &bitsSupported); 33 33 if(bitsSupported == 0) { 34 TRACE("occlusion query not supported!\n");34 INFO("occlusion query not supported!\n"); 35 35 return false; 36 36 } else { 37 TRACE("Occlusion query with %d bits supported\n", bitsSupported);37 INFO("Occlusion query with %d bits supported\n", bitsSupported); 38 38 return true; 39 39 } -
trunk/packages/vizservers/nanovis/Trace.cpp
r1984 r1991 1 1 2 #include "nanovis.h" 2 3 #include <Trace.h> … … 6 7 #include <GL/glew.h> 7 8 #include <GL/glut.h> 8 9 static bool trace = false; 9 #include <syslog.h> 10 10 11 11 void 12 PrintMessage(const char *mesg, const char *fileName, int lineNum, 13 const char* format, ...) 12 LogMessage(int priority, const char *path, int lineNum, const char* fmt, ...) 14 13 { 15 char buff[1024]; 14 #define MSG_LEN (2047) 15 char message[MSG_LEN+1]; 16 const char *s; 17 int length; 16 18 va_list lst; 17 FILE *f;18 19 19 f = NanoVis::logfile; 20 if (f == NULL) { 21 f = stderr; 20 va_start(lst, fmt); 21 s = strrchr(path, '/'); 22 if (s == NULL) { 23 s = path; 24 } else { 25 s++; 22 26 } 23 va_start(lst, format); 24 vsnprintf(buff, 1023, format, lst); 25 buff[1023] = '\0'; 26 fprintf(f, "%s at line %d of \"%s\": %s\n", mesg, lineNum, fileName, buff); 27 fflush(f); 27 length = snprintf(message, MSG_LEN, "line %d of \"%s\": ", lineNum, s); 28 length += vsnprintf(message + length, MSG_LEN - length, fmt, lst); 29 message[MSG_LEN] = '\0'; 30 syslog(priority, message, length); 28 31 } 29 32 -
trunk/packages/vizservers/nanovis/Trace.h
r1984 r1991 4 4 #include <GL/glew.h> 5 5 #include <GL/glut.h> 6 #include <syslog.h> 6 7 7 8 #define MAKE_STRING(x) #x … … 9 10 #define AT __FILE__ ":" NEWSTRING(__LINE__) 10 11 11 extern void PrintMessage(const char *mesg, const char *fileName, int lineNum,12 extern void LogMessage(int priority, const char *fileName, int lineNum, 12 13 const char* format, ...); 13 14 14 #define ERROR(...) PrintMessage("Error", __FILE__, __LINE__, __VA_ARGS__)15 #define ERROR(...) LogMessage(LOG_ERR, __FILE__, __LINE__, __VA_ARGS__) 15 16 #ifdef WANT_TRACE 16 #define TRACE(...) PrintMessage("Trace", __FILE__, __LINE__, __VA_ARGS__)17 #define TRACE(...) LogMessage(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__) 17 18 #else 18 19 #define TRACE(...) 19 20 #endif 20 #define WARN(...) PrintMessage("Warning", __FILE__, __LINE__, __VA_ARGS__)21 #define INFO(...) PrintMessage("Info", __FILE__, __LINE__, __VA_ARGS__)21 #define WARN(...) LogMessage(LOG_WARNING, __FILE__, __LINE__, __VA_ARGS__) 22 #define INFO(...) LogMessage(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__) 22 23 23 24 -
trunk/packages/vizservers/nanovis/global.h
r1984 r1991 106 106 system_info() 107 107 { 108 TRACE("-----------------------------------------------------------\n");109 TRACE("OpenGL driver: %s %s\n", glGetString(GL_VENDOR),108 INFO("-----------------------------------------------------------\n"); 109 INFO("OpenGL driver: %s %s\n", glGetString(GL_VENDOR), 110 110 glGetString(GL_VERSION)); 111 TRACE("Graphics hardware: %s\n", glGetString(GL_RENDERER));112 TRACE("-----------------------------------------------------------\n");111 INFO("Graphics hardware: %s\n", glGetString(GL_RENDERER)); 112 INFO("-----------------------------------------------------------\n"); 113 113 } 114 114 -
trunk/packages/vizservers/nanovis/nanovis.cpp
r1984 r1991 397 397 WriteStats("nanovis", code); 398 398 #endif 399 closelog(); 399 400 exit(code); 400 401 } … … 769 770 { 770 771 // print system information 771 TRACE("-----------------------------------------------------------\n");772 TRACE("OpenGL driver: %s %s\n", glGetString(GL_VENDOR),772 INFO("-----------------------------------------------------------\n"); 773 INFO("OpenGL driver: %s %s\n", glGetString(GL_VENDOR), 773 774 glGetString(GL_VERSION)); 774 TRACE("Graphics hardware: %s\n", glGetString(GL_RENDERER));775 TRACE("-----------------------------------------------------------\n");775 INFO("Graphics hardware: %s\n", glGetString(GL_RENDERER)); 776 INFO("-----------------------------------------------------------\n"); 776 777 if (path == NULL) { 777 778 ERROR("No path defined for shaders or resources\n"); … … 784 785 //assert(false); 785 786 } 786 TRACE("Status:Using GLEW %s\n", glewGetString(GLEW_VERSION));787 INFO("Using GLEW %s\n", glewGetString(GLEW_VERSION)); 787 788 788 789 if (!R2FilePath::getInstance()->setPath(path)) { … … 2248 2249 path = NULL; 2249 2250 NanoVis::stdin = stdin; 2250 NanoVis::logfile = stderr; 2251 2251 2252 openlog("nanovis", LOG_CONS | LOG_PERROR | LOG_PID, LOG_USER); 2252 2253 gettimeofday(&tv, NULL); 2253 2254 stats.start = tv; … … 2276 2277 static struct option long_options[] = { 2277 2278 {"infile", required_argument, NULL, 0}, 2278 {"logfile", required_argument, NULL, 1},2279 2279 {"path", required_argument, NULL, 2}, 2280 2280 {"debug", no_argument, NULL, 3}, … … 2317 2317 } 2318 2318 break; 2319 case 1:2320 case 'l':2321 NanoVis::logfile = fopen(optarg, "w");2322 if (NanoVis::logfile == NULL) {2323 perror(optarg);2324 return 2;2325 }2326 break;2327 2319 case 4: 2328 2320 case 'r':
Note: See TracChangeset
for help on using the changeset viewer.