00001 char *cvsinfo_jretile_fewtomany = "cvsinfo: $Header: /home/cvsuser/cvsroot/JSOC/proj/globalhs/apps/jretile_fewtomany.c,v 1.8 2017/03/31 20:02:28 tplarson Exp $";
00002
00003 int jretile_fewtomany(void)
00004 {
00005 int newstat = 0;
00006 int status = DRMS_SUCCESS;
00007
00008 char *inrecquery = NULL;
00009 char *outseries = NULL;
00010 char *segnamein = NULL;
00011 char *segnameout = NULL;
00012 DRMS_RecordSet_t *inrecset = NULL;
00013 DRMS_RecordSet_t *outrecset = NULL;
00014 int irecin, irecout, nrecsin=0, nrecsout=0, nlchunks;
00015 DRMS_Record_t *inrec = NULL;
00016 DRMS_Record_t *outrec = NULL;
00017 DRMS_Segment_t *segin = NULL;
00018 DRMS_Segment_t *segout = NULL;
00019 DRMS_Array_t *inarr = NULL;
00020 DRMS_Array_t *outarr = NULL;
00021 DRMS_RecLifetime_t lifetime;
00022 DRMS_Type_t usetype = DRMS_TYPE_FLOAT;
00023 int length[2], startind[2], endind[2];
00024 float *inptr, *outptr;
00025 long long histrecnum=-1;
00026 int quality;
00027 int mapmmax=-1;
00028 int sinbdivs=-1;
00029 double cadence=0;
00030 int i;
00031
00032 TIME tnow, UNIX_epoch = -220924792.000;
00033 char tstartstr[100];
00034
00035 double tstart, tepoch, tstep, tround, tstop, tstartin, tstopin, tstepin, tstartuse, tstopuse, nseconds, chunksecs;
00036 char *ttotal, *tchunk;
00037 int ndt;
00038 int lmin, lmax, lminin, lmaxin, lminuse, lmaxuse, lchunk, lchunksize, lchunkfirst, lchunklast;
00039 int ntimechunks, nmodes, npts, imode, itime;
00040 int out_time_offset, out_modes_offset, out_offset, in_time_offset, in_modes_offset, in_offset, out_index, in_index;
00041 int iset, lminout, lmaxout;
00042 double tstartout, tstopout;
00043 float *arrptr;
00044 int nrecords, nsegments, nskip;
00045
00046 int errbufstat=setvbuf(stderr, NULL, _IONBF, BUFSIZ);
00047 int outbufstat=setvbuf(stdout, NULL, _IONBF, BUFSIZ);
00048
00049 double wt0, wt1, wt2, wt3, wt;
00050 double ut0, ut1, ut2, ut3, ut;
00051 double st0, st1, st2, st3, st;
00052 double ct0, ct1, ct2, ct3, ct;
00053
00054 wt0=getwalltime();
00055 ct0=getcputime(&ut0, &st0);
00056
00057 inrecquery = (char *)cmdparams_save_str(&cmdparams, "in", &newstat);
00058 outseries = (char *)cmdparams_save_str(&cmdparams, "out", &newstat);
00059 segnamein = (char *)cmdparams_save_str(&cmdparams, "segin", &newstat);
00060 segnameout = (char *)cmdparams_save_str(&cmdparams, "segout", &newstat);
00061 int seginflag = strcmp(kNOTSPECIFIED, segnamein);
00062 int segoutflag = strcmp(kNOTSPECIFIED, segnameout);
00063 int verbflag = cmdparams_save_int(&cmdparams, "VERB", &newstat);
00064 int permflag = cmdparams_save_int(&cmdparams, "PERM", &newstat);
00065 if (permflag)
00066 lifetime = DRMS_PERMANENT;
00067 else
00068 lifetime = DRMS_TRANSIENT;
00069 unsigned short calverkey = (unsigned short)cmdparams_save_int(&cmdparams, "CALVERKEY", &newstat);
00070
00071 char *histlinkname = (char *)cmdparams_save_str(&cmdparams, "histlink", &newstat);
00072
00073 tstart=cmdparams_save_time(&cmdparams, "TSTART", &newstat);
00074 ttotal=(char *)cmdparams_save_str(&cmdparams, "TTOTAL", &newstat);
00075 status=drms_names_parseduration(&ttotal, &nseconds, 1);
00076 if (status != DRMS_SUCCESS)
00077 {
00078
00079 fprintf(stderr, "ERROR: problem parsing TTOTAL, = %s\n", ttotal);
00080 return 1;
00081 }
00082 tchunk=(char *)cmdparams_save_str(&cmdparams, "TCHUNK", &newstat);
00083 if (strcmp(kNOTSPECIFIED, tchunk))
00084 {
00085 status=drms_names_parseduration(&tchunk, &chunksecs, 1);
00086 if (status != DRMS_SUCCESS)
00087 newstat = newstat | CPSAVE_UNKNOWN_ERROR;
00088 }
00089 else
00090 chunksecs=0;
00091
00092 lmin=cmdparams_save_int(&cmdparams, "LMIN", &newstat);
00093 lmax=cmdparams_save_int(&cmdparams, "LMAX", &newstat);
00094 lchunksize=cmdparams_save_int(&cmdparams, "LCHUNK", &newstat);
00095 if (lchunksize == 0)
00096 lchunksize=lmax+1;
00097
00098 if (newstat)
00099 {
00100 fprintf(stderr, "ERROR: problem with input arguments, status = %d, diagnosis follows\n", newstat);
00101 cpsave_decode_error(newstat);
00102 return 1;
00103 }
00104 else if (savestrlen != strlen(savestr))
00105 {
00106 fprintf(stderr, "ERROR: problem with savestr, savestrlen = %d, strlen(savestr) = %d\n", savestrlen, (int)strlen(savestr));
00107 return 1;
00108 }
00109
00110 DRMS_Record_t *tempoutrec = drms_create_record(drms_env,
00111 outseries,
00112 DRMS_TRANSIENT,
00113 &status);
00114
00115 if (status != DRMS_SUCCESS)
00116 {
00117 fprintf(stderr,"ERROR: couldn't open a record in output dataseries %s, status = %d\n", outseries, status);
00118 return 1;
00119 }
00120
00121
00122
00123 DRMS_Link_t *histlink = hcon_lookup_lower(&tempoutrec->links, histlinkname);
00124 if (histlink != NULL)
00125 {
00126 histrecnum=set_history(histlink);
00127 if (histrecnum < 0)
00128 {
00129 drms_close_record(tempoutrec, DRMS_FREE_RECORD);
00130 return 1;
00131 }
00132 }
00133 else
00134 {
00135 fprintf(stderr,"WARNING: could not find history link in output dataseries\n");
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 tepoch=drms_getkey_time(tempoutrec, "T_START_epoch", &status);
00156 tstep=drms_getkey_float(tempoutrec, "T_START_step", &status);
00157 tround=drms_getkey_float(tempoutrec, "T_START_round", &status);
00158 cadence=drms_getkey_float(tempoutrec, "T_STEP", &status);
00159 if (fmod(tstart-tepoch,tstep) > tround/2)
00160 {
00161 fprintf(stderr, "ERROR: output dataseries seems incompatible with input parameters (tstep must divide tstart-tepoch): tstart = %f, tepoch = %f, tstep = %f\n", tstart, tepoch, tstep);
00162 drms_close_record(tempoutrec, DRMS_FREE_RECORD);
00163 return 1;
00164 }
00165 if (chunksecs == 0.0)
00166 chunksecs = tstep;
00167 else if (fmod(chunksecs,tstep))
00168 {
00169 fprintf(stderr, "ERROR: output dataseries seems incompatible with input parameters (tstep must divide chunksecs): chunksecs = %f, tstep = %f\n", chunksecs, tstep);
00170 drms_close_record(tempoutrec, DRMS_FREE_RECORD);
00171 return 1;
00172 }
00173 if (fmod(nseconds,chunksecs) != 0.0)
00174 {
00175 fprintf(stderr, "ERROR: input parameters seem incompatible (chunksecs must divide nseconds): nseconds = %f, chunksecs = %f\n", nseconds, chunksecs);
00176 drms_close_record(tempoutrec, DRMS_FREE_RECORD);
00177 return 1;
00178 }
00179 ntimechunks=nseconds/chunksecs;
00180 ndt=chunksecs/cadence;
00181 if (verbflag)
00182 {
00183 printf("%d timechunks, %.1f seconds per chunk\n", ntimechunks, chunksecs);
00184 }
00185
00186 int mapmmaxout=-1;
00187 int sinbdivsout=-1;
00188 DRMS_Keyword_t *outkeytest = hcon_lookup_lower(&tempoutrec->keywords, "MAPMMAX");
00189 if (outkeytest != NULL && outkeytest->info->recscope == 1)
00190 mapmmaxout=drms_getkey_int(tempoutrec, "MAPMMAX", &status);
00191 outkeytest = hcon_lookup_lower(&tempoutrec->keywords, "SINBDIVS");
00192 if (outkeytest != NULL && outkeytest->info->recscope == 1)
00193 sinbdivsout=drms_getkey_int(tempoutrec, "SINBDIVS", &status);
00194
00195 float apinnerout=0.0;
00196 float apwidthout=0.0;
00197 float apinner=0.0;
00198 float apwidth=0.0;
00199 outkeytest = hcon_lookup_lower(&tempoutrec->keywords, "APINNER");
00200 if (outkeytest != NULL && outkeytest->info->recscope == 1)
00201 apinnerout=drms_getkey_float(tempoutrec, "APINNER", &status);
00202 outkeytest = hcon_lookup_lower(&tempoutrec->keywords, "APWIDTH");
00203 if (outkeytest != NULL && outkeytest->info->recscope == 1)
00204 apwidthout=drms_getkey_float(tempoutrec, "APWIDTH", &status);
00205
00206 drms_close_record(tempoutrec, DRMS_FREE_RECORD);
00207
00208
00209 char *inchecklist[] = {"T_START", "QUALITY", "LMIN", "LMAX", "T_STEP"};
00210 DRMS_Keyword_t *inkeytest;
00211 int itest;
00212 inrecset = drms_open_records(drms_env, inrecquery, &status);
00213
00214
00215 if (status != DRMS_SUCCESS || inrecset == NULL)
00216 {
00217 fprintf(stderr, "ERROR: problem opening input recordset: status = %d\n", status);
00218 return 1;
00219 }
00220 nrecsin = inrecset->n;
00221
00222 if (verbflag)
00223 printf("input recordset opened, nrecs = %d\n", nrecsin);
00224
00225 int noinput=0;
00226 if (nrecsin == 0)
00227 {
00228 printf("WARNING: input recordset contains no records\n");
00229 noinput=1;
00230 goto skip1;
00231
00232 }
00233
00234 inrec = inrecset->records[0];
00235
00236
00237 for (itest=0; itest < ARRLENGTH(inchecklist); itest++)
00238 {
00239 inkeytest = hcon_lookup_lower(&inrec->keywords, inchecklist[itest]);
00240 if (inkeytest == NULL)
00241 {
00242 fprintf(stderr, "ERROR: required input keyword %s is missing\n", inchecklist[itest]);
00243 drms_close_records(inrecset, DRMS_FREE_RECORD);
00244 return 1;
00245 }
00246 }
00247
00248 if (cadence != drms_getkey_float(inrec, "T_STEP", &status))
00249 {
00250 fprintf(stderr, "ERROR: input T_STEP does not equal output T_STEP\n");
00251 drms_close_records(inrecset, DRMS_FREE_RECORD);
00252 return 1;
00253 }
00254
00255 inkeytest = hcon_lookup_lower(&inrec->keywords, "MAPMMAX");
00256 if (inkeytest != NULL)
00257 mapmmax=drms_getkey_int(inrec, "MAPMMAX", &status);
00258 if (mapmmaxout != -1 && mapmmaxout != mapmmax)
00259 {
00260 fprintf(stderr, "ERROR: input MAPMMAX does not equal output MAPMMAX, in=%d, out=%d\n", mapmmax, mapmmaxout);
00261 drms_close_records(inrecset, DRMS_FREE_RECORD);
00262 return 1;
00263 }
00264
00265 inkeytest = hcon_lookup_lower(&inrec->keywords, "SINBDIVS");
00266 if (inkeytest != NULL)
00267 sinbdivs=drms_getkey_int(inrec, "SINBDIVS", &status);
00268 if (sinbdivsout != -1 && sinbdivsout != sinbdivs)
00269 {
00270 fprintf(stderr, "ERROR: input SINBDIVS does not equal output SINBDIVS, in=%d, out=%d\n", sinbdivs, sinbdivsout);
00271 drms_close_records(inrecset, DRMS_FREE_RECORD);
00272 return 1;
00273 }
00274
00275 inkeytest = hcon_lookup_lower(&inrec->keywords, "APINNER");
00276 if (inkeytest != NULL)
00277 apinner=drms_getkey_float(inrec, "APINNER", &status);
00278 if (apinnerout != 0.0 && (int)(10000*apinnerout) != (int)(10000*apinner))
00279 {
00280 fprintf(stderr, "ERROR: input APINNER does not equal output APINNER, in=%f, out=%f\n", apinner, apinnerout);
00281 drms_close_records(inrecset, DRMS_FREE_RECORD);
00282 return 1;
00283 }
00284
00285 inkeytest = hcon_lookup_lower(&inrec->keywords, "APWIDTH");
00286 if (inkeytest != NULL)
00287 apwidth=drms_getkey_float(inrec, "APWIDTH", &status);
00288 if (apinnerout != 0.0 && (int)(10000*apwidthout) != (int)(10000*apwidth))
00289 {
00290 fprintf(stderr, "ERROR: input APWIDTH does not equal output APWIDTH, in=%f, out=%f\n", apwidth, apwidth);
00291 drms_close_records(inrecset, DRMS_FREE_RECORD);
00292 return 1;
00293 }
00294
00295
00296 status=drms_stage_records(inrecset, 1, 0);
00297 if (status != DRMS_SUCCESS)
00298 {
00299 fprintf(stderr, "ERROR: drms_stage_records returned status = %d\n", status);
00300 return 1;
00301 }
00302
00303 skip1:
00304
00305 nrecords=0;
00306 nsegments=0;
00307 nskip=0;
00308
00309 lchunkfirst = lmin/lchunksize;
00310 lchunklast = lmax/lchunksize;
00311
00312 nlchunks = (lchunklast - lchunkfirst) + 1;
00313 nrecsout = nlchunks*ntimechunks;
00314 outrecset = drms_create_records(drms_env, nrecsout, outseries, lifetime, &status);
00315 if (status != DRMS_SUCCESS || outrecset == NULL)
00316 {
00317 fprintf(stderr,"ERROR: unable to create records record in output dataseries %s, status = %d\n", outseries, status);
00318 drms_close_records(inrecset, DRMS_FREE_RECORD);
00319 return 1;
00320 }
00321
00322 unsigned long long calversout, calvers;
00323 int calversunset=1;
00324 int mixflag=0;
00325 unsigned int nybblearrout[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
00326 int fixflagarr[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
00327 for (i=0;i<16;i++)
00328 {
00329 if (getbits(calverkey,i,1))
00330 fixflagarr[i]=1;
00331 }
00332
00333
00334 irecout=0;
00335 for (iset=0; iset < ntimechunks; iset++)
00336 {
00337 tstartout=tstart + iset * chunksecs;
00338 tstopout=tstartout+chunksecs;
00339 sprint_time(tstartstr, tstartout, "TAI", 0);
00340
00341 if (verbflag)
00342 {
00343 wt1=getwalltime();
00344 ct1=getcputime(&ut1, &st1);
00345 printf("processing timechunk %d, tstart = %s\n", iset, tstartstr);
00346 }
00347
00348 for (lchunk = lchunkfirst; lchunk <= lchunklast; lchunk++)
00349 {
00350 lminout = lchunk * lchunksize;
00351 lmaxout = lminout + lchunksize - 1;
00352 lminout = MAXIMUM(lminout,lmin);
00353 lmaxout = MINIMUM(lmaxout,lmax);
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 outrec = outrecset->records[irecout++];
00366 if (histlink != NULL)
00367 drms_setlink_static(outrec, histlinkname, histrecnum);
00368
00369 if (verbflag > 1)
00370 {
00371 wt2=getwalltime();
00372 ct2=getcputime(&ut2, &st2);
00373 printf(" processing lchunk %d, min = %d, max = %d\n", lchunk-lchunkfirst, lminout, lmaxout);
00374 }
00375
00376 if (noinput)
00377 {
00378 goto skip2;
00379 }
00380
00381 if (segoutflag)
00382 segout = drms_segment_lookup(outrec, segnameout);
00383 else
00384 segout = drms_segment_lookupnum(outrec, 0);
00385
00386 length[0]=2*ndt;
00387 length[1]=lmaxout*(lmaxout+1)/2+lmaxout - lminout*(lminout+1)/2 + 1;
00388 arrptr=(float *)(calloc(length[0]*length[1],sizeof(float)));
00389 outarr = drms_array_create(usetype, 2, length, arrptr, &status);
00390 if (status != DRMS_SUCCESS || outarr == NULL || segout == NULL)
00391 {
00392 fprintf(stderr,"ERROR: problem creating output array or segment: length = [%d, %d], status = %d, histrecnum = %lld", length[0], length[1], status, histrecnum);
00393 drms_close_records(inrecset, DRMS_FREE_RECORD);
00394 drms_close_records(outrecset, DRMS_FREE_RECORD);
00395 return 0;
00396 }
00397 outptr = (float *)(outarr->data);
00398
00399 nskip=0;
00400 mixflag=0;
00401 calversunset=1;
00402 for (irecin=0; irecin < nrecsin; irecin++)
00403 {
00404 inrec = inrecset->records[irecin];
00405 quality=drms_getkey_int(inrec, "QUALITY", &status);
00406 if (status != DRMS_SUCCESS || (quality & QUAL_NODATA))
00407 {
00408 if (verbflag>2) printf("SKIP: input data not used due to quality, irecin = %d, status = %d, quality = %08x\n", irecin, status, quality);
00409 nskip++;
00410 continue;
00411 }
00412
00413 tstartin=drms_getkey_time(inrec, "T_START", &status);
00414 tstopin=drms_getkey_time(inrec, "T_STOP", &status);
00415 lminin=drms_getkey_int(inrec, "LMIN", &status);
00416 lmaxin=drms_getkey_int(inrec, "LMAX", &status);
00417 tstepin=tstopin-tstartin;
00418
00419 if (tstartin >= tstopout || tstopin <= tstartout || lminin > lmaxout || lmaxin < lminout)
00420 {
00421 nskip++;
00422 continue;
00423 }
00424
00425 if (calversunset)
00426 {
00427 calversout=drms_getkey_longlong(inrec, "CALVER64", &status);
00428 if (status != DRMS_SUCCESS)
00429 calversout = 0;
00430 calversunset=0;
00431 for (i=0;i<16;i++)
00432 nybblearrout[i]=getbits(calversout,4*i+3,4);
00433 }
00434
00435 calvers=drms_getkey_longlong(inrec, "CALVER64", &status);
00436 if (status != DRMS_SUCCESS)
00437 calvers = 0;
00438
00439 for (i=0;i<16;i++)
00440 {
00441 int nybble=getbits(calvers,4*i+3,4);
00442 if (fixflagarr[i])
00443 {
00444 if (nybble != nybblearrout[i])
00445 {
00446 fprintf(stderr, "ERROR: input data has mixed values for field %d of CALVER64: %d and %d, recnum = %lld, histrecnum = %lld\n", i, nybblearrout[i], nybble, inrec->recnum, histrecnum);
00447 return 0;
00448 }
00449 }
00450 else
00451 {
00452 if (nybble < nybblearrout[i])
00453 nybblearrout[i]=nybble;
00454 }
00455 }
00456
00457 if (!mixflag && (quality & QUAL_MIXEDCALVER || calvers != calversout))
00458 mixflag=1;
00459
00460 tstartuse=MAXIMUM(tstartout, tstartin);
00461 tstopuse= MINIMUM(tstopout, tstopin);
00462 lminuse=MAXIMUM(lminout, lminin);
00463 lmaxuse=MINIMUM(lmaxout, lmaxin);
00464 nmodes=MODES(lmaxuse+1)-MODES(lminuse);
00465 npts=(tstopuse - tstartuse)/cadence;
00466
00467 out_time_offset = (tstartuse - tstartout)/cadence;
00468 out_modes_offset = MODES(lminuse) - MODES(lminout);
00469 out_offset = 2 * (out_modes_offset * ndt + out_time_offset);
00470 in_time_offset = (tstartuse - tstartin)/cadence;
00471 in_modes_offset = MODES(lminuse) - MODES(lminin);
00472 in_offset = 0;
00473 startind[0]=2*in_time_offset;
00474 startind[1]=in_modes_offset;
00475 endind[0]=2*(in_time_offset + npts) - 1;
00476 endind[1]=in_modes_offset + nmodes - 1;
00477
00478 if (seginflag)
00479 segin = drms_segment_lookup(inrec, segnamein);
00480 else
00481 segin = drms_segment_lookupnum(inrec, 0);
00482 if (segin != NULL)
00483
00484 inarr = drms_segment_readslice(segin, usetype, startind, endind, &status);
00485 if (status != DRMS_SUCCESS || inarr == NULL || segin == NULL)
00486 {
00487 fprintf(stderr, "ERROR: problem reading input segment: tstart = %f, lmin = %d, lmax = %d, irecin = %d, status = %d, histrecnum = %lld\n", tstartin, lminin, lmaxin, irecin, status, histrecnum);
00488 drms_close_records(inrecset, DRMS_FREE_RECORD);
00489 drms_close_records(outrecset, DRMS_FREE_RECORD);
00490 return 0;
00491 }
00492 else
00493 {
00494 inptr=(float *)(inarr->data);
00495 }
00496
00497 for (imode=0; imode<nmodes; imode++)
00498 {
00499 for (itime=0; itime<npts; itime++)
00500 {
00501 in_index=in_offset + 2*itime;
00502 out_index=out_offset + 2*itime;
00503 outptr[out_index] = inptr[in_index];
00504 outptr[out_index+1] = inptr[in_index+1];
00505 }
00506 out_offset+=2*ndt;
00507 in_offset+=2*npts;
00508 }
00509
00510 drms_free_array(inarr);
00511 }
00512
00513
00514 if (nskip == nrecsin)
00515 {
00516 fprintf(stderr, "WARNING: no inputs for this output, no segment written\n");
00517 }
00518 else
00519 {
00520 outarr->bzero=segout->bzero;
00521 outarr->bscale=segout->bscale;
00522 status=drms_segment_write(segout, outarr, 0);
00523 nsegments++;
00524 if (status != DRMS_SUCCESS)
00525 {
00526 fprintf(stderr, "ERROR: problem writing output segment: status = %d, T_START = %s, LMIN = %d, LMAX = %d, histrecnum = %lld\n", status, tstartstr, lminout, lmaxout, histrecnum);
00527 drms_close_records(inrecset, DRMS_FREE_RECORD);
00528 drms_close_records(outrecset, DRMS_FREE_RECORD);
00529 return 0;
00530 }
00531 }
00532 drms_free_array(outarr);
00533
00534 drms_copykeys(outrec, inrec, 0, kDRMS_KeyClass_Explicit);
00535
00536 skip2:
00537
00538 drms_setkey_int(outrec, "LMIN", lminout);
00539 drms_setkey_int(outrec, "LMAX", lmaxout);
00540 drms_setkey_time(outrec, "T_START", tstartout);
00541 drms_setkey_time(outrec, "T_STOP", tstopout);
00542 drms_setkey_time(outrec, "T_OBS", tstartout+chunksecs/2);
00543 drms_setkey_int(outrec, "NDT", ndt);
00544
00545 for (i=0;i<16;i++)
00546 calversout=setbits(calversout,4*i+3,4,nybblearrout[i]);
00547 drms_setkey_longlong(outrec, "CALVER64", calversout);
00548
00549 if (noinput || nskip == nrecsin)
00550 drms_setkey_int(outrec, "QUALITY", QUAL_NODATA);
00551 else if (mixflag)
00552 drms_setkey_int(outrec, "QUALITY", QUAL_MIXEDCALVER);
00553 else
00554 drms_setkey_int(outrec, "QUALITY", 0);
00555
00556 tnow = (double)time(NULL);
00557 tnow += UNIX_epoch;
00558 drms_setkey_time(outrec, "DATE", tnow);
00559
00560
00561 nrecords++;
00562
00563 if (verbflag > 1)
00564 {
00565 wt=getwalltime();
00566 ct=getcputime(&ut, &st);
00567 fprintf(stdout, " lchunk %d done: %.2f ms wall time, %.2f ms cpu time\n", lchunk-lchunkfirst,
00568 wt-wt2,
00569 ct-ct2);
00570 }
00571
00572 }
00573
00574 if (verbflag)
00575 {
00576 wt=getwalltime();
00577 ct=getcputime(&ut, &st);
00578 fprintf(stdout, "timechunk %d done: %.2f ms wall time, %.2f ms cpu time\n", iset,
00579 wt-wt1,
00580 ct-ct1);
00581
00582 }
00583
00584 }
00585
00586 drms_close_records(inrecset, DRMS_FREE_RECORD);
00587 drms_close_records(outrecset, DRMS_INSERT_RECORD);
00588
00589 wt=getwalltime();
00590 ct=getcputime(&ut, &st);
00591 if (verbflag)
00592 {
00593 printf("number of records created = %d\n", nrecords);
00594 printf("number of segments created = %d\n", nsegments);
00595 fprintf(stdout, "total time spent: %.2f ms wall time, %.2f ms cpu time\n",
00596 wt-wt0, ct-ct0);
00597 }
00598
00599 printf("module %s successful completion\n", cmdparams.argv[0]);
00600
00601 return 0;
00602
00603 }