Beispiel #1
0
void
sqlx_cache_debug(sqlx_cache_t *cache)
{
	EXTRA_ASSERT(cache != NULL);

	if (!GRID_DEBUG_ENABLED())
		return;

	GRID_DEBUG("--- REPO %p -----------------", (void*)cache);
	GRID_DEBUG(" > used     [%d, %d]",
			cache->beacon_used.first, cache->beacon_used.last);
	GRID_DEBUG(" > idle     [%d, %d]",
			cache->beacon_idle.first, cache->beacon_idle.last);
	GRID_DEBUG(" > idle_hot [%d, %d]",
			cache->beacon_idle_hot.first, cache->beacon_idle_hot.last);
	GRID_DEBUG(" > free     [%d, %d]",
			cache->beacon_free.first, cache->beacon_free.last);

	/* Dump all the bases */
	for (guint bd=0; bd < cache->bases_count ;bd++)
		sqlx_base_debug(__FUNCTION__, GET(cache,bd));

	/* Now dump all te references in the hashtable */
	gboolean runner(gpointer k, gpointer v, gpointer u) {
		(void) u;
		GRID_DEBUG("REF %d <- %s", GPOINTER_TO_INT(v), hashstr_str(k));
		return FALSE;
	}
Beispiel #2
0
static void
dump_request(const gchar *func, gchar **targets,
		const gchar *rn, struct sqlx_name_s *n)
{
	if (!GRID_DEBUG_ENABLED())
		return;
	gchar *tmp = g_strjoinv("|", targets);
	GRID_DEBUG("%s [%s][%s] to %s (%s)", rn, n->base, n->type, tmp, func);
	g_free(tmp);
}
	/* Test if a list has one and only one element */
	gboolean _has_only_one_element(gpointer k, gpointer v, gpointer d) {
		(void) d;
		GSList *chunk_list = (GSList *) v;
		guint length = g_slist_length(chunk_list);
		if (GRID_DEBUG_ENABLED()) {
			GString *hash_str = metautils_gba_to_hexgstr(NULL, (GByteArray *) k);
			if (length == 1) {
				GRID_TRACE("Removing bean of hash '%s' from hash table", hash_str->str);
			} else {
				GRID_DEBUG("Found % 4d beans with hash '%s'",
						length, hash_str->str);
			}
			g_string_free(hash_str, TRUE);
		}
		return (length == 1);
	}