Changeset 12286 for trunk/psLib/src/sys/psTrace.c
- Timestamp:
- Mar 6, 2007, 2:17:48 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psTrace.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psTrace.c
r11674 r12286 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-07 01:15:49$11 * @version $Revision: 1.86 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-07 00:17:48 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 might give that a numerically low trace level, such as 1, so then any 23 23 non-zero trace level in that code component will display thatmessage. 24 24 25 25 We build a tree of trace components. Every node in the tree has a 26 26 depth, which is it's distance from the root. However, this is not 27 27 not the same thing as a node's "level", which corresponds to the 28 28 trace level of that node. 29 29 30 30 I think the following is the correct behavior, but not sure: 31 31 PS_UNKNOWN_TRACE_LEVEL: We never set the level of a component to this 32 32 value. This value is only used when psTraceGetLevel is called with 33 33 a bad component name, or if the component root is undefined, I think. 34 34 35 35 PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the 36 36 intermediate components of a psS64 name. Ie. the "B" in .A.B.C 37 37 38 38 *****************************************************************************/ 39 39 … … 134 134 // NB: declares TARGET! 135 135 #define FACILITY(TARGET, FUNC, FACIL) \ 136 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \137 size_t _funcLength = strlen(FUNC); /* Length of function name */ \138 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \139 strcpy(&TARGET[0], FACIL); \140 TARGET[_facilLength] = '.'; \141 strcpy(&TARGET[_facilLength + 1], FUNC);136 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \ 137 size_t _funcLength = strlen(FUNC); /* Length of function name */ \ 138 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \ 139 strcpy(&TARGET[0], FACIL); \ 140 TARGET[_facilLength] = '.'; \ 141 strcpy(&TARGET[_facilLength + 1], FUNC); 142 142 143 143 144 144 /***************************************************************************** 145 145 Set all trace levels to zero. 146 146 147 147 XXX: Currently, no function calls this routine. 148 148 *****************************************************************************/ … … 267 267 psSetTraceLevel(): add the component named "comp" to the component tree, 268 268 if it is not already there, and set it's trace level to "level". 269 269 270 270 NOTE: We modified this so that the user may omit the leading "," in a 271 271 component name. Since the code was already implemented assuming the "." 272 272 was required, rather than change all that code, in this function, I 273 273 simply add a leading "." to the component name if there is none. 274 274 275 275 Input: 276 276 comp … … 284 284 int level) // desired trace level 285 285 { 286 PS_ASSERT_ PTR_NON_NULL(comp, 0);286 PS_ASSERT_STRING_NON_EMPTY(comp, 0); 287 287 288 288 char *compName = NULL; … … 331 331 finds that component, it returns the level of that component. 332 332 Otherwise, it returns ???. 333 333 334 334 NOTE: We modified this so that the user may omit the leading "," in a 335 335 component name. Since the code was already implemented assuming the "." 336 336 was required, rather than change all that code, in this function, I 337 337 simply add a leading "." to the component name if there is none. 338 338 339 339 Inputs: 340 340 name: … … 449 449 const char *name) 450 450 { 451 PS_ASSERT_ PTR_NON_NULL(name, 0);452 PS_ASSERT_ PTR_NON_NULL(func, 0);451 PS_ASSERT_STRING_NON_EMPTY(name, 0); 452 PS_ASSERT_STRING_NON_EMPTY(func, 0); 453 453 454 454 FACILITY(facility, func, name); … … 527 527 va_list ap) 528 528 { 529 PS_ASSERT_ PTR_NON_NULL(comp, );530 PS_ASSERT_ PTR_NON_NULL(format, );529 PS_ASSERT_STRING_NON_EMPTY(comp, ); 530 PS_ASSERT_STRING_NON_EMPTY(format, ); 531 531 532 532 // XXX EAM : fd < 1 does not print messages … … 660 660 ) 661 661 { 662 PS_ASSERT_ PTR_NON_NULL(file, );663 PS_ASSERT_ PTR_NON_NULL(func, );664 PS_ASSERT_ PTR_NON_NULL(facil, );665 PS_ASSERT_ PTR_NON_NULL(format, );662 PS_ASSERT_STRING_NON_EMPTY(file, ); 663 PS_ASSERT_STRING_NON_EMPTY(func, ); 664 PS_ASSERT_STRING_NON_EMPTY(facil, ); 665 PS_ASSERT_STRING_NON_EMPTY(format, ); 666 666 667 667 FACILITY(name, func, facil); … … 698 698 included in message traces. It does not determine the order in which that 699 699 information will appear (that order is fixed). 700 700 701 701 Input: 702 702 fmt: a string specifying the format.
Note:
See TracChangeset
for help on using the changeset viewer.
