mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +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]++;
|
$this->summary['calls_by_type'][$type]++;
|
||||||
|
|
||||||
if (! array_key_exists($id, $this->summary['calls_by_key'])) {
|
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[] = [
|
$this->calls[] = [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3>Hit miss summary</h3>
|
<h3>HIT/MISS summary</h3>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -129,15 +129,23 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Operation</th>
|
<th>Key</th>
|
||||||
<th>Count</th>
|
<th>Hits</th>
|
||||||
|
<th>Misses</th>
|
||||||
|
<th>Reads</th>
|
||||||
|
<th>Writes</th>
|
||||||
|
<th>Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for callKey, count in collector.callSummary['calls_by_key'] %}
|
{% for callKey, stats in collector.callSummary['calls_by_key'] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ callKey }}</td>
|
<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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user