From f7f0bfc4608ce799143cf6c585d5bb444dc1500a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 4 Feb 2017 20:01:41 -0600 Subject: [PATCH] libpkgconf: cache: add trace points --- libpkgconf/cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libpkgconf/cache.c b/libpkgconf/cache.c index 2c5c7e8..986eba5 100644 --- a/libpkgconf/cache.c +++ b/libpkgconf/cache.c @@ -52,9 +52,13 @@ pkgconf_cache_lookup(const pkgconf_client_t *client, const char *id) pkgconf_pkg_t *pkg = node->data; if (!strcmp(pkg->id, id)) + { + PKGCONF_TRACE(client, "found: %s @%p", id, pkg); return pkgconf_pkg_ref(client, pkg); + } } + PKGCONF_TRACE(client, "miss: %s", id); return NULL; } @@ -78,6 +82,8 @@ pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg) pkgconf_pkg_ref(client, pkg); pkgconf_node_insert(&pkg->cache_iter, pkg, &client->pkg_cache); + + PKGCONF_TRACE(client, "added @%p to cache", pkg); } /* @@ -97,6 +103,8 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg) if (pkg == NULL) return; + PKGCONF_TRACE(client, "removed @%p from cache", pkg); + pkgconf_node_delete(&pkg->cache_iter, &client->pkg_cache); } @@ -123,4 +131,6 @@ pkgconf_cache_free(pkgconf_client_t *client) } memset(&client->pkg_cache, 0, sizeof client->pkg_cache); + + PKGCONF_TRACE(client, "cleared package cache"); }