PageRenderTime 78ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/app/cache/dev/twig/83/18/b021d436727794ea52e8f4ddaaa3.php

https://bitbucket.org/polipetr/cms
PHP | 817 lines | 610 code | 91 blank | 116 comment | 37 complexity | fd0d69298c758b1a0741962f3bff6619 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-3.0, BSD-3-Clause, BSD-2-Clause
  1. <?php
  2. /* WebProfilerBundle:Collector:time.html.twig */
  3. class __TwigTemplate_8318b021d436727794ea52e8f4ddaaa3 extends Twig_Template
  4. {
  5. public function __construct(Twig_Environment $env)
  6. {
  7. parent::__construct($env);
  8. $this->parent = $this->env->loadTemplate("WebProfilerBundle:Profiler:layout.html.twig");
  9. $this->blocks = array(
  10. 'toolbar' => array($this, 'block_toolbar'),
  11. 'menu' => array($this, 'block_menu'),
  12. 'panel' => array($this, 'block_panel'),
  13. 'panelContent' => array($this, 'block_panelContent'),
  14. );
  15. }
  16. protected function doGetParent(array $context)
  17. {
  18. return "WebProfilerBundle:Profiler:layout.html.twig";
  19. }
  20. protected function doDisplay(array $context, array $blocks = array())
  21. {
  22. // line 3
  23. $context["__internal_3b2fd072fb460ca9473bafe1d9c66a63138ee454"] = $this;
  24. // line 5
  25. if ((!array_key_exists("colors", $context))) {
  26. // line 6
  27. $context["colors"] = array("default" => "#aacd4e", "section" => "#666", "event_listener" => "#3dd", "event_listener_loading" => "#add", "template" => "#dd3", "doctrine" => "#d3d", "propel" => "#f4d", "child_sections" => "#eed");
  28. }
  29. $this->parent->display($context, array_merge($this->blocks, $blocks));
  30. }
  31. // line 18
  32. public function block_toolbar($context, array $blocks = array())
  33. {
  34. // line 19
  35. echo " ";
  36. $context["total_time"] = ((twig_length_filter($this->env, $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"))) ? (sprintf("%.0f ms", $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "totaltime"))) : ("n/a"));
  37. // line 20
  38. echo " ";
  39. ob_start();
  40. // line 21
  41. echo " <img width=\"16\" height=\"28\" alt=\"Time\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAcCAYAAABoMT8aAAABqUlEQVR42t2Vv0sCYRyHX9OmEhsMx/YKGlwLQ69DTEUSBJEQEy5J3FRc/BsuiFqEIIcQIRo6ysUhoaBBWhoaGoJwiMJLglRKrs8bXgienmkQdPDAwX2f57j3fhFJkkbiPwTK5bIiFoul3kmPud8MqKMewDXpwuGww+12n9hsNhFnlijYf/Z4PDmO45Yxo+10ZFGTyWRMEItU6AdCx7lczkgd6n7J2Wx2xm63P6jJMk6n80YQBBN1aUDv9XqvlAbbm2LE7/cLODRB0un0VveAeoDC8/waCQQC18MGQqHQOcEKvw8bcLlcL6TfYnVtCrGRAlartUUYhmn1jKg/E3USjUYfhw3E4/F7ks/nz4YNFIvFQ/ogbUYikdefyqlU6gnuOg2YK5XKvs/n+xhUDgaDTVEUt+HO04ABOBA5isViDTU5kUi81Wq1AzhWMEkDGmAEq2C3UCjcYXGauDvfEsuyUjKZbJRKpVvM8IABU9SVX+cxYABmwIE9cFqtVi9xtgvsC2AHbIAFoKey0gdlHEyDObAEWLACFsEsMALdIJ80+dK0bTS95v7+v/AJnis0eO906QwAAAAASUVORK5CYII=\"/>
  42. <span>";
  43. // line 22
  44. echo twig_escape_filter($this->env, (isset($context["total_time"]) ? $context["total_time"] : $this->getContext($context, "total_time")), "html", null, true);
  45. echo "</span>
  46. ";
  47. $context["icon"] = ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  48. // line 24
  49. echo " ";
  50. ob_start();
  51. // line 25
  52. echo " <div class=\"sf-toolbar-info-piece\">
  53. <b>Total time</b>
  54. <span>";
  55. // line 27
  56. echo twig_escape_filter($this->env, (isset($context["total_time"]) ? $context["total_time"] : $this->getContext($context, "total_time")), "html", null, true);
  57. echo "</span>
  58. </div>
  59. ";
  60. $context["text"] = ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  61. // line 30
  62. echo " ";
  63. $this->env->loadTemplate("WebProfilerBundle:Profiler:toolbar_item.html.twig")->display(array_merge($context, array("link" => (isset($context["profiler_url"]) ? $context["profiler_url"] : $this->getContext($context, "profiler_url")))));
  64. }
  65. // line 33
  66. public function block_menu($context, array $blocks = array())
  67. {
  68. // line 34
  69. echo "<span class=\"label\">
  70. <span class=\"icon\"><img src=\"";
  71. // line 35
  72. echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/webprofiler/images/profiler/time.png"), "html", null, true);
  73. echo "\" alt=\"Timeline\" /></span>
  74. <strong>Timeline</strong>
  75. </span>
  76. ";
  77. }
  78. // line 40
  79. public function block_panel($context, array $blocks = array())
  80. {
  81. // line 41
  82. echo " <h2>Timeline</h2>
  83. ";
  84. // line 42
  85. if (twig_length_filter($this->env, $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"))) {
  86. // line 43
  87. echo " ";
  88. $this->displayBlock("panelContent", $context, $blocks);
  89. echo "
  90. ";
  91. } else {
  92. // line 45
  93. echo " <p>
  94. <em>No timing events have been recorded. Are you sure that debugging is enabled in the kernel?</em>
  95. </p>
  96. ";
  97. }
  98. }
  99. // line 51
  100. public function block_panelContent($context, array $blocks = array())
  101. {
  102. // line 52
  103. echo " <form id=\"timeline-control\" action=\"\" method=\"get\">
  104. <input type=\"hidden\" name=\"panel\" value=\"time\" />
  105. <table>
  106. <tr>
  107. <th style=\"width: 20%\">Total time</th>
  108. <td>";
  109. // line 57
  110. echo twig_escape_filter($this->env, sprintf("%.0f", $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "totaltime")), "html", null, true);
  111. echo " ms</td>
  112. </tr>
  113. <tr>
  114. <th>Initialization time</th>
  115. <td>";
  116. // line 61
  117. echo twig_escape_filter($this->env, sprintf("%.0f", $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "inittime")), "html", null, true);
  118. echo " ms</td>
  119. </tr>
  120. <tr>
  121. <th>Threshold</th>
  122. <td><input type=\"number\" size=\"3\" name=\"threshold\" value=\"1\" min=\"0\" /> ms</td>
  123. </tr>
  124. </table>
  125. </form>
  126. <h3>
  127. ";
  128. // line 71
  129. echo (($this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "parent")) ? ("Request") : ("Main Request"));
  130. echo "
  131. <small>
  132. - ";
  133. // line 73
  134. echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), "__section__"), "totaltime"), "html", null, true);
  135. echo " ms
  136. ";
  137. // line 74
  138. if ($this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "parent")) {
  139. // line 75
  140. echo " - <a href=\"";
  141. echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => $this->getAttribute($this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "parent"), "token"), "panel" => "time")), "html", null, true);
  142. echo "\">parent</a>
  143. ";
  144. }
  145. // line 77
  146. echo " </small>
  147. </h3>
  148. ";
  149. // line 80
  150. $context["max"] = $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), "__section__"), "endtime");
  151. // line 81
  152. echo "
  153. ";
  154. // line 82
  155. echo $context["__internal_3b2fd072fb460ca9473bafe1d9c66a63138ee454"]->getdisplay_timeline(("timeline_" . (isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"))), $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), (isset($context["colors"]) ? $context["colors"] : $this->getContext($context, "colors")));
  156. echo "
  157. ";
  158. // line 84
  159. if (twig_length_filter($this->env, $this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "children"))) {
  160. // line 85
  161. echo " ";
  162. $context['_parent'] = (array) $context;
  163. $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "children"));
  164. foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
  165. // line 86
  166. echo " ";
  167. $context["events"] = $this->getAttribute($this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "getcollector", array(0 => "time"), "method"), "events");
  168. // line 87
  169. echo " <h3>
  170. Sub-request \"<a href=\"";
  171. // line 88
  172. echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => $this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "token"), "panel" => "time")), "html", null, true);
  173. echo "\">";
  174. echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "getcollector", array(0 => "request"), "method"), "requestattributes"), "get", array(0 => "_controller"), "method"), "html", null, true);
  175. echo "</a>\"
  176. <small> - ";
  177. // line 89
  178. echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute((isset($context["events"]) ? $context["events"] : $this->getContext($context, "events")), "__section__"), "totaltime"), "html", null, true);
  179. echo " ms</small>
  180. </h3>
  181. ";
  182. // line 92
  183. echo $context["__internal_3b2fd072fb460ca9473bafe1d9c66a63138ee454"]->getdisplay_timeline(("timeline_" . $this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "token")), (isset($context["events"]) ? $context["events"] : $this->getContext($context, "events")), (isset($context["colors"]) ? $context["colors"] : $this->getContext($context, "colors")));
  184. echo "
  185. ";
  186. }
  187. $_parent = $context['_parent'];
  188. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
  189. $context = array_merge($_parent, array_intersect_key($context, $_parent));
  190. // line 94
  191. echo " ";
  192. }
  193. // line 95
  194. echo "
  195. <script type=\"text/javascript\">//<![CDATA[
  196. /**
  197. * In-memory key-value cache manager
  198. */
  199. var cache = new function() {
  200. \"use strict\";
  201. var dict = {};
  202. this.get = function(key) {
  203. return dict.hasOwnProperty(key)
  204. ? dict[key]
  205. : null;
  206. }
  207. this.set = function(key, value) {
  208. dict[key] = value;
  209. return value;
  210. }
  211. };
  212. /**
  213. * Query an element with a CSS selector.
  214. *
  215. * @param string selector a CSS-selector-compatible query string.
  216. *
  217. * @return DOMElement|null
  218. */
  219. function query(selector)
  220. {
  221. \"use strict\";
  222. var key = 'SELECTOR: ' + selector;
  223. return cache.get(key) || cache.set(key, document.querySelector(selector));
  224. }
  225. /**
  226. * Canvas Manager
  227. */
  228. function CanvasManager(requests, maxRequestTime) {
  229. \"use strict\";
  230. var _drawingColors = ";
  231. // line 138
  232. echo twig_jsonencode_filter((isset($context["colors"]) ? $context["colors"] : $this->getContext($context, "colors")));
  233. echo ",
  234. _storagePrefix = 'sf2/profiler/timeline',
  235. _threshold = 1,
  236. _requests = requests,
  237. _maxRequestTime = maxRequestTime;
  238. /**
  239. * Check whether this event is a child event.
  240. *
  241. * @return true if it is.
  242. */
  243. function isChildEvent(event)
  244. {
  245. return '__section__.child' === event.name;
  246. }
  247. /**
  248. * Check whether this event is categorized in 'section'.
  249. *
  250. * @return true if it is.
  251. */
  252. function isSectionEvent(event)
  253. {
  254. return 'section' === event.category;
  255. }
  256. /**
  257. * Get the width of the container.
  258. */
  259. function getContainerWidth()
  260. {
  261. return query('#collector_content h2').clientWidth;
  262. }
  263. /**
  264. * Draw one canvas.
  265. *
  266. * @param request the request object
  267. * @param max <subjected for removal>
  268. * @param threshold the threshold (lower bound) of the length of the timeline (in miliseconds).
  269. * @param width the width of the canvas.
  270. */
  271. this.drawOne = function(request, max, threshold, width)
  272. {
  273. \"use strict\";
  274. var text,
  275. ms,
  276. xc,
  277. drawableEvents,
  278. mainEvents,
  279. elementId = 'timeline_' + request.id,
  280. canvasHeight = 0,
  281. gapPerEvent = 38,
  282. colors = _drawingColors,
  283. space = 10.5,
  284. ratio = (width - space * 2) / max,
  285. h = space,
  286. x = request.left * ratio + space, // position
  287. canvas = cache.get(elementId) || cache.set(elementId, document.getElementById(elementId)),
  288. ctx = canvas.getContext(\"2d\");
  289. // Filter events whose total time is below the threshold.
  290. drawableEvents = request.events.filter(function(event) {
  291. return event.totaltime >= threshold;
  292. });
  293. canvasHeight += gapPerEvent * drawableEvents.length;
  294. canvas.width = width;
  295. canvas.height = canvasHeight;
  296. ctx.textBaseline = \"middle\";
  297. ctx.lineWidth = 0;
  298. // For each event, draw a line.
  299. ctx.strokeStyle = \"#dfdfdf\";
  300. drawableEvents.forEach(function(event) {
  301. event.periods.forEach(function(period) {
  302. var timelineHeadPosition = x + period.begin * ratio;
  303. if (isChildEvent(event)) {
  304. ctx.fillStyle = colors.child_sections;
  305. ctx.fillRect(timelineHeadPosition, 0, (period.end - period.begin) * ratio, canvasHeight);
  306. } else if (isSectionEvent(event)) {
  307. var timelineTailPosition = x + period.end * ratio;
  308. ctx.beginPath();
  309. ctx.moveTo(timelineHeadPosition, 0);
  310. ctx.lineTo(timelineHeadPosition, canvasHeight);
  311. ctx.moveTo(timelineTailPosition, 0);
  312. ctx.lineTo(timelineTailPosition, canvasHeight);
  313. ctx.fill();
  314. ctx.closePath();
  315. ctx.stroke();
  316. }
  317. });
  318. });
  319. // Filter for main events.
  320. mainEvents = drawableEvents.filter(function(event) {
  321. return ! isChildEvent(event)
  322. });
  323. // For each main event, draw the visual presentation of timelines.
  324. mainEvents.forEach(function(event) {
  325. h += 8;
  326. // For each sub event, ...
  327. event.periods.forEach(function(period) {
  328. // Set the drawing style.
  329. ctx.fillStyle = colors['default'];
  330. ctx.strokeStyle = colors['default'];
  331. if (colors[event.name]) {
  332. ctx.fillStyle = colors[event.name];
  333. ctx.strokeStyle = colors[event.name];
  334. } else if (colors[event.category]) {
  335. ctx.fillStyle = colors[event.category];
  336. ctx.strokeStyle = colors[event.category];
  337. }
  338. // Draw the timeline
  339. var timelineHeadPosition = x + period.begin * ratio;
  340. if ( ! isSectionEvent(event)) {
  341. ctx.fillRect(timelineHeadPosition, h + 3, 2, 6);
  342. ctx.fillRect(timelineHeadPosition, h, (period.end - period.begin) * ratio || 2, 6);
  343. } else {
  344. var timelineTailPosition = x + period.end * ratio;
  345. ctx.beginPath();
  346. ctx.moveTo(timelineHeadPosition, h);
  347. ctx.lineTo(timelineHeadPosition, h + 11);
  348. ctx.lineTo(timelineHeadPosition + 8, h);
  349. ctx.lineTo(timelineHeadPosition, h);
  350. ctx.fill();
  351. ctx.closePath();
  352. ctx.stroke();
  353. ctx.beginPath();
  354. ctx.moveTo(timelineTailPosition, h);
  355. ctx.lineTo(timelineTailPosition, h + 11);
  356. ctx.lineTo(timelineTailPosition - 8, h);
  357. ctx.lineTo(timelineTailPosition, h);
  358. ctx.fill();
  359. ctx.closePath();
  360. ctx.stroke();
  361. ctx.beginPath();
  362. ctx.moveTo(timelineHeadPosition, h);
  363. ctx.lineTo(timelineTailPosition, h);
  364. ctx.lineTo(timelineTailPosition, h + 2);
  365. ctx.lineTo(timelineHeadPosition, h + 2);
  366. ctx.lineTo(timelineHeadPosition, h);
  367. ctx.fill();
  368. ctx.closePath();
  369. ctx.stroke();
  370. }
  371. });
  372. h += 30;
  373. ctx.beginPath();
  374. ctx.strokeStyle = \"#dfdfdf\";
  375. ctx.moveTo(0, h - 10);
  376. ctx.lineTo(width, h - 10);
  377. ctx.closePath();
  378. ctx.stroke();
  379. });
  380. h = space;
  381. // For each event, draw the label.
  382. mainEvents.forEach(function(event) {
  383. ctx.fillStyle = \"#444\";
  384. ctx.font = \"12px sans-serif\";
  385. text = event.name;
  386. ms = \" ~ \" + (event.totaltime < 1 ? event.totaltime : parseInt(event.totaltime, 10)) + \" ms\";
  387. if (x + event.starttime * ratio + ctx.measureText(text + ms).width > width) {
  388. ctx.textAlign = \"end\";
  389. ctx.font = \"10px sans-serif\";
  390. xc = x + event.endtime * ratio - 1;
  391. ctx.fillText(ms, xc, h);
  392. xc -= ctx.measureText(ms).width;
  393. ctx.font = \"12px sans-serif\";
  394. ctx.fillText(text, xc, h);
  395. } else {
  396. ctx.textAlign = \"start\";
  397. ctx.font = \"12px sans-serif\";
  398. xc = x + event.starttime * ratio + 1;
  399. ctx.fillText(text, xc, h);
  400. xc += ctx.measureText(text).width;
  401. ctx.font = \"10px sans-serif\";
  402. ctx.fillText(ms, xc, h);
  403. }
  404. h += gapPerEvent;
  405. });
  406. };
  407. this.drawAll = function(width, threshold)
  408. {
  409. \"use strict\";
  410. width = width || getContainerWidth();
  411. threshold = threshold || this.getThreshold();
  412. var self = this;
  413. _requests.forEach(function(request) {
  414. self.drawOne(request, maxRequestTime, threshold, width);
  415. });
  416. };
  417. this.getThreshold = function() {
  418. var threshold = localStorage.getItem(_storagePrefix + '/threshold');
  419. if (threshold === null) {
  420. return _threshold;
  421. }
  422. _threshold = parseInt(threshold);
  423. return _threshold;
  424. };
  425. this.setThreshold = function(threshold)
  426. {
  427. _threshold = threshold;
  428. localStorage.setItem(_storagePrefix + '/threshold', threshold);
  429. return this;
  430. };
  431. };
  432. function canvasAutoUpdateOnResizeAndSubmit(e) {
  433. e.preventDefault();
  434. canvasManager.drawAll();
  435. }
  436. function canvasAutoUpdateOnThresholdChange(e) {
  437. canvasManager
  438. .setThreshold(query('input[name=\"threshold\"]').value)
  439. .drawAll();
  440. }
  441. var requests_data = {
  442. \"max\": ";
  443. // line 391
  444. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), "__section__"), "endtime")), "html", null, true);
  445. echo ",
  446. \"requests\": [
  447. ";
  448. // line 393
  449. echo $context["__internal_3b2fd072fb460ca9473bafe1d9c66a63138ee454"]->getdump_request_data((isset($context["token"]) ? $context["token"] : $this->getContext($context, "token")), (isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), $this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), "__section__"), "origin"));
  450. echo "
  451. ";
  452. // line 395
  453. if (twig_length_filter($this->env, $this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "children"))) {
  454. // line 396
  455. echo " ,
  456. ";
  457. // line 397
  458. $context['_parent'] = (array) $context;
  459. $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["profile"]) ? $context["profile"] : $this->getContext($context, "profile")), "children"));
  460. $context['loop'] = array(
  461. 'parent' => $context['_parent'],
  462. 'index0' => 0,
  463. 'index' => 1,
  464. 'first' => true,
  465. );
  466. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
  467. $length = count($context['_seq']);
  468. $context['loop']['revindex0'] = $length - 1;
  469. $context['loop']['revindex'] = $length;
  470. $context['loop']['length'] = $length;
  471. $context['loop']['last'] = 1 === $length;
  472. }
  473. foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
  474. // line 398
  475. echo $context["__internal_3b2fd072fb460ca9473bafe1d9c66a63138ee454"]->getdump_request_data($this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "token"), (isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), $this->getAttribute($this->getAttribute((isset($context["child"]) ? $context["child"] : $this->getContext($context, "child")), "getcollector", array(0 => "time"), "method"), "events"), $this->getAttribute($this->getAttribute($this->getAttribute((isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector")), "events"), "__section__"), "origin"));
  476. echo (($this->getAttribute((isset($context["loop"]) ? $context["loop"] : $this->getContext($context, "loop")), "last")) ? ("") : (","));
  477. echo "
  478. ";
  479. ++$context['loop']['index0'];
  480. ++$context['loop']['index'];
  481. $context['loop']['first'] = false;
  482. if (isset($context['loop']['length'])) {
  483. --$context['loop']['revindex0'];
  484. --$context['loop']['revindex'];
  485. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  486. }
  487. }
  488. $_parent = $context['_parent'];
  489. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
  490. $context = array_merge($_parent, array_intersect_key($context, $_parent));
  491. }
  492. // line 401
  493. echo " ]
  494. };
  495. var canvasManager = new CanvasManager(requests_data.requests, requests_data.max);
  496. query('input[name=\"threshold\"]').value = canvasManager.getThreshold();
  497. canvasManager.drawAll();
  498. // Update the colors of legends.
  499. var timelineLegends = document.querySelectorAll('.sf-profiler-timeline > .legends > span[data-color]');
  500. for (var i = 0; i < timelineLegends.length; ++i) {
  501. var timelineLegend = timelineLegends[i];
  502. timelineLegend.style.borderLeftColor = timelineLegend.getAttribute('data-color');
  503. }
  504. // Bind event handlers
  505. var elementTimelineControl = query('#timeline-control'),
  506. elementThresholdControl = query('input[name=\"threshold\"]');
  507. window.onresize = canvasAutoUpdateOnResizeAndSubmit;
  508. elementTimelineControl.onsubmit = canvasAutoUpdateOnResizeAndSubmit;
  509. elementThresholdControl.onclick = canvasAutoUpdateOnThresholdChange;
  510. elementThresholdControl.onchange = canvasAutoUpdateOnThresholdChange;
  511. elementThresholdControl.onkeyup = canvasAutoUpdateOnThresholdChange;
  512. //]]></script>
  513. ";
  514. }
  515. // line 431
  516. public function getdump_request_data($_token = null, $_profile = null, $_events = null, $_origin = null)
  517. {
  518. $context = $this->env->mergeGlobals(array(
  519. "token" => $_token,
  520. "profile" => $_profile,
  521. "events" => $_events,
  522. "origin" => $_origin,
  523. ));
  524. $blocks = array();
  525. ob_start();
  526. try {
  527. // line 432
  528. $context["__internal_ed8d8a4f0e986485f63b90d4938c60bc64c71f7c"] = $this;
  529. // line 433
  530. echo " {
  531. \"id\": \"";
  532. // line 434
  533. echo twig_escape_filter($this->env, (isset($context["token"]) ? $context["token"] : $this->getContext($context, "token")), "html", null, true);
  534. echo "\",
  535. \"left\": ";
  536. // line 435
  537. echo twig_escape_filter($this->env, sprintf("%F", ($this->getAttribute($this->getAttribute((isset($context["events"]) ? $context["events"] : $this->getContext($context, "events")), "__section__"), "origin") - (isset($context["origin"]) ? $context["origin"] : $this->getContext($context, "origin")))), "html", null, true);
  538. echo ",
  539. \"events\": [
  540. ";
  541. // line 437
  542. echo $context["__internal_ed8d8a4f0e986485f63b90d4938c60bc64c71f7c"]->getdump_events((isset($context["events"]) ? $context["events"] : $this->getContext($context, "events")));
  543. echo "
  544. ]
  545. }
  546. ";
  547. } catch (Exception $e) {
  548. ob_end_clean();
  549. throw $e;
  550. }
  551. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  552. }
  553. // line 442
  554. public function getdump_events($_events = null)
  555. {
  556. $context = $this->env->mergeGlobals(array(
  557. "events" => $_events,
  558. ));
  559. $blocks = array();
  560. ob_start();
  561. try {
  562. // line 443
  563. $context['_parent'] = (array) $context;
  564. $context['_seq'] = twig_ensure_traversable((isset($context["events"]) ? $context["events"] : $this->getContext($context, "events")));
  565. $context['loop'] = array(
  566. 'parent' => $context['_parent'],
  567. 'index0' => 0,
  568. 'index' => 1,
  569. 'first' => true,
  570. );
  571. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
  572. $length = count($context['_seq']);
  573. $context['loop']['revindex0'] = $length - 1;
  574. $context['loop']['revindex'] = $length;
  575. $context['loop']['length'] = $length;
  576. $context['loop']['last'] = 1 === $length;
  577. }
  578. foreach ($context['_seq'] as $context["name"] => $context["event"]) {
  579. // line 444
  580. if (("__section__" != (isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")))) {
  581. // line 445
  582. echo " {
  583. \"name\": \"";
  584. // line 446
  585. echo twig_escape_filter($this->env, (isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")), "html", null, true);
  586. echo "\",
  587. \"category\": \"";
  588. // line 447
  589. echo twig_escape_filter($this->env, $this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "category"), "html", null, true);
  590. echo "\",
  591. \"origin\": ";
  592. // line 448
  593. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "origin")), "html", null, true);
  594. echo ",
  595. \"starttime\": ";
  596. // line 449
  597. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "starttime")), "html", null, true);
  598. echo ",
  599. \"endtime\": ";
  600. // line 450
  601. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "endtime")), "html", null, true);
  602. echo ",
  603. \"totaltime\": ";
  604. // line 451
  605. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "totaltime")), "html", null, true);
  606. echo ",
  607. \"periods\": [";
  608. // line 453
  609. $context['_parent'] = (array) $context;
  610. $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["event"]) ? $context["event"] : $this->getContext($context, "event")), "periods"));
  611. $context['loop'] = array(
  612. 'parent' => $context['_parent'],
  613. 'index0' => 0,
  614. 'index' => 1,
  615. 'first' => true,
  616. );
  617. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
  618. $length = count($context['_seq']);
  619. $context['loop']['revindex0'] = $length - 1;
  620. $context['loop']['revindex'] = $length;
  621. $context['loop']['length'] = $length;
  622. $context['loop']['last'] = 1 === $length;
  623. }
  624. foreach ($context['_seq'] as $context["_key"] => $context["period"]) {
  625. // line 454
  626. echo "{\"begin\": ";
  627. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["period"]) ? $context["period"] : $this->getContext($context, "period")), 0)), "html", null, true);
  628. echo ", \"end\": ";
  629. echo twig_escape_filter($this->env, sprintf("%F", $this->getAttribute((isset($context["period"]) ? $context["period"] : $this->getContext($context, "period")), 1)), "html", null, true);
  630. echo "}";
  631. echo (($this->getAttribute((isset($context["loop"]) ? $context["loop"] : $this->getContext($context, "loop")), "last")) ? ("") : (", "));
  632. ++$context['loop']['index0'];
  633. ++$context['loop']['index'];
  634. $context['loop']['first'] = false;
  635. if (isset($context['loop']['length'])) {
  636. --$context['loop']['revindex0'];
  637. --$context['loop']['revindex'];
  638. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  639. }
  640. }
  641. $_parent = $context['_parent'];
  642. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['period'], $context['_parent'], $context['loop']);
  643. $context = array_merge($_parent, array_intersect_key($context, $_parent));
  644. // line 456
  645. echo "]
  646. }";
  647. // line 457
  648. echo (($this->getAttribute((isset($context["loop"]) ? $context["loop"] : $this->getContext($context, "loop")), "last")) ? ("") : (","));
  649. echo "
  650. ";
  651. }
  652. ++$context['loop']['index0'];
  653. ++$context['loop']['index'];
  654. $context['loop']['first'] = false;
  655. if (isset($context['loop']['length'])) {
  656. --$context['loop']['revindex0'];
  657. --$context['loop']['revindex'];
  658. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  659. }
  660. }
  661. $_parent = $context['_parent'];
  662. unset($context['_seq'], $context['_iterated'], $context['name'], $context['event'], $context['_parent'], $context['loop']);
  663. $context = array_merge($_parent, array_intersect_key($context, $_parent));
  664. } catch (Exception $e) {
  665. ob_end_clean();
  666. throw $e;
  667. }
  668. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  669. }
  670. // line 462
  671. public function getdisplay_timeline($_id = null, $_events = null, $_colors = null)
  672. {
  673. $context = $this->env->mergeGlobals(array(
  674. "id" => $_id,
  675. "events" => $_events,
  676. "colors" => $_colors,
  677. ));
  678. $blocks = array();
  679. ob_start();
  680. try {
  681. // line 463
  682. echo " <div class=\"sf-profiler-timeline\">
  683. <div class=\"legends\">
  684. ";
  685. // line 465
  686. $context['_parent'] = (array) $context;
  687. $context['_seq'] = twig_ensure_traversable((isset($context["colors"]) ? $context["colors"] : $this->getContext($context, "colors")));
  688. foreach ($context['_seq'] as $context["category"] => $context["color"]) {
  689. // line 466
  690. echo " <span data-color=\"";
  691. echo twig_escape_filter($this->env, (isset($context["color"]) ? $context["color"] : $this->getContext($context, "color")), "html", null, true);
  692. echo "\">";
  693. echo twig_escape_filter($this->env, (isset($context["category"]) ? $context["category"] : $this->getContext($context, "category")), "html", null, true);
  694. echo "</span>
  695. ";
  696. }
  697. $_parent = $context['_parent'];
  698. unset($context['_seq'], $context['_iterated'], $context['category'], $context['color'], $context['_parent'], $context['loop']);
  699. $context = array_merge($_parent, array_intersect_key($context, $_parent));
  700. // line 468
  701. echo " </div>
  702. <canvas width=\"680\" height=\"\" id=\"";
  703. // line 469
  704. echo twig_escape_filter($this->env, (isset($context["id"]) ? $context["id"] : $this->getContext($context, "id")), "html", null, true);
  705. echo "\" class=\"timeline\"></canvas>
  706. </div>
  707. ";
  708. } catch (Exception $e) {
  709. ob_end_clean();
  710. throw $e;
  711. }
  712. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  713. }
  714. public function getTemplateName()
  715. {
  716. return "WebProfilerBundle:Collector:time.html.twig";
  717. }
  718. public function isTraitable()
  719. {
  720. return false;
  721. }
  722. public function getDebugInfo()
  723. {
  724. return array ( 790 => 469, 787 => 468, 776 => 466, 772 => 465, 768 => 463, 755 => 462, 729 => 457, 726 => 456, 707 => 454, 690 => 453, 686 => 451, 682 => 450, 678 => 449, 674 => 448, 670 => 447, 666 => 446, 663 => 445, 661 => 444, 644 => 443, 633 => 442, 618 => 437, 613 => 435, 609 => 434, 606 => 433, 604 => 432, 590 => 431, 558 => 401, 540 => 398, 523 => 397, 520 => 396, 518 => 395, 513 => 393, 508 => 391, 181 => 87, 173 => 85, 166 => 82, 161 => 80, 156 => 77, 150 => 75, 144 => 73, 126 => 61, 112 => 52, 109 => 51, 28 => 3, 205 => 71, 178 => 86, 176 => 61, 170 => 60, 160 => 59, 132 => 47, 102 => 34, 90 => 41, 81 => 24, 204 => 94, 191 => 70, 185 => 68, 167 => 64, 164 => 63, 153 => 62, 147 => 58, 138 => 55, 134 => 54, 127 => 52, 122 => 51, 95 => 43, 91 => 35, 87 => 40, 84 => 25, 49 => 13, 27 => 3, 77 => 24, 71 => 20, 68 => 30, 62 => 27, 58 => 25, 56 => 13, 44 => 20, 388 => 160, 385 => 159, 379 => 158, 377 => 157, 370 => 156, 366 => 155, 362 => 153, 360 => 152, 357 => 151, 354 => 150, 352 => 149, 344 => 147, 342 => 146, 339 => 145, 330 => 140, 327 => 139, 320 => 135, 314 => 131, 311 => 130, 308 => 129, 306 => 128, 301 => 125, 292 => 120, 289 => 119, 287 => 118, 282 => 115, 280 => 114, 275 => 111, 273 => 110, 268 => 107, 264 => 105, 258 => 103, 254 => 101, 247 => 97, 240 => 93, 234 => 89, 231 => 88, 226 => 86, 221 => 83, 215 => 79, 212 => 78, 209 => 73, 207 => 95, 202 => 73, 196 => 92, 193 => 68, 190 => 89, 188 => 67, 183 => 63, 177 => 59, 174 => 67, 171 => 84, 169 => 56, 162 => 53, 143 => 56, 130 => 53, 107 => 27, 103 => 25, 97 => 23, 88 => 20, 82 => 19, 79 => 35, 76 => 34, 73 => 33, 67 => 23, 61 => 12, 47 => 21, 36 => 5, 70 => 24, 63 => 16, 46 => 12, 39 => 6, 22 => 1, 163 => 81, 155 => 50, 152 => 49, 149 => 48, 145 => 57, 139 => 71, 123 => 35, 120 => 50, 115 => 44, 111 => 38, 108 => 41, 106 => 36, 101 => 45, 98 => 32, 96 => 31, 92 => 21, 80 => 32, 74 => 21, 64 => 19, 55 => 24, 52 => 14, 50 => 22, 43 => 9, 41 => 19, 37 => 8, 32 => 6, 29 => 6, 356 => 163, 347 => 160, 343 => 159, 340 => 158, 335 => 157, 333 => 141, 325 => 138, 323 => 149, 316 => 145, 309 => 141, 302 => 137, 295 => 121, 288 => 129, 281 => 125, 274 => 121, 259 => 109, 252 => 138, 245 => 96, 238 => 97, 228 => 87, 225 => 88, 217 => 83, 214 => 82, 211 => 81, 206 => 78, 203 => 77, 198 => 69, 192 => 72, 184 => 88, 182 => 64, 172 => 64, 165 => 54, 158 => 56, 154 => 48, 151 => 47, 148 => 74, 140 => 42, 135 => 47, 131 => 42, 128 => 45, 125 => 44, 119 => 57, 116 => 31, 113 => 40, 110 => 42, 104 => 35, 100 => 24, 93 => 42, 89 => 29, 86 => 29, 83 => 28, 75 => 23, 72 => 22, 69 => 20, 66 => 20, 60 => 15, 54 => 12, 51 => 12, 48 => 15, 42 => 7, 38 => 18, 35 => 6, 33 => 4, 30 => 5,);
  725. }
  726. }