Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteda821a

Browse files
committed
feature#22129 [WebProfilerBundle] Improve cache panel (ro0NL)
This PR was squashed before being merged into the 3.3-dev branch (closes#22129).Discussion----------[WebProfilerBundle] Improve cache panel| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->An attempt to improve the page a bit. Personally i think all elements on a single page is too much info.Before![image](https://cloud.githubusercontent.com/assets/1047696/24272477/d4d96a44-101d-11e7-9cc5-1646fc2c0603.png)![image](https://cloud.githubusercontent.com/assets/1047696/24272500/e51318a6-101d-11e7-8875-c270016f11a2.png)After![image](https://cloud.githubusercontent.com/assets/1047696/24311179/530dcc6a-10d3-11e7-9c39-7c73ee2775f1.png)![image](https://cloud.githubusercontent.com/assets/1047696/24311215/82c48566-10d3-11e7-82ff-6d79c3040a25.png)Commits-------3592d0d [WebProfilerBundle] Improve cache panel
2 parents2dfd136 +3592d0d commiteda821a

File tree

2 files changed

+94
-75
lines changed

2 files changed

+94
-75
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/cache.html.twig‎

Lines changed: 86 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</div>
2323
<divclass="sf-toolbar-info-piece">
2424
<b>Cache hits</b>
25-
<span>{{collector.totals.hits }}/{{collector.totals.reads }}({{collector.totals['hits/reads'] }})</span>
25+
<span>{{collector.totals.hits }}/{{collector.totals.reads }}{%ifcollector.totals.hit_read_ratiois notnull %}({{collector.totals.hit_read_ratio }}%){%endif %}</span>
2626
</div>
2727
<divclass="sf-toolbar-info-piece">
2828
<b>Cache writes</b>
@@ -54,21 +54,14 @@
5454
<spanclass="label">Total calls</span>
5555
</div>
5656
<divclass="metric">
57-
<spanclass="value">{{'%0.2f'|format(collector.totals.time *1000) }}ms</span>
57+
<spanclass="value">{{'%0.2f'|format(collector.totals.time *1000) }}<spanclass="unit">ms</span></span>
5858
<spanclass="label">Total time</span>
5959
</div>
60+
<divclass="metric-divider"></div>
6061
<divclass="metric">
6162
<spanclass="value">{{collector.totals.reads }}</span>
6263
<spanclass="label">Total reads</span>
6364
</div>
64-
<divclass="metric">
65-
<spanclass="value">{{collector.totals.hits }}</span>
66-
<spanclass="label">Total hits</span>
67-
</div>
68-
<divclass="metric">
69-
<spanclass="value">{{collector.totals.misses }}</span>
70-
<spanclass="label">Total misses</span>
71-
</div>
7265
<divclass="metric">
7366
<spanclass="value">{{collector.totals.writes }}</span>
7467
<spanclass="label">Total writes</span>
@@ -77,70 +70,96 @@
7770
<spanclass="value">{{collector.totals.deletes }}</span>
7871
<spanclass="label">Total deletes</span>
7972
</div>
73+
<divclass="metric-divider"></div>
74+
<divclass="metric">
75+
<spanclass="value">{{collector.totals.hits }}</span>
76+
<spanclass="label">Total hits</span>
77+
</div>
78+
<divclass="metric">
79+
<spanclass="value">{{collector.totals.misses }}</span>
80+
<spanclass="label">Total misses</span>
81+
</div>
8082
<divclass="metric">
81-
<spanclass="value">{{collector.totals['hits/reads'] }}</span>
83+
<spanclass="value">
84+
{%ifcollector.totals.hit_read_ratioisnull %}
85+
n/a
86+
{%else %}
87+
{{collector.totals.hit_read_ratio }} <spanclass="unit">%</span>
88+
{%endif %}
89+
</span>
8290
<spanclass="label">Hits/reads</span>
8391
</div>
8492
</div>
8593

86-
{%forname,callsincollector.calls %}
87-
<h3>Statistics for '{{name }}'</h3>
88-
<divclass="metrics">
89-
{%forkey,valueincollector.statistics[name] %}
90-
<divclass="metric">
91-
<spanclass="value">
92-
{%ifkey=='time' %}
93-
{{'%0.2f'|format(1000*value.value) }} ms
94-
{%else %}
95-
{{value }}
96-
{%endif %}
97-
</span>
98-
<spanclass="label">{{key|capitalize }}</span>
99-
</div>
100-
{%endfor %}
101-
</div>
102-
<h4>Calls for '{{name }}'</h4>
94+
<h2>Pools</h2>
95+
<divclass="sf-tabs">
96+
{%forname,callsincollector.calls %}
97+
<divclass="tab {{calls|length==0?'disabled' }}">
98+
<h3class="tab-title">{{name }} <spanclass="badge">{{collector.statistics[name].calls }}</span></h3>
10399

104-
{%ifnotcollector.totals.calls %}
105-
<p>
106-
<em>No calls.</em>
107-
</p>
108-
{%else %}
109-
<table>
110-
<thead>
111-
<tr>
112-
<thstyle="width: 5rem;">Key</th>
113-
<th>Value</th>
114-
</tr>
115-
</thead>
116-
<tbody>
117-
{%fori,callincalls %}
118-
<tr>
119-
<thstyle="padding-top:2rem">#{{i }}</th>
120-
<thstyle="padding-top:2rem">Pool::{{call.name }}</th>
121-
</tr>
122-
<tr>
123-
<th>Argument</th>
124-
<td>{{ profiler_dump(call.argument, maxDepth=2) }}</td>
125-
</tr>
126-
<tr>
127-
<th>Results</th>
128-
<td>
129-
{%ifcall.result!=false %}
130-
{{ profiler_dump(call.result, maxDepth=1) }}
100+
<divclass="tab-content">
101+
<h3>Statistics</h3>
102+
<divclass="metrics">
103+
{%forkey,valueincollector.statistics[name] %}
104+
<divclass="metric">
105+
<spanclass="value">
106+
{%ifkey=='time' %}
107+
{{'%0.2f'|format(1000 *value.value) }} <spanclass="unit">ms</span>
108+
{%elseifkey=='hit_read_ratio' %}
109+
{%ifvalue.valueisnull %}
110+
n/a
111+
{%else %}
112+
{{value }} <spanclass="unit">%</span>
113+
{%endif %}
114+
{%else %}
115+
{{value }}
116+
{%endif %}
117+
</span>
118+
<spanclass="label">{{key=='hit_read_ratio'?'Hits/reads':key|capitalize }}</span>
119+
</div>
120+
{%ifkey=='time'orkey=='deletes' %}
121+
<divclass="metric-divider"></div>
131122
{%endif %}
132-
</td>
133-
</tr>
134-
<tr>
135-
<th>Time</th>
136-
<td>{{'%0.2f'|format((call.end -call.start)*1000) }} ms</td>
137-
</tr>
138-
139-
{%endfor %}
140-
</tbody>
123+
{%endfor %}
124+
</div>
141125

142-
</table>
143-
{%endif %}
144-
{%endfor %}
126+
<h4>Calls</h4>
127+
{%ifcalls|length==0 %}
128+
<divclass="empty">
129+
<p>No calls</p>
130+
</div>
131+
{%else %}
132+
<table>
133+
<thead>
134+
<tr>
135+
<th>#</th>
136+
<thclass="key">Key</th>
137+
<th>Value</th>
138+
</tr>
139+
</thead>
140+
<tbody>
141+
{%forcallincalls %}
142+
{%setseparatorStyle=notloop.first?' style="border-top-width: medium;"':'' %}
143+
<tr>
144+
<tdclass="font-normal text-small text-muted nowrap"rowspan="3"{{separatorStyle|raw }}>{{loop.index }}</td>
145+
<th{{separatorStyle|raw }}>{{call.name }}</th>
146+
<td{{separatorStyle|raw }}>{{ profiler_dump(call.value.argument, maxDepth=2) }}</td>
147+
</tr>
148+
<tr>
149+
<th>Result</th>
150+
<td>{{ profiler_dump(call.value.result, maxDepth=1) }}</td>
151+
</tr>
152+
<tr>
153+
<th>Time</th>
154+
<td>{{'%0.2f'|format((call.end -call.start)*1000) }} ms</td>
155+
</tr>
156+
{%endfor %}
157+
</tbody>
158+
</table>
159+
{%endif %}
160+
</div>
161+
</div>
162+
{%endfor %}
163+
</div>
145164

146165
{%endblock %}

‎src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ private function calculateStatistics()
103103
'calls' =>0,
104104
'time' =>0,
105105
'reads' =>0,
106-
'hits' =>0,
107-
'misses' =>0,
108106
'writes' =>0,
109107
'deletes' =>0,
108+
'hits' =>0,
109+
'misses' =>0,
110110
);
111111
/** @var TraceableAdapterEvent $call */
112112
foreach ($callsas$call) {
@@ -138,9 +138,9 @@ private function calculateStatistics()
138138
}
139139
}
140140
if ($statistics[$name]['reads']) {
141-
$statistics[$name]['hits/reads'] =round(100 *$statistics[$name]['hits'] /$statistics[$name]['reads'],2).'%';
141+
$statistics[$name]['hit_read_ratio'] =round(100 *$statistics[$name]['hits'] /$statistics[$name]['reads'],2);
142142
}else {
143-
$statistics[$name]['hits/reads'] ='N/A';
143+
$statistics[$name]['hit_read_ratio'] =null;
144144
}
145145
}
146146

@@ -157,20 +157,20 @@ private function calculateTotalStatistics()
157157
'calls' =>0,
158158
'time' =>0,
159159
'reads' =>0,
160-
'hits' =>0,
161-
'misses' =>0,
162160
'writes' =>0,
163161
'deletes' =>0,
162+
'hits' =>0,
163+
'misses' =>0,
164164
);
165165
foreach ($statisticsas$name =>$values) {
166166
foreach ($totalsas$key =>$value) {
167167
$totals[$key] +=$statistics[$name][$key];
168168
}
169169
}
170170
if ($totals['reads']) {
171-
$totals['hits/reads'] =round(100 *$totals['hits'] /$totals['reads'],2).'%';
171+
$totals['hit_read_ratio'] =round(100 *$totals['hits'] /$totals['reads'],2);
172172
}else {
173-
$totals['hits/reads'] ='N/A';
173+
$totals['hit_read_ratio'] =null;
174174
}
175175

176176
return$totals;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp