Esempio n. 1
0
File: time.c Progetto: goovdl/akaros
uint64_t tsc2msec(uint64_t tsc_time)
{
	if (mult_will_overflow_u64(tsc_time, 1000))
		return tsc2sec(tsc_time) * 1000;
	else 
		return (tsc_time * 1000) / system_timing.tsc_freq;
}
Esempio n. 2
0
File: time.c Progetto: goovdl/akaros
void tsc2timespec(uint64_t tsc_time, struct timespec *ts)
{
	ts->tv_sec = tsc2sec(tsc_time);
	/* subtract off everything but the remainder */
	tsc_time -= sec2tsc(ts->tv_sec);
	ts->tv_nsec = tsc2nsec(tsc_time);
}
Esempio n. 3
0
uint64_t tsc2msec(uint64_t tsc_time)
{
	if (mult_will_overflow_u64(tsc_time, 1000))
		return tsc2sec(tsc_time) * 1000;
	else 
		return (tsc_time * 1000) / get_tsc_freq();
}
Esempio n. 4
0
/*
 * The time between reseed must be at least reseedInterval
 * microseconds.
 */
static int enough_time_passed(FState *st)
{
	int ok;
	int32_t now;
	int32_t last = st->lastReseedTime;

	now = tsc2sec(read_tsc());

	/* check how much time has passed */
	ok = 0;
	if (now - last >= reseedInterval)
		ok = 1;

	/* reseed will happen, update lastReseedTime */
	if (ok)
		st->lastReseedTime = now;

	return ok;
}
Esempio n. 5
0
File: time.c Progetto: goovdl/akaros
uint64_t epoch_sec(void)
{
	return tsc2sec(epoch_tsc());
}