Exemple #1
0
/*-------------------------------------------------------------------------
 * Function:  main
 *
 * Purpose:
 *
 * Return:  Success:        zero
 *
 *    Failure:  non-zero
 *
 * Programmer:  Robb Matzke
 *              Monday, September 28, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
main(int argc, char *argv[])
{
    hid_t  xfer;
    fill_t  fill_style = FILL_ALL;
    hbool_t  use_cache = FALSE;
    double  splits[3];
    int    i, j, nerrors=0;

    /* Default split ratios */
    H5Eset_auto2(H5E_DEFAULT, display_error_cb, NULL);

    if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
    if(H5Pget_btree_ratios(xfer, splits+0, splits+1, splits+2) < 0) goto error;
    if(H5Pclose(xfer) < 0) goto error;

    /* Parse command-line options */
    for(i = 1, j = 0; i < argc; i++) {
        if (!strcmp(argv[i], "forward")) {
            fill_style = FILL_FORWARD;
        } else if (!strcmp(argv[i], "reverse")) {
            fill_style = FILL_REVERSE;
        } else if (!strcmp(argv[i], "inward")) {
            fill_style = FILL_INWARD;
        } else if (!strcmp(argv[i], "outward")) {
            fill_style = FILL_OUTWARD;
        } else if (!strcmp(argv[i], "random")) {
            fill_style = FILL_RANDOM;
        } else if (!strcmp(argv[i], "cache")) {
            use_cache = TRUE;
        } else if (j<3 && (isdigit(argv[i][0]) || '.'==argv[i][0])) {
            splits[j++] = strtod(argv[i], NULL);
        } else {
            usage(argv[0]);
        }
    }

    if (FILL_ALL==fill_style) {
        printf("%-7s %8s\n", "Style", "Bytes/Chunk");
        printf("%-7s %8s\n", "-----", "-----------");
        nerrors += test(FILL_FORWARD, splits, FALSE, use_cache);
        nerrors += test(FILL_REVERSE, splits, FALSE, use_cache);
        nerrors += test(FILL_INWARD,  splits, FALSE, use_cache);
        nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache);
        nerrors += test(FILL_RANDOM,  splits, FALSE, use_cache);
    } 
    else {
        if (use_cache) usage(argv[0]);
        nerrors += test(fill_style,   splits, TRUE, FALSE);
    }
    if (nerrors>0) goto error;
    cleanup();
    return 0;

 error:
    fprintf(stderr, "*** ERRORS DETECTED ***\n");
    return 1;
}
Exemple #2
0
//--------------------------------------------------------------------------
// Function:	DSetMemXferPropList::getBtreeRatios
///\brief	Gets B-tree split ratios for a dataset transfer property list.
///\param	left   - OUT: B-tree split ratio for left-most nodes
///\param	middle - OUT: B-tree split ratio for right-most nodes and lone nodes
///\param	right  - OUT: B-tree split ratio for all other nodes
///\exception	H5::PropListIException
// Programmer:	Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& right ) const
{
   herr_t ret_value = H5Pget_btree_ratios( id, &left, &middle, &right );
   if( ret_value < 0 )
   {
      throw PropListIException("DSetMemXferPropList::getBtreeRatios",
		"H5Pget_btree_ratios failed");
   }
}