Skip to content

Commit

Permalink
working with timing
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Feb 20, 2019
1 parent cc35519 commit 6ba8a3c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/cunit/test_perf1.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ int test_perf1(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank,
int wrong_varid = TEST_VAL_42; /* A wrong ID. */
int ret; /* Return code. */
PIO_Offset arraylen = 16;
struct timeval starttime, endtime;
long long startt, endt;
long long delta;
void *fillvalue;
void *test_data;
void *test_data_in;
Expand Down Expand Up @@ -229,6 +232,9 @@ int test_perf1(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank,
ERR(ret);
}

/* Start the clock. */
gettimeofday(&starttime, NULL);

for (int t = 0; t < NUM_TIMESTEPS; t++)
{

Expand Down Expand Up @@ -265,6 +271,15 @@ int test_perf1(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank,
if ((ret = PIOc_closefile(ncid)))
ERR(ret);

/* Stop the clock. */
gettimeofday(&endtime, NULL);

/* Compute the time delta */
startt = (1000000 * starttime.tv_sec) + starttime.tv_usec;
endt = (1000000 * endtime.tv_sec) + endtime.tv_usec;
delta = endt - startt;
printf("time: %lld\n", delta);

/* Reopen the file. */
if ((ret = PIOc_openfile(iosysid, &ncid2, &flavor[fmt], filename, PIO_NOWRITE)))
ERR(ret);
Expand Down

0 comments on commit 6ba8a3c

Please sign in to comment.