Skip to content

Commit 148d6d9

Browse files
committed
Updating branch with latest joomla/joomla-cms master: Re-merged already merged pull request #3 from nonumber/debug
2 parents fb3a471 + e4ead02 commit 148d6d9

File tree

4 files changed

+509
-245
lines changed

4 files changed

+509
-245
lines changed

administrator/language/en-GB/en-GB.plg_system_debug.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
44
; Note : All ini files need to be saved as UTF-8 - No BOM
55

6+
PLG_DEBUG_BYTES="Bytes"
67
PLG_DEBUG_CALL_STACK="Call Stack"
78
PLG_DEBUG_ERRORS="Errors"
89
PLG_DEBUG_EXPLAIN="Explain"
@@ -57,19 +58,26 @@ PLG_DEBUG_LANG_NOT_LOADED="Not loaded"
5758
PLG_DEBUG_LINK_FORMAT="Add xdebug.file_link_format directive to your php.ini file to have links for files"
5859
PLG_DEBUG_LOGGING_FIELDSET_LABEL="Logging"
5960
PLG_DEBUG_LOGS="Log Messages"
61+
PLG_DEBUG_MEMORY="Memory"
6062
PLG_DEBUG_MEMORY_USAGE="Memory Usage"
6163
PLG_DEBUG_NO_PROFILE="No SHOW PROFILE (maybe because there are more than 100 queries)"
6264
PLG_DEBUG_OTHER_QUERIES="OTHER Tables:"
6365
PLG_DEBUG_PROFILE="Profile"
6466
PLG_DEBUG_PROFILE_INFORMATION="Profile Information"
6567
PLG_DEBUG_QUERIES="Database Queries"
6668
PLG_DEBUG_QUERIES_LOGGED="%d Queries Logged"
69+
PLG_DEBUG_QUERIES_TIME="Database queries total: %s"
6770
PLG_DEBUG_QUERY_AFTER_LAST="After last query: %s"
71+
PLG_DEBUG_QUERY_DUPLICATES="Duplicate queries"
72+
PLG_DEBUG_QUERY_DUPLICATES_FOUND="Duplicate found!"
73+
PLG_DEBUG_QUERY_DUPLICATES_NUMBER="%s duplicates"
74+
PLG_DEBUG_QUERY_DUPLICATES_TOTAL_NUMBER="%s duplicate found!"
6875
PLG_DEBUG_QUERY_TIME="Query Time: %s"
6976
PLG_DEBUG_QUERY_TYPES_LOGGED="%d Query Types Logged, Sorted by Occurrences."
7077
PLG_DEBUG_QUERY_TYPE_AND_OCCURRENCES="%2$d × %1$s"
7178
PLG_DEBUG_SELECT_QUERIES="SELECT Tables:"
7279
PLG_DEBUG_SESSION="Session"
80+
PLG_DEBUG_TIME="Time"
7381
PLG_DEBUG_TITLE="Joomla! Debug Console"
7482
PLG_DEBUG_UNKNOWN_FILE="Unknown file"
7583
PLG_DEBUG_UNTRANSLATED_STRINGS="Untranslated Strings"

libraries/joomla/profiler/profiler.php

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ class JProfiler
3737
*/
3838
protected $buffer = null;
3939

40+
/**
41+
* @var array The profiling messages.
42+
* @since 12.1
43+
*/
44+
protected $marks = null;
45+
4046
/**
4147
* @var float
4248
* @since 12.1
@@ -64,8 +70,9 @@ class JProfiler
6470
*/
6571
public function __construct($prefix = '')
6672
{
67-
$this->start = $this->getmicrotime();
73+
$this->start = microtime(1);
6874
$this->prefix = $prefix;
75+
$this->marks = array();
6976
$this->buffer = array();
7077
}
7178

@@ -103,21 +110,32 @@ public static function getInstance($prefix = '')
103110
*/
104111
public function mark($label)
105112
{
106-
$current = self::getmicrotime() - $this->start;
113+
$current = microtime(1) - $this->start;
107114
$currentMem = memory_get_usage() / 1048576;
115+
116+
$m = (object) array(
117+
'prefix' => $this->prefix,
118+
'time' => ($current > $this->previousTime ? '+' : '-') . (($current - $this->previousTime) * 1000),
119+
'totalTime' => ($current * 1000),
120+
'memory' => ($currentMem > $this->previousMem ? '+' : '-') . ($currentMem - $this->previousMem),
121+
'totalMemory' => $currentMem,
122+
'label' => $label
123+
);
124+
$this->marks[] = $m;
125+
108126
$mark = sprintf(
109-
'<code>%s %.3f seconds (+%.3f); %0.2f MB (%s%0.3f) - %s</code>',
110-
$this->prefix,
111-
$current,
112-
$current - $this->previousTime,
113-
$currentMem,
114-
($currentMem > $this->previousMem) ? '+' : '', $currentMem - $this->previousMem,
115-
$label
127+
'%s %.3f seconds (%.3f); %0.2f MB (%0.3f) - %s',
128+
$m->prefix,
129+
$m->totalTime / 1000,
130+
$m->time / 1000,
131+
$m->totalMemory,
132+
$m->memory,
133+
$m->label
116134
);
135+
$this->buffer[] = $mark;
117136

118137
$this->previousTime = $current;
119138
$this->previousMem = $currentMem;
120-
$this->buffer[] = $mark;
121139

122140
return $mark;
123141
}
@@ -128,6 +146,7 @@ public function mark($label)
128146
* @return float The current time
129147
*
130148
* @since 11.1
149+
* @deprecated 12.3 (Platform) & 4.0 (CMS) - Use PHP's microtime(1)
131150
*/
132151
public static function getmicrotime()
133152
{
@@ -154,6 +173,19 @@ public function getMemory()
154173
* Get all profiler marks.
155174
*
156175
* Returns an array of all marks created since the Profiler object
176+
* was instantiated. Marks are objects as per {@link JProfiler::mark()}.
177+
*
178+
* @return array Array of profiler marks
179+
*/
180+
public function getMarks()
181+
{
182+
return $this->marks;
183+
}
184+
185+
/**
186+
* Get all profiler mark buffers.
187+
*
188+
* Returns an array of all mark buffers created since the Profiler object
157189
* was instantiated. Marks are strings as per {@link JProfiler::mark()}.
158190
*
159191
* @return array Array of profiler marks

media/cms/css/debug.css

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ div#system-debug {
4444
color: #ddd;
4545
font-size: 14px;
4646
cursor: pointer;
47-
text-decoration:none;
47+
text-decoration: none;
4848
}
4949

5050
#system-debug div.dbg-container {
@@ -77,13 +77,13 @@ div#system-debug {
7777

7878
#system-debug h4 {
7979
font-size: 14px;
80-
font-weight:bold;
80+
font-weight: bold;
8181
margin: 5px 0 0 0;
8282
}
8383

8484
#system-debug h5 {
8585
font-size: 13px;
86-
font-weight:bold;
86+
font-weight: bold;
8787
margin: 5px 0 0 0;
8888
}
8989

@@ -119,29 +119,61 @@ div#system-debug {
119119
font-size: 13px;
120120
}
121121

122-
123-
124122
#system-debug div.dbg-header.dbg-error {
125123
background-color: red;
126124
}
127125
#system-debug .dbg-warning {
128-
color: red;
129-
font-weight: bold;
130-
background-color: #ffffcc !important;
131-
}
132-
#system-debug table.dbg-query-table {
133-
margin: 0px 0px 6px;
134-
}
135-
#system-debug table.dbg-query-table th,
136-
#system-debug table.dbg-query-table td {
137-
padding: 3px 8px;
138-
}
139-
#system-debug .bar-ghosted {
140-
opacity: 0.2;
126+
color: red;
127+
font-weight: bold;
128+
background-color: #ffffcc !important;
141129
}
130+
142131
#system-debug .accordion {
143132
margin-bottom: 0;
144133
}
145134
#system-debug .dbg-noprofile {
146135
text-decoration: line-through;
147136
}
137+
138+
/* dbg-bars */
139+
#system-debug .alert,
140+
#system-debug .dbg-bars {
141+
margin-bottom: 10px;
142+
}
143+
#system-debug .dbg-bar-spacer {
144+
float: left;
145+
height: 100%;
146+
}
147+
/* dbg-bars-query */
148+
#system-debug .dbg-bars-query .dbg-bar {
149+
opacity: 0.3;
150+
height: 12px;
151+
margin-top: 3px;
152+
}
153+
#system-debug .dbg-bars-query:hover .dbg-bar {
154+
opacity: 0.6;
155+
height: 18px;
156+
margin-top: 0;
157+
}
158+
#system-debug .dbg-bars-query .dbg-bar:hover,
159+
#system-debug .dbg-bars-query .dbg-bar-active,
160+
#system-debug .dbg-bars-query:hover .dbg-bar-active {
161+
opacity: 1;
162+
height: 18px;
163+
margin-top: 0;
164+
}
165+
166+
/* dbg-query-table */
167+
#system-debug table.dbg-query-table {
168+
margin: 0px 0px 6px;
169+
}
170+
#system-debug table.dbg-query-table th,
171+
#system-debug table.dbg-query-table td {
172+
padding: 3px 8px;
173+
}
174+
175+
#system-debug .dbg-profile-list .label {
176+
display: inline-block;
177+
min-width: 60px;
178+
text-align: right;
179+
}

0 commit comments

Comments
 (0)