Esempio n. 1
0
	}
#elif JEMALLOC_CLOCK_GETTIME
	{
		struct timespec ts;

		if (sysconf(_SC_MONOTONIC_CLOCK) > 0)
			clock_gettime(CLOCK_MONOTONIC, &ts);
		else
			clock_gettime(CLOCK_REALTIME, &ts);
		time->ns = ts.tv_sec * BILLION + ts.tv_nsec;
	}
#else
	struct timeval tv;
	gettimeofday(&tv, NULL);
	time->ns = tv.tv_sec * BILLION + tv.tv_usec * 1000;
#endif

	/* Handle non-monotonic clocks. */
	if (unlikely(nstime_compare(&old_time, time) > 0)) {
		nstime_copy(time, &old_time);
		return (true);
	}

	return (false);
}
#ifdef JEMALLOC_JET
#undef nstime_update
#define	nstime_update JEMALLOC_N(nstime_update)
nstime_update_t *nstime_update = JEMALLOC_N(nstime_update_impl);
#endif
Esempio n. 2
0
huge_dalloc_junk(void *ptr, size_t usize)
{

	if (config_fill && have_dss && unlikely(opt_junk_free)) {
		/*
		 * Only bother junk filling if the chunk isn't about to be
		 * unmapped.
		 */
		if (!config_munmap || (have_dss && chunk_in_dss(ptr)))
			memset(ptr, 0x5a, usize);
	}
}
#ifdef JEMALLOC_JET
#undef huge_dalloc_junk
#define	huge_dalloc_junk JEMALLOC_N(huge_dalloc_junk)
huge_dalloc_junk_t *huge_dalloc_junk = JEMALLOC_N(huge_dalloc_junk_impl);
#endif

static void
huge_ralloc_no_move_similar(void *ptr, size_t oldsize, size_t usize_min,
    size_t usize_max, bool zero)
{
	size_t usize, usize_next;
	extent_node_t *node;
	arena_t *arena;
	chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
	bool pre_zeroed, post_zeroed;

	/* Increase usize to incorporate extra. */
	for (usize = usize_min; usize < usize_max && (usize_next = s2u(usize+1))
	    <= oldsize; usize = usize_next)
Esempio n. 3
0
	}
#elif JEMALLOC_CLOCK_GETTIME
	{
		struct timespec ts;

		if (sysconf(_SC_MONOTONIC_CLOCK) > 0)
			clock_gettime(CLOCK_MONOTONIC, &ts);
		else
			clock_gettime(CLOCK_REALTIME, &ts);
		time->ns = ts.tv_sec * BILLION + ts.tv_nsec;
	}
#else
	struct timeval tv;
	gettimeofday(&tv, NULL);
	time->ns = tv.tv_sec * BILLION + tv.tv_usec * 1000;
#endif

	/* Handle non-monotonic clocks. */
	if (unlikely(nstime_compare(&old_time, time) > 0)) {
		nstime_copy(time, &old_time);
		return (true);
	}

	return (false);
}
#ifdef JEMALLOC_JET
#undef nstime_update
#define	nstime_update JEMALLOC_N(nstime_update)
nstime_update_t *nstime_update = JEMALLOC_N(n_nstime_update);
#endif