MediaWiki  1.23.0
ProfilerSimpleUDP.php
Go to the documentation of this file.
1 <?php
31  public function isPersistent() {
32  return true;
33  }
34 
35  public function logData() {
36  global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgUDPProfilerFormatString;
37 
38  $this->close();
39 
40  if ( isset( $this->mCollated['-total'] ) && $this->mCollated['-total']['real'] < $this->mMinimumTime ) {
41  # Less than minimum, ignore
42  return;
43  }
44 
45  if ( !function_exists( 'socket_create' ) ) {
46  # Sockets are not enabled
47  return;
48  }
49 
50  $sock = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
51  $plength = 0;
52  $packet = "";
53  foreach ( $this->mCollated as $entry => $pfdata ) {
54  if ( !isset( $pfdata['count'] )
55  || !isset( $pfdata['cpu'] )
56  || !isset( $pfdata['cpu_sq'] )
57  || !isset( $pfdata['real'] )
58  || !isset( $pfdata['real_sq'] ) ) {
59  continue;
60  }
61  $pfline = sprintf( $wgUDPProfilerFormatString, $this->getProfileID(), $pfdata['count'],
62  $pfdata['cpu'], $pfdata['cpu_sq'], $pfdata['real'], $pfdata['real_sq'], $entry );
63  $length = strlen( $pfline );
64  /* printf("<!-- $pfline -->"); */
65  if ( $length + $plength > 1400 ) {
66  socket_sendto( $sock, $packet, $plength, 0, $wgUDPProfilerHost, $wgUDPProfilerPort );
67  $packet = "";
68  $plength = 0;
69  }
70  $packet .= $pfline;
71  $plength += $length;
72  }
73  socket_sendto( $sock, $packet, $plength, 0x100, $wgUDPProfilerHost, $wgUDPProfilerPort );
74  }
75 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ProfilerSimpleUDP\isPersistent
isPersistent()
Return whether this profiler stores data.
Definition: ProfilerSimpleUDP.php:31
ProfilerSimpleUDP
ProfilerSimpleUDP class, that sends out messages for 'udpprofile' daemon (the one from http://git....
Definition: ProfilerSimpleUDP.php:30
Profiler\close
close()
Close opened profiling sections.
Definition: Profiler.php:253
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
ProfilerSimpleUDP\logData
logData()
Log the whole profiling data into the database.
Definition: ProfilerSimpleUDP.php:35
Profiler\getProfileID
getProfileID()
Definition: Profiler.php:177
ProfilerSimple
Simple profiler base class.
Definition: ProfilerSimple.php:29