From 39be89ba4945238f6311454283a66930b94577be Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 23 Sep 2013 10:11:16 +1000 Subject: ?/debug/apc --- templates/mod/debug/apc.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 templates/mod/debug/apc.html (limited to 'templates/mod/debug/apc.html') diff --git a/templates/mod/debug/apc.html b/templates/mod/debug/apc.html new file mode 100644 index 00000000..53f59eb0 --- /dev/null +++ b/templates/mod/debug/apc.html @@ -0,0 +1,23 @@ + + + + + + + + + + {% for var in cached_vars %} + + + + + + + + + {% endfor %} +
KeyHitsCreatedExpiresSizeValue
{{ var.key }}{{ var.num_hits }}{{ var.creation_time|ago }} ago{{ (var.creation_time + var.ttl)|until }} (ttl: {{ var.ttl }}s){{ var.mem_size }} bytes + {% set value = var.value|json_encode %} + {{ value[:80]|e('html') }}{% if value|length > 80 %}…{% endif %} +
\ No newline at end of file -- cgit v1.3 From fcbc21131431725e4cb4cafde0fd907e9c607fa1 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 23 Sep 2013 10:21:18 +1000 Subject: Fixed weird bug with ?/debug/sql trying to allocate a few GB on some instances. Assuming bug with APCu. --- inc/mod/pages.php | 8 +++++++- templates/mod/debug/apc.html | 9 ++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'templates/mod/debug/apc.html') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 4346cf94..b240db55 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2363,7 +2363,13 @@ function mod_debug_apc() { if ($config['cache']['enabled'] != 'apc') error('APC is not enabled.'); - $cached_vars = new APCIterator('user', '/^' . $config['cache']['prefix'] . '/'); + $cache_info = apc_cache_info('user'); + // $cached_vars = new APCIterator('user', '/^' . $config['cache']['prefix'] . '/'); + $cached_vars = array(); + foreach ($cache_info['cache_list'] as $var) { + $cached_vars[] = $var; + } + mod_page(_('Debug: APC'), 'mod/debug/apc.html', array('cached_vars' => $cached_vars)); } diff --git a/templates/mod/debug/apc.html b/templates/mod/debug/apc.html index 53f59eb0..0aa05e9f 100644 --- a/templates/mod/debug/apc.html +++ b/templates/mod/debug/apc.html @@ -5,19 +5,14 @@ Created Expires Size - Value {% for var in cached_vars %} - {{ var.key }} + {% if var.key %}{{ var.key }}{% else %}{{ var.info }}{% endif %} {{ var.num_hits }} {{ var.creation_time|ago }} ago - {{ (var.creation_time + var.ttl)|until }} (ttl: {{ var.ttl }}s) + {{ (var.creation_time + var.ttl)|until }} (ttl: {{ (time() + var.ttl)|until }}) {{ var.mem_size }} bytes - - {% set value = var.value|json_encode %} - {{ value[:80]|e('html') }}{% if value|length > 80 %}…{% endif %} - {% endfor %} \ No newline at end of file -- cgit v1.3 From 4ce6218ba05fa4fbef02d35438fce9e7e2c928c7 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 23 Sep 2013 10:24:29 +1000 Subject: Some APC libraries/versions do stuff differently. --- templates/mod/debug/apc.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates/mod/debug/apc.html') diff --git a/templates/mod/debug/apc.html b/templates/mod/debug/apc.html index 0aa05e9f..f3c0bde7 100644 --- a/templates/mod/debug/apc.html +++ b/templates/mod/debug/apc.html @@ -8,10 +8,10 @@ {% for var in cached_vars %} - {% if var.key %}{{ var.key }}{% else %}{{ var.info }}{% endif %} - {{ var.num_hits }} - {{ var.creation_time|ago }} ago - {{ (var.creation_time + var.ttl)|until }} (ttl: {{ (time() + var.ttl)|until }}) + {{ var.key ? var.key : var.info }} + {{ var.nhits ? var.nhits : var.num_hits }} + {{ (var.ctime ? var.ctime : var.creation_time)|ago }} ago + {{ ((var.ctime ? var.ctime : var.creation_time) + var.ttl)|until }} (ttl: {{ (time() + var.ttl)|until }}) {{ var.mem_size }} bytes {% endfor %} -- cgit v1.3 From 6eefc5ea2a450d868ecb18465eafea7e8bdb9693 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 23 Sep 2013 10:26:13 +1000 Subject: . --- templates/mod/debug/apc.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates/mod/debug/apc.html') diff --git a/templates/mod/debug/apc.html b/templates/mod/debug/apc.html index f3c0bde7..fde0979b 100644 --- a/templates/mod/debug/apc.html +++ b/templates/mod/debug/apc.html @@ -8,10 +8,10 @@ {% for var in cached_vars %} - {{ var.key ? var.key : var.info }} - {{ var.nhits ? var.nhits : var.num_hits }} - {{ (var.ctime ? var.ctime : var.creation_time)|ago }} ago - {{ ((var.ctime ? var.ctime : var.creation_time) + var.ttl)|until }} (ttl: {{ (time() + var.ttl)|until }}) + {{ var.key is defined ? var.key : var.info }} + {{ var.nhits is defined ? var.nhits : var.num_hits }} + {{ (var.ctime is defined ? var.ctime : var.creation_time)|ago }} ago + {{ ((var.ctime is defined ? var.ctime : var.creation_time) + var.ttl)|until }} (ttl: {{ (time() + var.ttl)|until }}) {{ var.mem_size }} bytes {% endfor %} -- cgit v1.3 From 04cfeaf01c5ea830b1caa1a442a864019a02ce39 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 23 Sep 2013 10:38:06 +1000 Subject: hide expired cache shit --- templates/mod/debug/apc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/mod/debug/apc.html') diff --git a/templates/mod/debug/apc.html b/templates/mod/debug/apc.html index fde0979b..e8733af8 100644 --- a/templates/mod/debug/apc.html +++ b/templates/mod/debug/apc.html @@ -6,7 +6,7 @@ Expires Size - {% for var in cached_vars %} + {% for var in cached_vars if (var.ctime is defined ? var.ctime : var.creation_time) + var.ttl > time() %} {{ var.key is defined ? var.key : var.info }} {{ var.nhits is defined ? var.nhits : var.num_hits }} -- cgit v1.3