Changeset 1081
- Timestamp:
- Jun 23, 2004, 5:12:19 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 6 edited
-
sys/psMemory.c (modified) (3 diffs)
-
sys/psTrace.c (modified) (11 diffs)
-
sys/psTrace.h (modified) (2 diffs)
-
sysUtils/psMemory.c (modified) (3 diffs)
-
sysUtils/psTrace.c (modified) (11 diffs)
-
sysUtils/psTrace.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psMemory.c
r1073 r1081 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06-2 3 23:00:15$10 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-24 03:12:19 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 182 182 * N.b. If the block wasn't allocated by psAlloc, it will appear corrupted 183 183 */ 184 #define ALIGNED(P) ((void *)((long)(P) & ~03) == (P))185 184 186 185 static int checkMemBlock(const psMemBlock *m, const char* funcName) … … 191 190 if (m == NULL) { 192 191 psError(funcName,"Memory Corruption: NULL memory block found."); 193 return(1);194 }195 196 if (!ALIGNED(m)) {197 psError(funcName, "psMemCheckCorruption: non-aligned memory block");198 192 return(1); 199 193 } -
trunk/psLib/src/sys/psTrace.c
r1013 r1081 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 12 05:50:01$11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-24 03:12:19 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 #include "psError.h" 41 41 42 static Component *p_psCroot = NULL; // The root of the trace component42 static p_psComponent *p_psCroot = NULL; // The root of the trace component 43 43 static FILE *p_psTraceFP = NULL; // File destination for messages. 44 45 static void componentFree(p_psComponent *comp); 46 static p_psComponent *componentAlloc(const char *name,int level); 47 44 48 /***************************************************************************** 45 49 componentAlloc(): allocate memory for a new node, and initialize members. 46 50 *****************************************************************************/ 47 Component *componentAlloc(const char *name, 48 int level) 49 { 50 Component *comp = psAlloc(sizeof(Component)); 51 static p_psComponent *componentAlloc(const char *name, 52 int level) 53 { 54 p_psComponent *comp = psAlloc(sizeof(p_psComponent)); 55 p_psMemSetDeallocator(comp,(psFreeFcn)componentFree); 51 56 comp->name = psStringCopy(name); 52 57 comp->level = level; … … 61 66 nodes as well. 62 67 *****************************************************************************/ 63 static void componentFree( Component *comp)68 static void componentFree(p_psComponent *comp) 64 69 { 65 70 if (comp == NULL) { … … 69 74 if (comp->subcomp != NULL) { 70 75 for (int i = 0; i < comp->n; i++) { 71 componentFree(comp->subcomp[i]);76 psFree(comp->subcomp[i]); 72 77 } 73 78 psFree(comp->subcomp); … … 75 80 76 81 psFree((char *)comp->name); 77 psFree(comp);78 82 } 79 83 … … 93 97 Set all trace levels to zero. 94 98 *****************************************************************************/ 95 void p_psTraceReset( Component *currentNode)99 void p_psTraceReset(p_psComponent *currentNode) 96 100 { 97 101 int i = 0; … … 128 132 void psTraceFree() 129 133 { 130 componentFree(p_psCroot);134 psFree(p_psCroot); 131 135 } 132 136 … … 145 149 char *pname=name; 146 150 char *firstComponent = NULL; // first component of name 147 Component *currentNode = p_psCroot;151 p_psComponent *currentNode = p_psCroot; 148 152 int nodeExists = 0; 149 153 … … 181 185 if (nodeExists == 0) { 182 186 currentNode->subcomp = psRealloc(currentNode->subcomp, 183 (currentNode->n + 1) * sizeof( Component*));187 (currentNode->n + 1) * sizeof(p_psComponent*)); 184 188 currentNode->n = (currentNode->n)+1; 185 189 … … 237 241 char *pname=name; 238 242 char *firstComponent = NULL; // first component of name 239 Component *currentNode = p_psCroot;243 p_psComponent *currentNode = p_psCroot; 240 244 int i = 0; 241 245 … … 310 314 null 311 315 *****************************************************************************/ 312 static void doPrintTraceLevels(const Component *comp,316 static void doPrintTraceLevels(const p_psComponent *comp, 313 317 int depth) 314 318 { -
trunk/psLib/src/sys/psTrace.h
r1013 r1081 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 12 05:50:01$11 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-24 03:12:19 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 Component structure doesn't in fact contain it's full name, but only the 24 24 last part. */ 25 typedef struct Component25 typedef struct p_psComponent 26 26 { 27 27 const char *name; // last part of name of component 28 28 int level; // trace level for this component 29 29 int n; // number of subcomponents 30 struct Component **subcomp; // next level of subcomponents30 struct p_psComponent **subcomp; // next level of subcomponents 31 31 } 32 Component;32 p_psComponent; 33 33 34 34 /** \addtogroup LogTrace -
trunk/psLib/src/sysUtils/psMemory.c
r1073 r1081 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06-2 3 23:00:15$10 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-24 03:12:19 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 182 182 * N.b. If the block wasn't allocated by psAlloc, it will appear corrupted 183 183 */ 184 #define ALIGNED(P) ((void *)((long)(P) & ~03) == (P))185 184 186 185 static int checkMemBlock(const psMemBlock *m, const char* funcName) … … 191 190 if (m == NULL) { 192 191 psError(funcName,"Memory Corruption: NULL memory block found."); 193 return(1);194 }195 196 if (!ALIGNED(m)) {197 psError(funcName, "psMemCheckCorruption: non-aligned memory block");198 192 return(1); 199 193 } -
trunk/psLib/src/sysUtils/psTrace.c
r1013 r1081 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 12 05:50:01$11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-24 03:12:19 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 #include "psError.h" 41 41 42 static Component *p_psCroot = NULL; // The root of the trace component42 static p_psComponent *p_psCroot = NULL; // The root of the trace component 43 43 static FILE *p_psTraceFP = NULL; // File destination for messages. 44 45 static void componentFree(p_psComponent *comp); 46 static p_psComponent *componentAlloc(const char *name,int level); 47 44 48 /***************************************************************************** 45 49 componentAlloc(): allocate memory for a new node, and initialize members. 46 50 *****************************************************************************/ 47 Component *componentAlloc(const char *name, 48 int level) 49 { 50 Component *comp = psAlloc(sizeof(Component)); 51 static p_psComponent *componentAlloc(const char *name, 52 int level) 53 { 54 p_psComponent *comp = psAlloc(sizeof(p_psComponent)); 55 p_psMemSetDeallocator(comp,(psFreeFcn)componentFree); 51 56 comp->name = psStringCopy(name); 52 57 comp->level = level; … … 61 66 nodes as well. 62 67 *****************************************************************************/ 63 static void componentFree( Component *comp)68 static void componentFree(p_psComponent *comp) 64 69 { 65 70 if (comp == NULL) { … … 69 74 if (comp->subcomp != NULL) { 70 75 for (int i = 0; i < comp->n; i++) { 71 componentFree(comp->subcomp[i]);76 psFree(comp->subcomp[i]); 72 77 } 73 78 psFree(comp->subcomp); … … 75 80 76 81 psFree((char *)comp->name); 77 psFree(comp);78 82 } 79 83 … … 93 97 Set all trace levels to zero. 94 98 *****************************************************************************/ 95 void p_psTraceReset( Component *currentNode)99 void p_psTraceReset(p_psComponent *currentNode) 96 100 { 97 101 int i = 0; … … 128 132 void psTraceFree() 129 133 { 130 componentFree(p_psCroot);134 psFree(p_psCroot); 131 135 } 132 136 … … 145 149 char *pname=name; 146 150 char *firstComponent = NULL; // first component of name 147 Component *currentNode = p_psCroot;151 p_psComponent *currentNode = p_psCroot; 148 152 int nodeExists = 0; 149 153 … … 181 185 if (nodeExists == 0) { 182 186 currentNode->subcomp = psRealloc(currentNode->subcomp, 183 (currentNode->n + 1) * sizeof( Component*));187 (currentNode->n + 1) * sizeof(p_psComponent*)); 184 188 currentNode->n = (currentNode->n)+1; 185 189 … … 237 241 char *pname=name; 238 242 char *firstComponent = NULL; // first component of name 239 Component *currentNode = p_psCroot;243 p_psComponent *currentNode = p_psCroot; 240 244 int i = 0; 241 245 … … 310 314 null 311 315 *****************************************************************************/ 312 static void doPrintTraceLevels(const Component *comp,316 static void doPrintTraceLevels(const p_psComponent *comp, 313 317 int depth) 314 318 { -
trunk/psLib/src/sysUtils/psTrace.h
r1013 r1081 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 12 05:50:01$11 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-24 03:12:19 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 Component structure doesn't in fact contain it's full name, but only the 24 24 last part. */ 25 typedef struct Component25 typedef struct p_psComponent 26 26 { 27 27 const char *name; // last part of name of component 28 28 int level; // trace level for this component 29 29 int n; // number of subcomponents 30 struct Component **subcomp; // next level of subcomponents30 struct p_psComponent **subcomp; // next level of subcomponents 31 31 } 32 Component;32 p_psComponent; 33 33 34 34 /** \addtogroup LogTrace
Note:
See TracChangeset
for help on using the changeset viewer.
