Example #1
0
        /// <exception cref="System.Exception"/>
        public static void Main(string[] args)
        {
            System.Console.Out.WriteLine("Benchmark: RPC session establishment.");
            if (args.Length < 1)
            {
                PrintUsage();
            }
            Configuration conf  = new Configuration();
            int           count = System.Convert.ToInt32(args[0]);

            if (args.Length > 1)
            {
                conf.Set(KeytabFileKey, args[1]);
            }
            if (args.Length > 2)
            {
                conf.Set(UserNameKey, args[2]);
            }
            bool useDelegationToken = false;

            if (args.Length > 3)
            {
                useDelegationToken = Runtime.EqualsIgnoreCase(args[3], "useToken");
            }
            Level l = Level.Error;

            if (args.Length > 4)
            {
                l = Level.ToLevel(args[4]);
            }
            MiniRPCBenchmark mb          = new MiniRPCBenchmark(l);
            long             elapsedTime = 0;

            if (useDelegationToken)
            {
                System.Console.Out.WriteLine("Running MiniRPCBenchmark with delegation token authentication."
                                             );
                elapsedTime = mb.RunMiniBenchmarkWithDelegationToken(conf, count, KeytabFileKey,
                                                                     UserNameKey);
            }
            else
            {
                string auth = SecurityUtil.GetAuthenticationMethod(conf).ToString();
                System.Console.Out.WriteLine("Running MiniRPCBenchmark with " + auth + " authentication."
                                             );
                elapsedTime = mb.RunMiniBenchmark(conf, count, KeytabFileKey, UserNameKey);
            }
            System.Console.Out.WriteLine(VersionInfo.GetVersion());
            System.Console.Out.WriteLine("Number  of  connects: " + count);
            System.Console.Out.WriteLine("Average connect time: " + ((double)elapsedTime / count
                                                                     ));
        }