From ccdeec64cf4652d1e7f8d880a08b4e02451aa7d0 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Wed, 27 Jul 2005 20:06:35 +0000 Subject: [PATCH] defect 785 ckptbenchth is completely broken. This patch fixes it to operate properly. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@778 fd59a12c-fef9-0310-b244-a6a79926bd2f --- test/ckptbenchth.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/test/ckptbenchth.c b/test/ckptbenchth.c index 5290ebbb..cf510173 100644 --- a/test/ckptbenchth.c +++ b/test/ckptbenchth.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "ais_types.h" #include "saCkpt.h" @@ -65,12 +66,12 @@ SaCkptCallbacksT callbacks = { }; SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = { - SA_CKPT_WR_ALL_REPLICAS, - 100000, - 0, - 5, - 20000, - 10 + .creationFlags = SA_CKPT_WR_ALL_REPLICAS, + .checkpointSize = 100000, + .retentionDuration = 0, + .maxSections = 5, + .maxSectionSize = 150000, + .maxSectionIdSize = 10 }; SaCkptSectionIdT sectionId1 = { @@ -186,12 +187,7 @@ void *benchmark_thread (void *arg) WriteVectorElements, 1, &erroroneousVectorIndex); - -// if (error == SA_ERR_TRY_AGAIN) { -// usleep (rand() % 500); -// } } while (error == SA_ERR_TRY_AGAIN); -printf ("done writing for thread %d\n", td->thread); if (error != SA_OK) { printf ("saCkptCheckpointWrite result %d (should be 1)\n", error); exit (1); @@ -257,26 +253,32 @@ int main (void) { for (i = 0; i < CHECKPOINT_THREADS; i++) { sprintf (checkpointName.value, "checkpoint%d \n", i); error = saCkptInitialize (&ckptHandles[i], &callbacks, &version); + assert (error == SA_AIS_OK); error = saCkptCheckpointOpen (ckptHandles[i], &checkpointName, &checkpointCreationAttributes, - SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE, - 0, + SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE, + SA_TIME_END, &checkpointHandles[i]); + assert (error == SA_AIS_OK); + error = saCkptSectionCreate (checkpointHandles[i], §ionCreationAttributes1, "Initial Data #0", strlen ("Initial Data #0") + 1); + assert (error == SA_AIS_OK); + error = saCkptSectionCreate (checkpointHandles[i], §ionCreationAttributes2, "Initial Data #0", strlen ("Initial Data #0") + 1); + assert (error == SA_AIS_OK); } - for (i = CHECKPOINT_THREADS-50; i < CHECKPOINT_THREADS; i++) { /* i threads */ - count = 3000; /* initial count */ - size = 100000; /* initial size */ + for (i = 1; i < CHECKPOINT_THREADS; i++) { /* i threads */ + count = 3000; /* initial write count */ + size = 10000; /* initial size */ printf ("THREADS %d\n", i); for (j = 0; j < 5; j++) { /* number of runs with i threads */ threaded_bench (ckptHandles, checkpointHandles, i, count, size); @@ -286,7 +288,7 @@ int main (void) { * This keeps the run times similiar */ count = (((float)count) * 0.95); - size += 1500; + size += 1000; } } return (0);