コード例 #1
0
ファイル: sphlflogger_tt.c プロジェクト: ThinkOpenly/sphde
int
lflogentry_stridetest (SPHLFLogger_t log, int val1, int val2, int val3)
{
	SPHLFLoggerHandle_t *handle, handle0;
	int	*array;

	handle = SPHLFLoggerAllocStrideTimeStamped (log,
                             123, 76,
                             &handle0);
	if (handle)
	{
	    array  = (int*)SPHLFLogEntryGetFreePtr(handle);
	    array[0] = val1;
	    array[1] = val2;
	    array[2] = val3;
	    SPHLFLogEntryWeakComplete(&handle0);
	} else {
	    return -1;
	}

	return 0;
}
コード例 #2
0
ファイル: sphlogportal.cpp プロジェクト: ktangwon/sphde
SPHLFLoggerHandle_t*
SPHLogPortalAllocStrideTimeStamped (SPHLogPortal_t portal,
                             int catcode, int subcode,
                             SPHLFLoggerHandle_t *handleorg)
{
	SASLogPortalHeader	*headerBlock = (SASLogPortalHeader*)portal;
	SPHLFLogger_t log;
	longPtr_t log_index;
	SPHLFLoggerHandle_t *result = NULL;

	if (SOMSASCheckBlockSigAndType ((SASBlockHeader*)headerBlock,
			SAS_RUNTIME_LOGPORTAL) )
	{
		if ( headerBlock->next_free > headerBlock->current_logger )
		{
			log_index = headerBlock->current_logger;
			log = headerBlock->log_buff_list[log_index];
#ifdef __SASDebugPrint__
			sas_printf("SPHLogPortalAllocStrideTimeStamped(%p) next=%ld, current=%ld\n",  portal,
					headerBlock->next_free, headerBlock->current_logger);
#endif
			result = SPHLFLoggerAllocStrideTimeStamped (log, catcode, subcode, handleorg);
			if (!result && SPHLFLoggerFull(log) && ((log_index+1) < headerBlock->next_free))
			{
				bool done = 0;
				/* The Logger entry allocation failed and we verified
				 * that the current Logger was Full so we also check of
				 * the next Logger entry is allocated. If this is all
				 * true, we want exactly one thread to bump the current
				 * pointer to the next list entry. */

				done = __sync_bool_compare_and_swap (&headerBlock->current_logger,
						                             log_index,
	                                                 (log_index+1));
				if (done)
				{
					/* The current logger was successfully adjusted by
					 * this thread. So retry directly with the next
					 * logger entry. */
					log = headerBlock->log_buff_list[log_index+1];
					result = SPHLFLoggerAllocStrideTimeStamped (log, catcode, subcode, handleorg);
				}

				if (!result)
				{
					/* Either The current thread lost the race to
					 * update current or the next logger is full too.
					 * Safest to return recursively rechecking all the
					 * boundaries. */
					sas_read_barrier();
					result = SPHLogPortalAllocStrideTimeStamped (portal,
							catcode, subcode, handleorg);
				}
			}
		}
#ifdef __SASDebugPrint__
	} else {
		sas_printf("SPHLogPortalAllocStrideTimeStamped(%p,%d,%d,%p) type check failed\n",
				portal, catcode, subcode, handleorg);
#endif
	}
	return result;
}
コード例 #3
0
ファイル: sphlflogger_tt.c プロジェクト: ThinkOpenly/sphde
int
test_unit (void)
{
	SPHLFLogger_t logger;
	SPHLFLoggerHandle_t *handle, handle0;
	sphtimer_t	tempt, startt, endt, freqt;
	unsigned int i, tempn_i, temp0_i, temp1_i, temp2_i;
	int rc, rtn = 0;
	int	*tarray;
	double clock, nano, rate;
	block_size_t cap, units, p10, log_alloc;
	SPHLFLoggerHandle_t *handlex, handle4, handle5;
	sphtimer_t entry_timestamp, prev_timestamp;
	SPHLFLogIterator_t *iter, iter0;
		
	log_alloc = SegmentSize;
	
	logger = SPHLFLoggerCreate (log_alloc);
	if ( logger )
	{
		printf("\nSPHLFLoggerCreate (%zu) success \n", log_alloc);

		cap = SPHLFLoggerFreeSpace( logger );
			
		units = cap / 128;
			
		printf("SPHLFLoggerFreeSpace() = %zu units=%zu\n",
			cap, units);

		for ( i = 0; i < units; i++ )
		{
			rc = lflogentry_test (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n", 
					logger);
				break;
			}
		}
#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			SPHLFLoggerFreeSpace( logger ));

		printf("\ntest_unit() verify log contents\n");
		iter = SPHLFLoggerCreateIterator(logger, &iter0);
		if (iter)
		{
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p succeeded\n",
				   logger, &iter0, iter);
		} else {
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p failed\n",
				   logger, &iter0, iter);
			return (rtn + 10);
		}

		handlex = SPHLFLoggerIteratorNext (iter, &handle4);
		printf("   SPHLFLoggerIteratorNext() [%p,%lx,%lx,%lx,%lx]\n",
			   iter->logger, iter->current, iter->free, iter->start_log, iter->end_log);
		if (handlex)
		{
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p succeeded\n",
				   logger, &handle4, handlex);
			printf("   @%p->id=%x\n",
				   handlex->entry, handlex->entry->entryID.idUnit);
			
			entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
			temp0_i = SPHLFlogEntryGetNextInt(handlex);
			temp1_i = SPHLFlogEntryGetNextInt(handlex);
			temp2_i = SPHLFlogEntryGetNextInt(handlex);
			if ((temp0_i != 0)
			  ||  (temp1_i != 0x12345678)
			  ||  (temp2_i != 0xdeadbeef))
			{
				printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x\n",
					   temp0_i, temp1_i, temp2_i);
				rtn++;
			}
		} else {
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p failed\n",
				   logger, &handle4, handlex);
			return (rtn + 10);
		}
		
		while (handlex)
		{
			tempn_i = temp0_i;
			prev_timestamp = entry_timestamp;
			handlex = SPHLFLoggerIteratorNext (iter, &handle5);
			if (handlex)
			{
				temp0_i = SPHLFlogEntryGetNextInt(handlex);
				temp1_i = SPHLFlogEntryGetNextInt(handlex);
				temp2_i = SPHLFlogEntryGetNextInt(handlex);
				entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
				if ((temp0_i != (tempn_i+1))
				 ||  (temp1_i != 0x12345678)
				 ||  (temp2_i != 0xdeadbeef)
				 ||  (entry_timestamp < prev_timestamp))
				{
					printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x, %llu,%llu\n",
						   temp0_i, temp1_i, temp2_i,
						   prev_timestamp, entry_timestamp);
					rtn++;
				}
			}
		}
		
		printf("test_unit() verify log complete\n\n");
#endif /* SPH_TIMERTEST_VERIFY */
		SPHLFLoggerResetAsync (logger);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;
			
		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_test (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n", 
					logger);
				break;
			}
		}
			
		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);
			
		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_test X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);


#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);


#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */
					
		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;
			
		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fasttest (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n", 
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);
			
		printf ("lflogentry_fasttest X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);
		SPHLFLoggerSetCachePrefetch(logger, 1);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fasttest (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_fasttest prefetch0 X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);
		SPHLFLoggerSetCachePrefetch(logger, 2);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fasttest (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_fasttest prefetch1 X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fastteststrong (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_fastteststrong X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fasttestweak (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_fasttestweak X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 10000000;
		while (p10 > units)
			p10 = p10 / 10;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_fasttestnolockweak (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocTimeStamped (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = p10 / (clock / (double)freqt);

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);

		printf ("lflogentry_fasttestnolockweak X %zu ave= %6.2fns rate=%10.1f/s\n",
			p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		printf("\nSPHLFLoggerDestroy (%p) \n", logger);
		SPHLFLoggerDestroy( logger );
	} else
		printf("SPHLFLoggerCreate (%zu) failed \n", log_alloc);

	logger = SPHLFCircularLoggerCreate (log_alloc, 128);
	if ( logger )
	{
		printf("\nSPHLFCirgularLoggerCreate (%zu) success \n", log_alloc);

		rc += SPHLFLoggerPrefetch(logger);
		
		cap = SPHLFLoggerFreeSpace( logger );
		units = cap / 128;
		
		printf("SPHLFLoggerFreeSpace() = %zu, units=%zu\n",
		       cap, units);

		for ( i = 0; i < units; i++ )
		{
			handle = SPHLFLoggerAllocStrideTimeStamped (logger,
								0, 0,
								&handle0);
			if ( handle )
			{
			} else {
				printf("SPHLFLoggerAllocStrideTimeStamped (%p) failed\n", 
					logger);
			}
		}

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */
					
		p10 = 100000000;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_stridetest (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocStrideTimeStamped (%p) failed\n", 
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = 1000000000.0 / nano;

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);
		printf ("lflogentry_stridetest X %zu ave= %6.2fns rate=%10.1f/s\n",
				p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("\ntest_unit() verify log contents\n");
		iter = SPHLFLoggerCreateIterator(logger, &iter0);
		if (iter)
		{
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p succeeded\n",
				   logger, &iter0, iter);
		} else {
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p failed\n",
				   logger, &iter0, iter);
			return (rtn + 10);
		}

		handlex = SPHLFLoggerIteratorNext (iter, &handle4);
		printf("   SPHLFLoggerIteratorNext() [%p,%lx,%lx,%lx,%lx]\n",
			   iter->logger, iter->current, iter->free, iter->start_log, iter->end_log);
		if (handlex)
		{
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p succeeded\n",
				   logger, &handle4, handlex);
			printf("   @%p->id=%x\n",
				   handlex->entry, handlex->entry->entryID.idUnit);
			
			entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
			tarray = (int*)SPHLFLogEntryGetFreePtr(handlex);
			temp0_i = tarray[0];
			temp1_i = tarray[1];
			temp2_i = tarray[2];
			if ((temp1_i != 0x12345678)
			  ||  (temp2_i != 0xdeadbeef))
			{
				printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x\n",
					   temp0_i, temp1_i, temp2_i);
				rtn++;
			}
		} else {
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p failed\n",
				   logger, &handle4, handlex);
			return (rtn + 10);
		}
		
		while (handlex)
		{
			tempn_i = temp0_i;
			prev_timestamp = entry_timestamp;
			handlex = SPHLFLoggerIteratorNext (iter, &handle5);
			if (handlex)
			{
				temp0_i = SPHLFlogEntryGetNextInt(handlex);
				temp1_i = SPHLFlogEntryGetNextInt(handlex);
				temp2_i = SPHLFlogEntryGetNextInt(handlex);
				entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
				if ((temp0_i != (tempn_i+1))
				 ||  (temp1_i != 0x12345678)
				 ||  (temp2_i != 0xdeadbeef)
				 ||  (entry_timestamp < prev_timestamp))
				{
					printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x, %llu,%llu\n",
						   temp0_i, temp1_i, temp2_i,
						   prev_timestamp, entry_timestamp);
					rtn++;
				}
			}
		}
		
		printf("test_unit() verify log complete\n\n");
			
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		SPHLFLoggerResetAsync (logger);

#ifdef SPH_TIMERTEST_VERIFY
		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */

		p10 = 100000000;

		startt = sphgettimer();
		for ( i = 0; i < p10; i++ )
		{
			rc = lflogentry_stridetestnolock (logger, i, 0x12345678, 0xdeadbeef);
			if ( !rc )
			{
			} else {
				printf("SPHLFLoggerAllocStrideTimeStampedNoLock (%p) failed\n",
					logger);
				break;
			}
		}

		endt = sphgettimer();
		tempt = endt -startt;
		clock = tempt;
		freqt = sphfastcpufreq();
		nano = (clock * 1000000000.0) / (double)freqt;
		nano = nano / p10;
		rate = 1000000000.0 / nano;

		printf ("\nstartt=%lld, endt=%lld, deltat=%lld, freqt=%lld\n",
			startt, endt, tempt, freqt);
		printf ("lflogentry_stridetestnolock X %zu ave= %6.2fns rate=%10.1f/s\n",
				p10, nano, rate);

#ifdef SPH_TIMERTEST_VERIFY
		printf("\ntest_unit() verify log contents\n");
		iter = SPHLFLoggerCreateIterator(logger, &iter0);
		if (iter)
		{
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p succeeded\n",
				   logger, &iter0, iter);
		} else {
			printf("  SPHLFLoggerCreateIterator(%p,%p) = %p failed\n",
				   logger, &iter0, iter);
			return (rtn + 10);
		}

		handlex = SPHLFLoggerIteratorNext (iter, &handle4);
		printf("   SPHLFLoggerIteratorNext() [%p,%lx,%lx,%lx,%lx]\n",
			   iter->logger, iter->current, iter->free, iter->start_log, iter->end_log);
		if (handlex)
		{
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p succeeded\n",
				   logger, &handle4, handlex);
			printf("   @%p->id=%x\n",
				   handlex->entry, handlex->entry->entryID.idUnit);

			entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
			tarray = (int*)SPHLFLogEntryGetFreePtr(handlex);
			temp0_i = tarray[0];
			temp1_i = tarray[1];
			temp2_i = tarray[2];
			if ((temp1_i != 0x12345678)
			  ||  (temp2_i != 0xdeadbeef))
			{
				printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x\n",
					   temp0_i, temp1_i, temp2_i);
				rtn++;
			}
		} else {
			printf("  SPHLFLoggerIteratorNext(%p,%p) = %p failed\n",
				   logger, &handle4, handlex);
			return (rtn + 10);
		}

		while (handlex)
		{
			tempn_i = temp0_i;
			prev_timestamp = entry_timestamp;
			handlex = SPHLFLoggerIteratorNext (iter, &handle5);
			if (handlex)
			{
				temp0_i = SPHLFlogEntryGetNextInt(handlex);
				temp1_i = SPHLFlogEntryGetNextInt(handlex);
				temp2_i = SPHLFlogEntryGetNextInt(handlex);
				entry_timestamp = SPHLFLogEntryTimeStamp (handlex);
				if ((temp0_i != (tempn_i+1))
				 ||  (temp1_i != 0x12345678)
				 ||  (temp2_i != 0xdeadbeef)
				 ||  (entry_timestamp < prev_timestamp))
				{
					printf("  SPHLFLoggerIteratorNext() data mismatch found %d,%x,%x, %llu,%llu\n",
						   temp0_i, temp1_i, temp2_i,
						   prev_timestamp, entry_timestamp);
					rtn++;
				}
			}
		}

		printf("test_unit() verify log complete\n\n");

		printf("SPHLFLoggerFreeSpace() = %zu\n",
			   SPHLFLoggerFreeSpace( logger ));
#endif /* SPH_TIMERTEST_VERIFY */


		printf("\nSPHLFLoggerDestroy (%p) \n", logger);
		SPHLFLoggerDestroy( logger );
	} else
		printf("SPHLFLoggerCreate (%zu) failed \n", log_alloc);

	return rtn;
}