◆ __construct()
- Parameters
-
53 $this->parent = $parent;
56 self::$HANDLERS[spl_object_hash($this)] = $this;
◆ printTimings()
static printTimings |
( |
|
$fp | ) |
|
|
static |
- Parameters
-
63 fwrite($fp,
"Minecraft" . PHP_EOL);
65 foreach(self::$HANDLERS as $timings){
66 $time = $timings->totalTime;
67 $count = $timings->count;
72 $avg = $time / $count;
74 fwrite($fp,
" " . $timings->name .
" Time: " . round($time * 1000000000) .
" Count: " . $count .
" Avg: " . round($avg * 1000000000) .
" Violations: " . $timings->violations . PHP_EOL);
83 $entities += count($level->getEntities());
84 foreach($level->getEntities() as $e){
85 if($e instanceof Living){
91 fwrite($fp,
"# Entities " . $entities . PHP_EOL);
92 fwrite($fp,
"# LivingEntities " . $livingEntities . PHP_EOL);
◆ reload()
97 foreach(self::$HANDLERS as $timings){
◆ remove()
169 unset(self::$HANDLERS[spl_object_hash($this)]);
◆ reset()
161 $this->violations = 0;
162 $this->curTickTotal = 0;
163 $this->totalTime = 0;
165 $this->timingDepth = 0;
◆ startTiming()
133 $this->start = microtime(
true);
134 if($this->parent !== null and ++$this->parent->timingDepth === 1){
135 $this->parent->start = $this->start;
◆ stopTiming()
142 if(--$this->timingDepth !== 0 or $this->start === 0){
146 $diff = microtime(
true) - $this->start;
147 $this->totalTime += $diff;
148 $this->curTickTotal += $diff;
152 if($this->parent !== null){
153 $this->parent->stopTiming();
◆ tick()
static tick |
( |
|
$measure = true | ) |
|
|
static |
- Parameters
-
110 foreach(self::$HANDLERS as $timings){
111 if($timings->curTickTotal > 0.05){
112 $timings->violations += round($timings->curTickTotal / 0.05);
114 $timings->curTickTotal = 0;
115 $timings->curCount = 0;
116 $timings->timingDepth = 0;
119 foreach(self::$HANDLERS as $timings){
120 $timings->totalTime -= $timings->curTickTotal;
121 $timings->count -= $timings->curCount;
123 $timings->curTickTotal = 0;
124 $timings->curCount = 0;
125 $timings->timingDepth = 0;
The documentation for this class was generated from the following file:
- src/pocketmine/event/TimingsHandler.php