FreeBSD/sys/kern/subr_devstat.c
/*
 * Record a transaction start.
 *
 * See comments for devstat_end_transaction().  Ordering is very important
 * here.
 */
Record a transaction start.
See comments for devstat_end_transaction().  Ordering is very important
here.
Record a transaction start . See comments for devstat_end_transaction () . Ordering is very important here .
void
devstat_start_transaction(struct devstat *ds, struct bintime *now)
{
	mtx_assert(&devstat_mutex, MA_NOTOWNED);
	if (ds == NULL)
		return;
	atomic_add_acq_int(&ds->sequence1, 1);
	if (ds->start_count == ds->end_count) {
		if (now != NULL)
			ds->busy_from = *now;
		else
			binuptime(&ds->busy_from);
	}
	ds->start_count++;
	atomic_add_rel_int(&ds->sequence0, 1);
	DTRACE_DEVSTAT_START();
}
void devstat_start_transaction ( struct devstat * ds , struct bintime * now ) { mtx_assert ( & devstat_mutex , MA_NOTOWNED ) ; if ( ds == NULL ) return ; atomic_add_acq_int ( & ds -> sequence1 , 1 ) ; if ( ds -> start_count == ds -> end_count ) { if ( now != NULL ) ds -> busy_from = * now ; else binuptime ( & ds -> busy_from ) ; } ds -> start_count ++ ; atomic_add_rel_int ( & ds -> sequence0 , 1 ) ; DTRACE_DEVSTAT_START ( ) ; }
Record a transaction start.
Record a transaction start .
/* sanity check */ /*
	 * We only want to set the start time when we are going from idle
	 * to busy.  The start time is really the start of the latest busy
	 * period.
	 */