Changeset 8413 for trunk/psLib/src/sys/psTrace.c
- Timestamp:
- Aug 17, 2006, 1:05:23 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psTrace.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psTrace.c
r8245 r8413 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-08- 09 02:26:44$11 * @version $Revision: 1.68 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-08-17 23:05:23 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 37 37 38 38 *****************************************************************************/ 39 40 41 // NOTE: We want to avoid using the psString functions, or any function that calls the PS memory management, 42 // since there seems to be a problem with memory fragmentation. Since psTrace can get called a LOT, it 43 // manifests this problem. To get around this, we will use variable length char arrays, instead of the 44 // psString functions. This can be revised once the PS memory management system is fixed. 45 #define USE_PS_MEMORY 0 46 39 47 40 48 #ifndef PS_NO_TRACE … … 385 393 int psTraceGetLevel(const char *name) 386 394 { 387 char *compName = NULL;388 395 psS32 traceLevel; 389 396 … … 394 401 // If the component name has no leading dot, then supply it. 395 402 if (name[0] != '.') { 396 compName = (char *) psAlloc(10 + strlen(name)); 403 #if USE_PS_MEMORY 404 psString compName = (char *) psAlloc(10 + strlen(name)); 397 405 strcpy(compName, "."); 398 406 compName = strcat(compName, name); 407 #else 408 409 char compName[strlen(name) + 2]; 410 compName[0] = '.'; 411 strcpy(&compName[1], name); 412 #endif 413 399 414 traceLevel = doGetTraceLevel(compName); 415 #if USE_PS_MEMORY 416 400 417 psFree(compName); 418 #endif 419 401 420 } else { 402 421 // Search the component root tree, determine the trace level. … … 629 648 va_start(ap, format); 630 649 // format = va_arg(ap, char *); 650 651 #if USE_PS_MEMORY 652 631 653 psString fullFacil = NULL; 632 654 psStringAppend(&fullFacil, "%s.%s", facil, func); 655 #else 656 657 size_t facilLength = strlen(facil); // Length of facility name 658 size_t funcLength = strlen(func); // Length of function name 659 char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name 660 strcpy(&fullFacil[0], facil); 661 fullFacil[facilLength] = '.'; 662 strcpy(&fullFacil[facilLength + 1], func); 663 #endif 664 633 665 psTraceV(fullFacil, level, format, ap); 666 #if USE_PS_MEMORY 667 634 668 psFree(fullFacil); 669 #endif 670 635 671 va_end(ap); 636 672 // fflush(traceFP);
Note:
See TracChangeset
for help on using the changeset viewer.
