Parent5446 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/54579
Change subject: Added profiling to MWHttpRequest and Http.
......................................................................
Added profiling to MWHttpRequest and Http.
Added profile calls to various functions in
MWHttpRequest as well as to the wrapper
function Http::request.
Change-Id: I7f2819a075891dbc565a7524d56e7bf077ab089a
---
M includes/HttpFunctions.php
1 file changed, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/79/54579/1
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index dc65c67..36bad66 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -58,6 +58,8 @@
*/
public static function request( $method, $url, $options = array() ) {
wfDebug( "HTTP: $method: $url\n" );
+ wfProfileIn( __METHOD__ . "-$method" );
+
$options['method'] = strtoupper( $method );
if ( !isset( $options['timeout'] ) ) {
@@ -68,8 +70,11 @@
$status = $req->execute();
if ( $status->isOK() ) {
- return $req->getContent();
+ $content = $req->getContent();
+ wfProfileOut( __METHOD__ . "-$method" );
+ return $content;
} else {
+ wfProfileOut( __METHOD__ . "-$method" );
return false;
}
}
@@ -427,6 +432,8 @@
public function execute() {
global $wgTitle;
+ wfProfileIn( __METHOD__ );
+
$this->content = "";
if ( strtoupper( $this->method ) == "HEAD" ) {
@@ -446,6 +453,8 @@
if ( !isset( $this->reqHeaders['User-Agent'] ) ) {
$this->setUserAgent( Http::userAgent() );
}
+
+ wfProfileOut( __METHOD__ );
}
/**
@@ -454,6 +463,8 @@
* found in an array in the member variable headerList.
*/
protected function parseHeader() {
+ wfProfileIn( __METHOD__ );
+
$lastname = "";
foreach ( $this->headerList as $header ) {
@@ -470,6 +481,8 @@
}
$this->parseCookies();
+
+ wfProfileOut( __METHOD__ );
}
/**
@@ -603,6 +616,8 @@
* Parse the cookies in the response headers and store them in the
cookie jar.
*/
protected function parseCookies() {
+ wfProfileIn( __METHOD__ );
+
if ( !$this->cookieJar ) {
$this->cookieJar = new CookieJar;
}
@@ -613,6 +628,8 @@
$this->cookieJar->parseCookieResponseHeader(
$cookie, $url['host'] );
}
}
+
+ wfProfileIn( __METHOD__ );
}
/**
@@ -700,9 +717,12 @@
}
public function execute() {
+ wfProfileIn( __METHOD__ );
+
parent::execute();
if ( !$this->status->isOK() ) {
+ wfProfileOut( __METHOD__ );
return $this->status;
}
@@ -777,6 +797,8 @@
$this->parseHeader();
$this->setStatus();
+ wfProfileOut( __METHOD__ );
+
return $this->status;
}
@@ -811,6 +833,8 @@
}
public function execute() {
+ wfProfileIn( __METHOD__ );
+
parent::execute();
if ( is_array( $this->postData ) ) {
@@ -930,6 +954,8 @@
}
fclose( $fh );
+ wfProfileOut( __METHOD__ );
+
return $this->status;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/54579
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f2819a075891dbc565a7524d56e7bf077ab089a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits