diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/cache.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/cache.html.twig index c71a69181736c..f168e84f4a267 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/cache.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/cache.html.twig @@ -22,7 +22,7 @@
Cache hits - {{ collector.totals.hits }}/{{ collector.totals.reads }} ({{ collector.totals['hits/reads'] }}) + {{ collector.totals.hits }}/{{ collector.totals.reads }}{% if collector.totals.hit_read_ratio is not null %} ({{ collector.totals.hit_read_ratio }}%){% endif %}
Cache writes @@ -54,21 +54,14 @@ Total calls
- {{ '%0.2f'|format(collector.totals.time * 1000) }} ms + {{ '%0.2f'|format(collector.totals.time * 1000) }} ms Total time
+
{{ collector.totals.reads }} Total reads
-
- {{ collector.totals.hits }} - Total hits -
-
- {{ collector.totals.misses }} - Total misses -
{{ collector.totals.writes }} Total writes @@ -77,70 +70,96 @@ {{ collector.totals.deletes }} Total deletes
+
+
+ {{ collector.totals.hits }} + Total hits +
+
+ {{ collector.totals.misses }} + Total misses +
- {{ collector.totals['hits/reads'] }} + + {% if collector.totals.hit_read_ratio is null %} + n/a + {% else %} + {{ collector.totals.hit_read_ratio }} % + {% endif %} + Hits/reads
- {% for name, calls in collector.calls %} -

Statistics for '{{ name }}'

-
- {% for key, value in collector.statistics[name] %} -
- - {% if key == 'time' %} - {{ '%0.2f'|format(1000*value.value) }} ms - {% else %} - {{ value }} - {% endif %} - - {{ key|capitalize }} -
- {% endfor %} -
-

Calls for '{{ name }}'

+

Pools

+
+ {% for name, calls in collector.calls %} +
+

{{ name }} {{ collector.statistics[name].calls }}

- {% if not collector.totals.calls %} -

- No calls. -

- {% else %} - - - - - - - - - {% for i, call in calls %} - - - - - - - - - - - - - - - - - - {% endfor %} - + {% endfor %} + -
KeyValue
#{{ i }}Pool::{{ call.name }}
Argument{{ profiler_dump(call.argument, maxDepth=2) }}
Results - {% if call.result != false %} - {{ profiler_dump(call.result, maxDepth=1) }} +
+

Statistics

+
+ {% for key, value in collector.statistics[name] %} +
+ + {% if key == 'time' %} + {{ '%0.2f'|format(1000 * value.value) }} ms + {% elseif key == 'hit_read_ratio' %} + {% if value.value is null %} + n/a + {% else %} + {{ value }} % + {% endif %} + {% else %} + {{ value }} + {% endif %} + + {{ key == 'hit_read_ratio' ? 'Hits/reads' : key|capitalize }} +
+ {% if key == 'time' or key == 'deletes' %} +
{% endif %} -
Time{{ '%0.2f'|format((call.end - call.start) * 1000) }} ms
- {% endif %} - {% endfor %} +

Calls

+ {% if calls|length == 0 %} +
+

No calls

+
+ {% else %} + + + + + + + + + + {% for call in calls %} + {% set separatorStyle = not loop.first ? ' style="border-top-width: medium;"' : '' %} + + + {{ call.name }} + {{ profiler_dump(call.value.argument, maxDepth=2) }} + + + + + + + + + + {% endfor %} + +
#KeyValue
{{ loop.index }}
Result{{ profiler_dump(call.value.result, maxDepth=1) }}
Time{{ '%0.2f'|format((call.end - call.start) * 1000) }} ms
+ {% endif %} +
+
+ {% endfor %} + {% endblock %} diff --git a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php index edbd726351100..4f9bc73983639 100644 --- a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php +++ b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php @@ -103,10 +103,10 @@ private function calculateStatistics() 'calls' => 0, 'time' => 0, 'reads' => 0, - 'hits' => 0, - 'misses' => 0, 'writes' => 0, 'deletes' => 0, + 'hits' => 0, + 'misses' => 0, ); /** @var TraceableAdapterEvent $call */ foreach ($calls as $call) { @@ -138,9 +138,9 @@ private function calculateStatistics() } } if ($statistics[$name]['reads']) { - $statistics[$name]['hits/reads'] = round(100 * $statistics[$name]['hits'] / $statistics[$name]['reads'], 2).'%'; + $statistics[$name]['hit_read_ratio'] = round(100 * $statistics[$name]['hits'] / $statistics[$name]['reads'], 2); } else { - $statistics[$name]['hits/reads'] = 'N/A'; + $statistics[$name]['hit_read_ratio'] = null; } } @@ -157,10 +157,10 @@ private function calculateTotalStatistics() 'calls' => 0, 'time' => 0, 'reads' => 0, - 'hits' => 0, - 'misses' => 0, 'writes' => 0, 'deletes' => 0, + 'hits' => 0, + 'misses' => 0, ); foreach ($statistics as $name => $values) { foreach ($totals as $key => $value) { @@ -168,9 +168,9 @@ private function calculateTotalStatistics() } } if ($totals['reads']) { - $totals['hits/reads'] = round(100 * $totals['hits'] / $totals['reads'], 2).'%'; + $totals['hit_read_ratio'] = round(100 * $totals['hits'] / $totals['reads'], 2); } else { - $totals['hits/reads'] = 'N/A'; + $totals['hit_read_ratio'] = null; } return $totals;