Changeset 38429
- Timestamp:
- Jun 8, 2015, 11:46:15 AM (11 years ago)
- Location:
- branches/eam_branches/ohana.20150429/src/libfits
- Files:
-
- 4 edited
-
table/F_compress_T.c (modified) (11 diffs)
-
table/F_table_varlength.c (modified) (2 diffs)
-
table/F_uncompress_T.c (modified) (1 diff)
-
test/tcomptiming.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/table/F_compress_T.c
r38418 r38429 24 24 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows); 25 25 26 static float timeSum1 = 0.0; 27 static float timeSum2 = 0.0; 28 static float timeSum2a = 0.0; 29 static float timeSum2b = 0.0; 30 static float timeSum2c = 0.0; 31 static float timeSum2d = 0.0; 32 static float timeSum2e = 0.0; 33 static float timeSum3 = 0.0; 34 35 void gfits_compress_timing () { 36 fprintf (stderr, "cmp times: %f %f %f\n", timeSum1, timeSum2, timeSum3); 37 fprintf (stderr, "cmp times: %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e); 38 39 timeSum1 = 0.0; 40 timeSum2 = 0.0; 41 timeSum2a = 0.0; 42 timeSum2b = 0.0; 43 timeSum2c = 0.0; 44 timeSum2d = 0.0; 45 timeSum2e = 0.0; 46 timeSum3 = 0.0; 47 } 48 26 49 int gfits_compress_table (FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype) { 27 50 … … 35 58 Header *srcheader = srctable->header; 36 59 Header *tgtheader = tgttable->header; 60 61 // XXX EAM: 62 struct timeval startTimer, stopTimer; 63 float dtime; 64 gettimeofday (&startTimer, (void *) NULL); 37 65 38 66 int Ntile, ztilelast; … … 64 92 if (!gfits_scan (srcheader, "TFIELDS", "%d", 1, &Nfields)) ESCAPE; 65 93 94 // XXX TIMER 1 95 gettimeofday (&stopTimer, (void *) NULL); 96 dtime = DTIME (stopTimer, startTimer); 97 timeSum1 += dtime; 98 gettimeofday (&startTimer, (void *) NULL); 99 66 100 TableField *fields = NULL; 67 101 ALLOCATE_ZERO (fields, TableField, Nfields); … … 181 215 gfits_dump_raw_table (srctable, "cmp"); 182 216 217 // XXX TIMER 2 218 gettimeofday (&stopTimer, (void *) NULL); 219 dtime = DTIME (stopTimer, startTimer); 220 timeSum2 += dtime; 221 gettimeofday (&startTimer, (void *) NULL); 222 183 223 // compress the data : copy into a tile, compress the tile, then add to the output table 184 224 // each tile -> 1 row of the output table … … 186 226 187 227 for (j = 0; j < Nfields; j++) { 228 229 gettimeofday (&startTimer, (void *) NULL); 188 230 189 231 int Nrows = (i == Ntile - 1) ? ztilelast : ztilelen; … … 199 241 } 200 242 243 // XXX TIMER 2a 244 gettimeofday (&stopTimer, (void *) NULL); 245 dtime = DTIME (stopTimer, startTimer); 246 timeSum2a += dtime; 247 gettimeofday (&startTimer, (void *) NULL); 248 201 249 if (VERBOSE_DUMP) { 202 250 int k; … … 217 265 } 218 266 267 // XXX TIMER 2b 268 gettimeofday (&stopTimer, (void *) NULL); 269 dtime = DTIME (stopTimer, startTimer); 270 timeSum2b += dtime; 271 gettimeofday (&startTimer, (void *) NULL); 272 219 273 if (VERBOSE_DUMP) { 220 274 int k; … … 231 285 if (!gfits_compress_data (zdata, &Nzdata, fields[j].zctype, NULL, NULL, 0, raw, Nraw, fields[j].pixsize, 0, 0)) ESCAPE; 232 286 287 // XXX TIMER 2c 288 gettimeofday (&stopTimer, (void *) NULL); 289 dtime = DTIME (stopTimer, startTimer); 290 timeSum2c += dtime; 291 gettimeofday (&startTimer, (void *) NULL); 292 233 293 if (VERBOSE_DUMP) { 234 294 int k; … … 250 310 } 251 311 312 // XXX TIMER 2d 313 gettimeofday (&stopTimer, (void *) NULL); 314 dtime = DTIME (stopTimer, startTimer); 315 timeSum2d += dtime; 316 gettimeofday (&startTimer, (void *) NULL); 317 252 318 if (VERBOSE_DUMP) { 253 319 int k; … … 262 328 263 329 if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, i, &fields[j].zdef)) ESCAPE; 330 // XXX TIMER 2e 331 gettimeofday (&stopTimer, (void *) NULL); 332 dtime = DTIME (stopTimer, startTimer); 333 timeSum2e += dtime; 334 gettimeofday (&startTimer, (void *) NULL); 335 264 336 } 265 337 } … … 268 340 if (!gfits_varlength_column_finish (tgttable, &fields[i].zdef)) ESCAPE; 269 341 } 342 343 // XXX TIMER 3 344 gettimeofday (&stopTimer, (void *) NULL); 345 dtime = DTIME (stopTimer, startTimer); 346 timeSum3 += dtime; 347 gettimeofday (&startTimer, (void *) NULL); 270 348 271 349 gfits_dump_cmp_table (tgttable, "cmp"); -
branches/eam_branches/ohana.20150429/src/libfits/table/F_table_varlength.c
r38425 r38429 119 119 void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, off_t row, off_t *length) { 120 120 121 void *result;122 off_t offset, Nx;123 124 121 if ((column->mode != 'P') && (column->mode != 'Q')) abort(); 125 122 126 123 // find the values for the specified row 127 124 // the values in the main table for this row and varlength column: 128 Nx = ftable->header->Naxis[0]; 125 off_t Nx = ftable->header->Naxis[0]; 126 off_t offset = 0; 129 127 130 128 if (column->mode == 'P') { … … 143 141 // fprintf (stderr, "length: %d, offset: %d\n", (int) *length, (int) offset); 144 142 145 result = (void *) (ftable->buffer + ftable->heap_start + offset);143 void *result = (void *) (ftable->buffer + ftable->heap_start + offset); 146 144 return result; 147 145 } -
branches/eam_branches/ohana.20150429/src/libfits/table/F_uncompress_T.c
r38425 r38429 58 58 59 59 void gfits_uncompress_timing () { 60 fprintf (stderr, " times: %f %f %f\n", timeSum1, timeSum2, timeSum3);61 fprintf (stderr, " times: %f %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e, timeSum2f);60 fprintf (stderr, "unc times: %f %f %f\n", timeSum1, timeSum2, timeSum3); 61 fprintf (stderr, "unc times: %f %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e, timeSum2f); 62 62 63 63 timeSum1 = 0.0; -
branches/eam_branches/ohana.20150429/src/libfits/test/tcomptiming.c
r38426 r38429 8 8 char *cmptype[] = {"NONE", "NONE_1", "NONE_2", "GZIP_1", "GZIP_2", "RICE_1", "RICE_ONE", "AUTO", NULL}; 9 9 10 static int Nval = 1000000 ;10 static int Nval = 10000000; 11 11 12 12 int main (int argc, char **argv) { … … 24 24 for (lNtile = 1.0; lNtile < lNtileMax; lNtile += 1.0) { 25 25 int Ntile = pow (10.0, lNtile); 26 fprintf (stderr, "--- Ntile = %d ---\n", Ntile); 26 27 test_compress_timing ("NONE_2", Ntile); 27 fprintf (stderr, "--- Ntile = %d ---\n", Ntile);28 gfits_compress_timing(); 28 29 gfits_uncompress_timing(); 29 30 } … … 54 55 ok (gfits_create_table (&header, &ftable), "created the basic table"); 55 56 57 // XXX EAM: 58 struct timeval startTimer, stopTimer; 59 float dtime; 60 gettimeofday (&startTimer, (void *) NULL); 61 62 float timeSum1 = 0.0; 63 float timeSum2 = 0.0; 64 float timeSum3 = 0.0; 65 float timeSum4 = 0.0; 66 float timeSum5 = 0.0; 67 float timeSum6 = 0.0; 68 float timeSum7 = 0.0; 69 56 70 char *VAL_B; ALLOCATE (VAL_B, char, Nval); 57 71 short *VAL_I; ALLOCATE (VAL_I, short, Nval); … … 64 78 srand48(A); 65 79 80 // XXX TIMER 1 81 gettimeofday (&stopTimer, (void *) NULL); 82 dtime = DTIME (stopTimer, startTimer); 83 timeSum1 += dtime; 84 gettimeofday (&startTimer, (void *) NULL); 85 66 86 int i; 67 87 for (i = 0; i < Nval; i++) { … … 74 94 } 75 95 96 // XXX TIMER 1 97 gettimeofday (&stopTimer, (void *) NULL); 98 dtime = DTIME (stopTimer, startTimer); 99 timeSum2 += dtime; 100 gettimeofday (&startTimer, (void *) NULL); 101 76 102 // add the columns to the output array 77 103 ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte table column"); … … 82 108 ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column"); 83 109 110 // XXX TIMER 1 111 gettimeofday (&stopTimer, (void *) NULL); 112 dtime = DTIME (stopTimer, startTimer); 113 timeSum3 += dtime; 114 gettimeofday (&startTimer, (void *) NULL); 115 84 116 Header *outheader = &header; 85 117 FTable *outtable = &ftable; … … 107 139 off_t Nrow; 108 140 141 // XXX TIMER 1 142 gettimeofday (&stopTimer, (void *) NULL); 143 dtime = DTIME (stopTimer, startTimer); 144 timeSum4 += dtime; 145 gettimeofday (&startTimer, (void *) NULL); 146 109 147 char *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"), "read byte table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 110 148 short *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"), "read short table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); … … 113 151 float *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"), "read float table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 114 152 double *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"), "read double table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 153 154 // XXX TIMER 1 155 gettimeofday (&stopTimer, (void *) NULL); 156 dtime = DTIME (stopTimer, startTimer); 157 timeSum5 += dtime; 158 gettimeofday (&startTimer, (void *) NULL); 115 159 116 160 // count mismatched values … … 131 175 } 132 176 177 // XXX TIMER 1 178 gettimeofday (&stopTimer, (void *) NULL); 179 dtime = DTIME (stopTimer, startTimer); 180 timeSum6 += dtime; 181 gettimeofday (&startTimer, (void *) NULL); 182 133 183 ok (!NVAL_B_bad, "byte values match (input vs output)"); 134 184 ok (!NVAL_I_bad, "short values match (input vs output)"); … … 144 194 gfits_free_table (outtable); 145 195 } 196 // XXX TIMER 1 197 gettimeofday (&stopTimer, (void *) NULL); 198 dtime = DTIME (stopTimer, startTimer); 199 timeSum7 += dtime; 200 gettimeofday (&startTimer, (void *) NULL); 201 202 fprintf (stderr, "out times: %f %f %f %f %f %f %f\n", timeSum1, timeSum2, timeSum3, timeSum4, timeSum5, timeSum6, timeSum7); 203 146 204 return TRUE; 147 205 }
Note:
See TracChangeset
for help on using the changeset viewer.
