mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
Add by key aggregates in cache profiler
This commit is contained in:
@@ -53,10 +53,25 @@ class TraceableCache implements Cache, PhraseaCache
|
||||
$this->summary['calls_by_type'][$type]++;
|
||||
|
||||
if (! array_key_exists($id, $this->summary['calls_by_key'])) {
|
||||
$this->summary['calls_by_key'][$id] = 0;
|
||||
$this->summary['calls_by_key'][$id] = [
|
||||
'total' => 0,
|
||||
'reads'=> 0,
|
||||
'writes' => 0,
|
||||
'hits' => 0,
|
||||
'misses' => 0
|
||||
];
|
||||
}
|
||||
|
||||
$this->summary['calls_by_key'][$id]++;
|
||||
if (! array_key_exists($type, $this->summary['calls_by_key'][$id])) {
|
||||
$this->summary['calls_by_key'][$id][$type] = 0;
|
||||
}
|
||||
$this->summary['calls_by_key'][$id]['hits'] += $hit ? 1 : 0;
|
||||
$this->summary['calls_by_key'][$id]['misses'] += $hit ? 0 : 1;
|
||||
|
||||
$this->summary['calls_by_key'][$id]['reads'] += ($type == 'fetch' || $type == 'contains') ? 1 : 0;
|
||||
$this->summary['calls_by_key'][$id]['writes'] += ($type == 'fetch' || $type == 'contains') ? 0 : 1;
|
||||
|
||||
$this->summary['calls_by_key'][$id]['total']++;
|
||||
|
||||
$this->calls[] = [
|
||||
'type' => $type,
|
||||
|
@@ -80,7 +80,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Hit miss summary</h3>
|
||||
<h3>HIT/MISS summary</h3>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
@@ -129,15 +129,23 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Operation</th>
|
||||
<th>Count</th>
|
||||
<th>Key</th>
|
||||
<th>Hits</th>
|
||||
<th>Misses</th>
|
||||
<th>Reads</th>
|
||||
<th>Writes</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for callKey, count in collector.callSummary['calls_by_key'] %}
|
||||
{% for callKey, stats in collector.callSummary['calls_by_key'] %}
|
||||
<tr>
|
||||
<td>{{ callKey }}</td>
|
||||
<td>{{ count }}</td>
|
||||
<td>{{ stats['hits'] }}</td>
|
||||
<td>{{ stats['misses'] }}</td>
|
||||
<td>{{ stats['reads'] }}</td>
|
||||
<td>{{ stats['writes'] }}</td>
|
||||
<td>{{ stats['total'] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user