/* * Copyright © 1998 Spizella Software * All rights reserved. * * Programmer: Robb Matzke * Tuesday, August 25, 1998 */ /* See H5private.h for how to include headers */ #undef NDEBUG #include #include /*for performance monitoring*/ #ifdef STDC_HEADERS # include #endif #define NOTIFY_INTERVAL 2 /*seconds*/ #define TIME_LIMIT 60 /*seconds*/ #define CH_SIZE 8192*8 /*approx chunk size in bytes*/ #define MAX_NELMTS 3000000 #define C_MTYPE unsigned int /*type in memory */ #define H_MTYPE H5T_NATIVE_UINT /*type in memory */ #define H_FTYPE H5T_NATIVE_UINT /*type in file */ typedef struct { double percent; size_t lo, hi; size_t nhits; } quant_t; #if 1 /* Typical VBT sizes */ static quant_t quant_g[] = { {10.00, 1, 5}, {89.00, 6, 20}, { 0.90, 21, 100}, { 0.09, 101, 1000}, { 0.01, 1001, 10000}, }; #elif 0 /* Sizes for testing */ static quant_t quant_g[] = { {10.0, 1, 5}, {80.0, 6, 15}, {10.0, 16, 20}, }; #elif 0 /* Larger I/O */ static quant_t quant_g[] = { {10.0, 1, 1000}, {80.0, 1001, 5000}, {10.0, 5001, 10000}, }; #else /* All same size */ static quant_t quant_g[] = { {100.0, 1000, 1000} }; #endif static volatile sig_atomic_t alarm_g = 0; static volatile sig_atomic_t timeout_g = 0; /*------------------------------------------------------------------------- * Function: catch_alarm * * Purpose: Increments the global `alarm_g' and resets the alarm for * another few seconds. * * Return: void * * Programmer: Robb Matzke * Wednesday, August 26, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static void catch_alarm(int UNUSED signum) { static int ncalls=0; ncalls++; if (0==ncalls % NOTIFY_INTERVAL) { alarm_g++; } if (timeout_g>0) --timeout_g; alarm(1); } /*------------------------------------------------------------------------- * Function: display_error_cb * * Purpose: Displays the error stack after printing "*FAILED*". * * Return: Success: 0 * * Failure: -1 * * Programmer: Robb Matzke * Wednesday, March 4, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static herr_t display_error_cb (void UNUSED *client_data) { putchar('\n'); H5Eprint (stdout); return 0; } /*------------------------------------------------------------------------- * Function: rand_nelmts * * Purpose: Returns a the length of a 1-d array according to the * probabilities described above. * * Return: Success: Number of elements * * Failure: never fails * * Programmer: Robb Matzke * Thursday, August 20, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static size_t rand_nelmts(int reset_counters) { double p = (rand() % 1000000)/1000000.0; double total = 0.0; size_t size=0, i; static size_t ncalls=0; if (reset_counters) { printf(" %9s %8s %8s\n", "Length", "Requsted", "Actual"); printf(" --------------- -------- --------\n"); for (i=0; i0; row+=i) { for (i=0; i0; row+=i) { /* Clear data then read */ HDmemset(size, 0, rows_at_once*sizeof(*size)); HDmemset(buf, 0, rows_at_once*sizeof(*buf)); if (H5RAread(ra, row, rows_at_once, H_MTYPE, size, (void**)buf)<0) { goto error; } /* Check values read */ for (i=0; i0; row+=i) { /* Read data */ for (i=0; i