protected function addRecord(\stdClass $record)
    {
        if ($record->isEntry) {
            $add = true;
            foreach ($this->filterEntryCallbacks as $callback) {
                $result = (int) $callback($record, true, $this);
                if ($result & self::SKIP) {
                    $add = false;
                }

                if ($result & self::STOP) {
                    break;
                }
            }

            if ($add) {
                $this->trace[$record->id] = $record;
            }

        } elseif (isset($this->trace[$record->id])) {
            $entryRecord = $this->trace[$record->id];

            $entryRecord->exited = true;
            $entryRecord->exitTime = $record->time;
            $entryRecord->deltaTime = $record->time - $entryRecord->time;
            $entryRecord->exitMemory = $record->memory;
            $entryRecord->deltaMemory = $record->memory - $entryRecord->memory;

            $remove = false;
            foreach ($this->filterExitCallbacks as $callback) {
                $result = (int) $callback($entryRecord, false, $this);
                if ($result & self::SKIP) {
                    $remove = true;
                }

                if ($result & self::STOP) {
                    break;
                }
            }

            if ($remove) {
                unset($this->trace[$record->id]);

            } elseif ($this->performStatistics) {
                if (!isset($this->statistic[$entryRecord->function])) {
                    $this->statistic[$entryRecord->function] = (object) [
                        'count' => 1,
                        'deltaTime' => $entryRecord->deltaTime,
                    ];

                } else {
                    $this->statistic[$entryRecord->function]->count += 1;
                    $this->statistic[$entryRecord->function]->deltaTime += $entryRecord->deltaTime;
                }
            }
        }
    }