/**
  * test file writing stops at max size. max size is set to 10 in setUp, so there is only space for 1 log
  * @todo doesn't work as fileSize always returns the same value as at first read. So test manually instead.
  */
 public function disabletestMaxSize()
 {
     AmfphpMonitor::addTime('test time 0 ');
     $this->object->filterSerializedResponse(null);
     AmfphpMonitor::addTime('should not log');
     $this->object->filterSerializedResponse(null);
     $this->object->filterSerializedResponse(null);
     $this->object->filterSerializedResponse(null);
     $this->object->filterSerializedResponse(null);
     $log = file_get_contents($this->logPath);
     //echo $log;
     //echo "ertert " . filesize($this->logPath);
     $this->assertTrue(strpos($log, 'should not log') === false);
 }
Exemple #2
0
 public function testCustomMonitorTime()
 {
     usleep(200000);
     AmfphpMonitor::addTime('operation 1');
     usleep(200000);
     AmfphpMonitor::addTime('operation 2');
     usleep(200000);
     AmfphpMonitor::addTime('operation 3');
     return 'bla';
 }
 /**
  * looks at the response and sets the explicit type field so that the serializer sends it properly
  * @param mixed $deserializedResponse
  * @return mixed
  */
 public function filterDeserializedResponse($deserializedResponse)
 {
     $deserializedResponse = Amfphp_Core_Amf_Util::applyFunctionToContainedObjects($deserializedResponse, array($this, 'convertStringFromPhpToClientCharsets'));
     if (class_exists('AmfphpMonitor', false)) {
         AmfphpMonitor::addTime('Response Charset Conversion');
     }
     return $deserializedResponse;
 }
 /**
  * looks at the outgoing packet and sets the explicit type field so that the serializer sends it properly
  * @param mixed $deserializedResponse
  * @return mixed
  */
 public function filterDeserializedResponse($deserializedResponse)
 {
     $ret = null;
     if ($this->scanEnabled) {
         $ret = Amfphp_Core_Amf_Util::applyFunctionToContainedObjects($deserializedResponse, array($this, 'markExplicitType'));
     }
     if (class_exists('AmfphpMonitor', false)) {
         AmfphpMonitor::addTime('Response Value Object Conversion');
     }
     return $ret;
 }
Exemple #5
0
 /**
  * measures time since previous call (or start time time if this the first call) , and stores it in the times array
  * public and static so that services can call this too to add custom times.
  * updates lastMeasuredTime
  * @param string $name 
  */
 public static function addTime($name)
 {
     $now = round(microtime(true) * 1000);
     $timeSinceLastMeasure = $now - self::$lastMeasuredTime;
     self::$times[$name] = $timeSinceLastMeasure;
     self::$lastMeasuredTime = $now;
 }