Changeset 8417 for trunk/ppMerge/src/ppMergeCombine.c
- Timestamp:
- Aug 17, 2006, 4:54:10 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeCombine.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeCombine.c
r8405 r8417 9 9 #include "ppMergeCombine.h" 10 10 11 #if 0 12 static psMemId memId = 0; 13 14 static FILE *dumpFile = NULL; 15 16 static psMemId mbAlloc(psMemBlock *mb) 17 { 18 if (!dumpFile) { 19 dumpFile = fopen("memBlocks.dat", "w"); 20 } 21 fprintf(dumpFile, "Alloc: %12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, 22 mb->file, mb->lineno); 23 return 1; 24 } 25 26 static void dumpDone(void) 27 { 28 fclose(dumpFile); 29 exit(EXIT_FAILURE); 30 } 31 32 33 static void memDump(void) 34 { 35 psMemBlock **leaks = NULL; 36 int numLeaks = psMemCheckLeaks(memId, &leaks, NULL, true); 37 FILE *memFile = fopen("mem.dat", "w"); 38 fprintf(memFile, "# MemBlock Size Source\n"); 39 for (int i = 0; i < numLeaks; i++) { 40 psMemBlock *mb = leaks[i]; 41 fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, 42 mb->file, mb->lineno); 43 } 44 fclose(memFile); 45 psFree(leaks); 46 } 47 11 48 static void memCheck(void) 12 49 { 50 return; 13 51 if (psTraceGetLevel(__func__) > 9) { 14 52 psMemBlock **leaks = NULL; … … 32 70 return; 33 71 } 34 72 #endif 35 73 36 74 // Combine the inputs … … 42 80 ) 43 81 { 44 45 82 psArray *filenames = psMetadataLookupPtr(NULL, config->arguments, "INPUT"); // The input file names 46 83 assert(filenames); // It should be here --- it's put here in ppMergeConfig … … 86 123 } 87 124 125 #if 1 126 // Read bit by bit 127 88 128 int numRead; // Number of inputs read 89 129 int numScan = 0; … … 124 164 numScan++; 125 165 126 memCheck();127 128 166 } while (numRead > 0); 167 168 #else 169 // Read whole cells at a time 170 171 printf("Chip %d, cell %d\n", i, j); 172 int numRead = 0; // Number of inputs read 173 for (int k = 0; k < filenames->n; k++) { 174 if (! filenames->data[k] || strlen(filenames->data[k]) == 0) { 175 continue; 176 } 177 psFits *fits = data->files->data[k]; // FITS file handle 178 if (!fits) { 179 psError(PS_ERR_IO, false, "Unable to open input file %s --- ignored.\n", 180 filenames->data[k]); 181 continue; 182 } 183 pmFPA *fpaIn = data->in->data[k]; // Input FPA 184 pmChip *chipIn = fpaIn->chips->data[i]; // Input chip 185 pmCell *cellIn = chipIn->cells->data[j]; // Input cell 186 if (!cellIn->file_exists || !cellIn->data_exists) { 187 continue; 188 } 189 if (!pmCellRead(cellIn, fits, config->database) || cellIn->readouts->n == 0) { 190 continue; 191 } 192 stack->data[k] = cellIn->readouts->data[0]; 193 numRead++; 194 } 195 if (numRead > 0) { 196 pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine); 197 psTrace(__func__, 5, "Chip %d, cell %d\n", i, j); 198 } 199 200 memCheck(); 201 #endif 202 129 203 psFree(readout); // Drop reference 130 204 psFree(stack); … … 144 218 pmCellFreeData(cell); 145 219 } 146 147 memCheck();148 220 } 149 221 … … 161 233 pmChipFreeData(chip); 162 234 } 163 164 memCheck();165 235 } 166 236 … … 178 248 pmFPAFreeData(data->out); 179 249 180 memCheck();181 182 250 return true; 183 } 251 252 }
Note:
See TracChangeset
for help on using the changeset viewer.
