public function end()
    {
        if (!extension_loaded('xhprof')) {
            throw new Exception("XHProf extension is not loaded.", 1);
        }

        if ($this->started) {
            $this->data = xhprof_disable();

            require_once(sprintf('%s/xhprof_lib/utils/xhprof_runs.php', $this->dir));
            $xhprof_runs = new XHProfRuns_Default(ini_get("xhprof.output_dir"));
            $this->id = $xhprof_runs->save_run($this->data, $this->namespace);
        }

        return $this->started;
    }