public static int Main(string[] arguments)
        {
#if FEATURE_PROFILING
            var configuration = ProfileConfiguration.Parse(arguments);
            Console.WriteLine("Running Profiling with the following:");
            Console.WriteLine($"- SdkPath: {SdkPath}");
            Console.WriteLine($"- OutputPath: {OutputPath}");
            Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

            using (var cluster = new ProfilingCluster())
            {
                foreach (var profilingFactory in CreateProfilingFactory(cluster))
                {
                    profilingFactory.Run(configuration);
                    profilingFactory.RunAsync(configuration).Wait();
                }
            }

            return(0);
#else
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Tests.exe is not built with Profiling support");
            Console.ResetColor();
            return(2);
#endif
        }
 public TimelineProfileFactory(
     string sdkPath,
     string outputPath,
     ProfilingCluster cluster,
     Assembly assembly,
     IColoredWriter output) : base(sdkPath, outputPath, cluster, assembly, output)
 {
 }
        private static IEnumerable <IProfileFactory> CreateProfilingFactory(ProfilingCluster cluster)
        {
            yield return(new PerformanceProfileFactory(SdkPath, OutputPath, cluster, Assembly.GetEntryAssembly(), new ColoredConsoleWriter()));

            yield return(new TimelineProfileFactory(SdkPath, OutputPath, cluster, Assembly.GetEntryAssembly(), new ColoredConsoleWriter()));

            yield return(new MemoryProfileFactory(SdkPath, OutputPath, cluster, Assembly.GetEntryAssembly(), new ColoredConsoleWriter()));
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark ");
            }

            var arguments = args.Skip(1).ToArray();

            if (args[0].Equals("Profile", StringComparison.OrdinalIgnoreCase))
            {
#if FEATURE_PROFILING
                var configuration = ProfileConfiguration.Parse(arguments);
                Console.WriteLine("Running Profiling with the following:");
                Console.WriteLine($"- SdkPath: {SdkPath}");
                Console.WriteLine($"- OutputPath: {OutputPath}");
                Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

                using (var cluster = new ProfilingCluster())
                {
                    foreach (var profilingFactory in CreateProfilingFactory(cluster))
                    {
                        profilingFactory.Run(configuration);
                        profilingFactory.RunAsync(configuration).Wait();
                    }
                }
#else
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Tests.exe is not built with Profiling support");
                Console.ResetColor();
                Environment.Exit(9);
#endif
            }
            else if (args[0].Equals("Benchmark", StringComparison.OrdinalIgnoreCase))
            {
                Console.WriteLine("Running Benchmarking.");
                if (args.Count() > 1 && args[1].Equals("non-interactive", StringComparison.OrdinalIgnoreCase))
                {
                    Console.WriteLine("Running in Non-Interactive mode.");
                    foreach (var benchmarkType in GetBenchmarkTypes())
                    {
                        BenchmarkRunner.Run(benchmarkType);
                    }
                    return;
                }

                Console.WriteLine("Running in Interactive mode.");
                var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
                benchmarkSwitcher.Run(arguments);
            }
        }
Esempio n. 5
0
        public BulkProfileTests(ProfilingCluster cluster)
        {
            _client = cluster.Client;

            if (_client.IndexExists(IndexName).Exists)
            {
                _client.DeleteIndex(IndexName);
            }

            var createIndexResponse = _client.CreateIndex(IndexName);

            if (!createIndexResponse.IsValid)
            {
                Console.WriteLine($"invalid response creating index: {createIndexResponse.ServerError?.Error?.Reason}");
            }
        }
Esempio n. 6
0
        // TODO: Renamed this from Main to TestMain because of a bug with Resharper and running unit tests
        // in Visual Studio with .NET Core: https://youtrack.jetbrains.com/issue/RSRP-464233
        // Once this is fixed, look at renaming back and removing additional packages. See https://github.com/elastic/elasticsearch-net/pull/2793
        public static void TestMain(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark ");
            }

            var arguments = args.Skip(1).ToArray();

            if (args[0].Equals("Profile", StringComparison.OrdinalIgnoreCase))
            {
#if DOTNETCORE
                Console.Error.WriteLine("DotTrace Profiling is not currently supported on .NET Core");
                return;
#else
                var configuration = ProfileConfiguration.Parse(arguments);
                Console.WriteLine("Running Profiling with the following:");
                Console.WriteLine($"- SdkPath: {SdkPath}");
                Console.WriteLine($"- OutputPath: {OutputPath}");
                Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

                using (var cluster = new ProfilingCluster())
                {
                    foreach (var profilingFactory in CreateProfilingFactory(cluster))
                    {
                        profilingFactory.Run(configuration);
                        profilingFactory.RunAsync(configuration).Wait();
                    }
                }
#endif
            }
            else if (args[0].Equals("Benchmark", StringComparison.OrdinalIgnoreCase))
            {
                var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
                benchmarkSwitcher.Run(arguments);
            }
        }
Esempio n. 7
0
 public SearchProfileTests(ProfilingCluster cluster)
 {
     _client = cluster.Client;
 }