Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
da35e257
Commit
da35e257
authored
Jul 27, 2012
by
Dayle Rees
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #898 from franzliedke/patch-13
[Profiler] Display page rendering time & memory usage
parents
0bc38ff2
6b5cccc1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
helpers.php
laravel/helpers.php
+12
-0
profiler.php
laravel/profiling/profiler.php
+4
-1
template.blade.php
laravel/profiling/template.blade.php
+2
-0
No files found.
laravel/helpers.php
View file @
da35e257
...
...
@@ -581,3 +581,15 @@ function get_cli_option($option, $default = null)
return
value
(
$default
);
}
/**
* Calculate the human-readable file size (with proper units).
*
* @param int $size
* @return string
*/
function
get_file_size
(
$size
)
{
$units
=
array
(
'Bytes'
,
'KiB'
,
'MiB'
,
'GiB'
,
'TiB'
,
'PiB'
,
'EiB'
);
return
@
round
(
$size
/
pow
(
1024
,
(
$i
=
floor
(
log
(
$size
,
1024
)))),
2
)
.
' '
.
$units
[
$i
];
}
\ No newline at end of file
laravel/profiling/profiler.php
View file @
da35e257
...
...
@@ -28,6 +28,9 @@ class Profiler {
// type applications, so we will not send anything in those scenarios.
if
(
!
Request
::
ajax
())
{
static
::
$data
[
'memory'
]
=
get_file_size
(
memory_get_usage
(
true
));
static
::
$data
[
'memory_peak'
]
=
get_file_size
(
memory_get_peak_usage
(
true
));
static
::
$data
[
'time'
]
=
number_format
((
microtime
(
true
)
-
LARAVEL_START
)
*
1000
,
2
);
return
render
(
'path: '
.
__DIR__
.
'/template'
.
BLADE_EXT
,
static
::
$data
);
}
}
...
...
laravel/profiling/template.blade.php
View file @
da35e257
...
...
@@ -61,6 +61,8 @@
@endif
</a>
</li>
<li><a
class=
"anbu-tab"
>
Time
<span
class=
"anbu-count"
>
{{ $time }}ms
</span></a></li>
<li><a
class=
"anbu-tab"
>
Memory
<span
class=
"anbu-count"
>
{{ $memory }} ({{ $memory_peak }})
</span></a></li>
<li
class=
"anbu-tab-right"
><a
id=
"anbu-hide"
href=
"#"
>
↦
</a></li>
<li
class=
"anbu-tab-right"
><a
id=
"anbu-close"
href=
"#"
>
×
</a></li>
<li
class=
"anbu-tab-right"
><a
id=
"anbu-zoom"
href=
"#"
>
⇅
</a></li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment