public function profile($class, $methodName, array $methodArguments = null, $invocations = 1)
    {
        if (true === is_object($class)) {
            $className = get_class($class);
        } else {
            $className = $class;

            if (false === class_exists($className)) {
                throw new Doozr_Exception(
                    sprintf('%s does not exist.', $className)
                );
            }
        }

        $method   = new \ReflectionMethod($className, $methodName);
        $instance = null;

        if (true === $method->isStatic()) {
            // mark last profiling session as static
            $this->profileStatic = true;
        } elseif (false === $method->isStatic() && !($class instanceof $className)) {
            $class    = new \ReflectionClass($className);
            $instance = $class->newInstance();
        } else {
            $instance = $class;
        }

        $durations = [];

        for ($i = 0; $i < $invocations; ++$i) {
            $start = microseconds();

            if (is_null($methodArguments)) {
                $method->invoke($instance);
            } else {
                $method->invokeArgs($instance, $methodArguments);
            }

            $durations[] = microseconds() - $start;
        }

        $total = round(array_sum($durations), 8);

        return $this->profilingDetails([
            'class'     => $className,
            'method'    => $methodName,
            'arguments' => $methodArguments,
            'duration'  => [
                'microseconds' => [
                    'total'   => $total,
                    'average' => round($total / count($durations), 8),
                    'worst'   => round(max($durations), 8),
                ],
                'seconds' => [
                    'total'   => $total / 1000,
                    'average' => round($total / 1000 / count($durations), 8),
                    'worst'   => round(max($durations) / 1000, 8),
                ],
            ],
            'invocations' => $invocations,
        ]);
    }