public void Run(ProfileConfiguration configuration)
        {
            foreach (var profiledClass in this.ProfiledClasses
                     .Where(c => !configuration.ClassNames.Any() || configuration.ClassNames.Contains(c.Name))
                     .Where(c => c.Methods.Any(m => !m.IsAsync)))
            {
                var instance = profiledClass.CreateInstance(this.Cluster);

                if (profiledClass.SetupMethod != null)
                {
                    var setup = profiledClass.SetupMethod.Compile(instance);
                    this.Output.WriteLine(ConsoleColor.Green, $"Running setup for {profiledClass.Type.Name}");
                    setup();
                }

                foreach (var profiledMethod in profiledClass.Methods.Where(m => !m.IsAsync))
                {
                    var resultsDirectory = Path.Combine(this.OutputPath, profiledClass.Type.Name, profiledMethod.MethodInfo.Name);
                    var action           = profiledMethod.Compile(instance);

                    this.Output.WriteLine(
                        ConsoleColor.Green,
                        $"{this.Name} profiling {profiledClass.Type.Name}.{profiledMethod.MethodInfo.Name}");

                    using (this.BeginProfiling(resultsDirectory))
                    {
                        for (var i = 0; i < profiledMethod.Attribute.Iterations; i++)
                        {
                            action();
                        }
                    }
                }
            }
        }
        public static ProfileConfiguration Parse(string[] args)
        {
            var configuration = new ProfileConfiguration();

            var classNames = new HashSet <string>();
            var classIndex = Array.IndexOf(args, "Class");

            if (classIndex > -1 && args.Length > classIndex + 1)
            {
                foreach (var className in args[classIndex + 1].Split(','))
                {
                    classNames.Add(className);
                }
            }

            configuration.ClassNames = classNames;
            return(configuration);
        }