Skip to content

Commit

Permalink
bug #27222 [WebProfilerBundle][Cache] Fix misses calculation when cal…
Browse files Browse the repository at this point in the history
…ling getItems (fsevestre)

This PR was merged into the 3.4 branch.

Discussion
----------

[WebProfilerBundle][Cache] Fix misses calculation when calling getItems

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Hello,

This PR fixes a bug in the misses calculation in the cache data collector when calling the `getItems` method.

Found this while trying to understand why I had an inconsistency in the profiler:
![misses](https://user-images.githubusercontent.com/4130750/39875423-e6212f60-5470-11e8-87be-c075ee76aeaa.png)

Commits
-------

3d1ab6d Fix misses calculation when calling getItems
  • Loading branch information
fabpot committed May 11, 2018
2 parents 5deb504 + 3d1ab6d commit 9ef517d
Showing 1 changed file with 2 additions and 3 deletions.
Expand Up @@ -132,10 +132,9 @@ private function calculateStatistics()
$statistics[$name]['misses'] += 1;
}
} elseif ('getItems' === $call->name) {
$count = $call->hits + $call->misses;
$statistics[$name]['reads'] += $count;
$statistics[$name]['reads'] += $call->hits + $call->misses;
$statistics[$name]['hits'] += $call->hits;
$statistics[$name]['misses'] += $count - $call->misses;
$statistics[$name]['misses'] += $call->misses;
} elseif ('hasItem' === $call->name) {
$statistics[$name]['reads'] += 1;
if (false === $call->result) {
Expand Down

0 comments on commit 9ef517d

Please sign in to comment.