public function add($name, $metrics)
    {
        $parts = $this->_parseName($name);
        $this->_merge($metrics);

        $current = $this;
        $length = count($parts);
        foreach ($parts as $index => $part) {
            list($name, $type) = $part;
            if (!isset($current->_children[$name])) {
                $current->_children[$name] = new static([
                    'name'   => $name,
                    'parent' => $current,
                    'type'   => $type
                ]);
            }
            uksort($current->_children, function ($a, $b) {
                $isFunction1 = substr($a, -2) === '()';
                $isFunction2 = substr($b, -2) === '()';
                if ($isFunction1 === $isFunction2) {
                    return strcmp($a, $b);
                }
                return $isFunction1 ? -1 : 1;
            });

            $current = $current->_children[$name];
            $current->_merge($metrics, $index === $length - 1);
        }
    }