PageRenderTime 47ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/app/cache/dev/twig/47/6b/a2f248ee0fded2944eab7b38a377.php

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