示例#1
0
// Dump an object
void dump_object(sqlite3* db, long long oid)
{
	printf("dump object id=%lld\n", oid);
	dump_booleans(db, oid);
	dump_integers(db, oid);
	dump_binaries(db, oid);
	dump_arrays(db, oid);
}
示例#2
0
文件: mttest.c 项目: dhaley/dcp
int
locktest()
{
	int	i;
	Workblk *array;
	struct scripttab	*k;
	hrtime_t	start;
	hrtime_t	vstart;
	hrtime_t	end;
	hrtime_t	vend;
	struct timeval	ttime;
	time_t		secs;

	head.size   = narrays;
	head.arrays = (Workblk *) calloc(narrays, sizeof(Workblk));

	for(i = 0, array = head.arrays; i < narrays; i ++, array ++) {
		array->index = i;
	}

	printf( "%s: number of %s = %d, number of blocks = %d, repeat %d times %s\n",
		name, model, nthreads, narrays, repeat_count,
		(uniprocessor == 0 ? "" : "[single CPU]") );

#ifdef SOLARIS
	tid = (thread_t *) calloc(nthreads*repeat_count, sizeof(thread_t));
#endif
#ifdef POSIX
	tid = (pthread_t *) calloc(nthreads*repeat_count, sizeof(pthread_t));
#endif
	for(count = 0; count < repeat_count; count ++) {
	    (void) gettimeofday(&ttime, NULL);
	    secs = (time_t)ttime.tv_sec;
	    printf("Iteration %d, starting %s\n",
		count+1,
		prtime (&secs) );
	    if(job_index == -1) {
	        for (i = 0; ; i++) {
		    k = &scripttab[i];
		    if (k->test_name == NULL) {
			break;
		    }

		    printf("begin thread_work, %s\n", k->test_name);

		    init_arrays(i);

		    start = gethrtime();
		    vstart = gethrvtime();

		    if( strcmp(k->test_name, "nothreads") == 0 ){
			/* the "nothreads" task is special-cased to run in the main thread */
			do_work(NULL);
		    } else if(nthreads == 1) {
			do_work(NULL);
		    } else {
			thread_work();
		    }

		    end = gethrtime();
		    vend = gethrvtime();
#if OS(Solaris)
		    check_sigmask(2);
#endif /* OS(Solaris) */
		    dump_arrays(end-start, vend-vstart, i);
	        }
	    } else {
		    k = &scripttab[job_index];
		    if (k->test_name == NULL) {
			break;
		    }

		    printf("begin thread_work, %s\n", k->test_name);

		    init_arrays(job_index);

		    start = gethrtime();
		    vstart = gethrvtime();

		    if( strcmp(k->test_name, "nothreads") == 0 ){
			/* first one is special-cased to run in 1 thread */
			do_work(NULL);
		    } else if(nthreads == 1) {
			do_work(NULL);
		    } else {
			thread_work();
		    }

		    end = gethrtime();
		    vend = gethrvtime();
#if OS(Solaris)
		    check_sigmask(2);
#endif /* OS(Solaris) */
		    dump_arrays(end-start, vend-vstart, job_index);
	     }
	}

	/* we're done, return */
	return(0);
}