Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string        dir     = "";
            List <string> summary = new List <string>();

            foreach (StreamType type in types)
            {
                foreach (String address in streamListType)
                {
                    foreach (int size in data_size)
                    {
                        foreach (StreamFactory.StreamDataType ptype in ptypes)
                        {
                            foreach (CompressionType ctype in ctypes)
                            {
                                foreach (SynchronizerType synctype in synctypes)
                                {
                                    foreach (StreamOperation op in ops)
                                    {
                                        foreach (int chunksize in ChunkSize)
                                        {
                                            foreach (int ThreadPoolSize in num_threads)
                                            {
                                                foreach (int num_operations in n_operations)
                                                {
                                                    for (int i = 0; i < n_iterations; ++i)
                                                    {
                                                        byte[] data = new byte[size];
                                                        Random rnd  = new Random(DateTime.Now.Millisecond);
                                                        rnd.NextBytes(data);
                                                        Experiment e = new Experiment();

                                                        DateTime Date = new DateTime(DateTime.UtcNow.Ticks);

                                                        string HomeName   = String.Format("ExpHome-{0}", Date.ToString("yyyy-MM-dd"));
                                                        string Caller     = String.Format("{0}", Date.ToString("HH-mm-ss"));
                                                        string AppName    = Caller;
                                                        string StreamName = String.Format("{0}", rnd.Next());

                                                        Byte[] value = data;
                                                        // int num_operations = n_operations;

                                                        string RandString = Experiment.RandomString(4);
                                                        long   stime      = 0;
                                                        long   etime      = 0;

                                                        // Run the experiment
                                                        if (op == StreamOperation.RandomKeyGet ||
                                                            op == StreamOperation.RandomKeyGetMultipleSegments ||
                                                            op == StreamOperation.RandomKeyGetAll)
                                                        {
                                                            // Need to create the stream before reading it

                                                            stime = StreamFactory.NowUtc();
                                                            Console.WriteLine("Stime: " + stime);

                                                            StreamOperation tmp = StreamOperation.RandomKeySameValueAppend;
                                                            if (op == StreamOperation.RandomKeyGetAll)
                                                            {
                                                                tmp = StreamOperation.SameKeySameValueAppend;
                                                            }
                                                            e.Run(Caller, HomeName, AppName, StreamName,
                                                                  RandString,
                                                                  stime, etime,
                                                                  type, tmp,
                                                                  ptype,
                                                                  ctype, chunksize, ThreadPoolSize,
                                                                  value, num_operations,
                                                                  synctype, doCosts: true, address: address);
                                                            etime = StreamFactory.NowUtc();
                                                            Console.WriteLine("Etime: " + etime);
                                                            CallerInfo ci            = new CallerInfo(null, AppName, AppName, 1);
                                                            string     exp_directory = Path.GetFullPath((null != ci.workingDir) ? ci.workingDir : Directory.GetCurrentDirectory());
                                                            exp_directory = exp_directory + "/" + HomeName + "/" + AppName + "/" + StreamName;

                                                            File.Delete(exp_directory + "/log");

                                                            try
                                                            {
                                                                File.Delete(exp_directory + "/results");
                                                                File.Delete(exp_directory + "/exp");
                                                            }
                                                            catch
                                                            {
                                                            }

                                                            if (type == StreamType.Remote || type == StreamType.RemoteEnc)
                                                            {
                                                                Directory.Delete(exp_directory + "/0", true);
                                                                File.Delete(exp_directory + "/index_md.dat");
                                                            }
                                                        }

                                                        TimeSpan span = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
                                                        Console.WriteLine("Time: " + span.TotalSeconds);


                                                        if (op == StreamOperation.RandomKeyGetMultipleSegments || op == StreamOperation.RandomKeyGet)
                                                        {
                                                            e.Run(Caller, HomeName, AppName, StreamName, RandString, stime, etime, type, op, ptype, ctype, chunksize, ThreadPoolSize, value, num_multi_segment_operations, synctype, max_key: num_operations, doCosts: true, address: address);
                                                        }
                                                        else
                                                        {
                                                            e.Run(Caller, HomeName, AppName, StreamName, RandString, stime, etime, type, op, ptype, ctype, chunksize, ThreadPoolSize, value, num_operations, synctype, doCosts: true, address: address);
                                                        }

                                                        dir = e.exp_directory + "/../../../Results/";

                                                        Console.WriteLine("Completed: " + e.ToString());

                                                        span = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
                                                        Console.WriteLine("Time: " + span.TotalSeconds);

                                                        Console.WriteLine("====================================");

                                                        // Dump raw data from the experiment
                                                        e.Dump(Caller, HomeName, AppName, StreamName,
                                                               type, op, ptype,
                                                               value, num_operations, synctype);


                                                        // Get parsed data of the experiment
                                                        // if (i != 0)
                                                        //{
                                                        // Ignore the first iteration as warmup
                                                        summary.Add(e.exp_id);
                                                        List <string> ret = e.Analyze(type, value, num_operations);
                                                        summary.AddRange(ret);
                                                        //}
                                                        System.Threading.Thread.Sleep(2000);

                                                        e.Destroy();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            dir = dir + StreamFactory.PrettyNowUtc();
            if (!Directory.Exists(dir))
            {
                try
                {
                    Directory.CreateDirectory(dir);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            dir = dir + "/";
            File.WriteAllLines(dir + "Summary", summary);

            // Dump .dat files
            SummaryToDat(dir);

            // Thats it!
            Console.WriteLine("Done!");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string dir = "";
            List<string> summary = new List<string>();
            foreach (StreamType type in types)
            {
                foreach (String address in streamListType)
                {
                    foreach (int size in data_size)
                    {
                        foreach (StreamFactory.StreamPhysicalType ptype in ptypes)
                        {
                            foreach (CompressionType ctype in ctypes)
                            {
                                foreach (SynchronizerType synctype in synctypes)
                                {
                                    foreach (StreamOperation op in ops)
                                    {
                                        foreach (int chunksize in ChunkSize)
                                        {
                                            foreach (int ThreadPoolSize in num_threads)
                                            {
                                                foreach (int num_operations in n_operations)
                                                {
                                                for (int i = 0; i < n_iterations; ++i)
                                                {
                                                    byte[] data = new byte[size];
                                                    Random rnd = new Random(DateTime.Now.Millisecond);
                                                    rnd.NextBytes(data);
                                                    Experiment e = new Experiment();

                                                    DateTime Date = new DateTime(DateTime.UtcNow.Ticks);

                                                    string HomeName = String.Format("ExpHome-{0}", Date.ToString("yyyy-MM-dd"));
                                                    string Caller = String.Format("{0}", Date.ToString("HH-mm-ss"));
                                                    string AppName = Caller;
                                                    string StreamName = String.Format("{0}", rnd.Next());

                                                    Byte[] value = data;
                                                    // int num_operations = n_operations;

                                                    string RandString = Experiment.RandomString(4);
                                                    long stime = 0;
                                                    long etime = 0;

                                                    // Run the experiment
                                                    if (op == StreamOperation.RandomKeyGet ||
                                                        op == StreamOperation.RandomKeyGetMultipleSegments ||
                                                        op == StreamOperation.RandomKeyGetAll)
                                                    {
                                                        // Need to create the stream before reading it

                                                        stime = StreamFactory.NowUtc();
                                                        Console.WriteLine("Stime: " + stime);

                                                        StreamOperation tmp = StreamOperation.RandomKeySameValueAppend;
                                                        if (op == StreamOperation.RandomKeyGetAll)
                                                            tmp = StreamOperation.SameKeySameValueAppend;
                                                        e.Run(Caller, HomeName, AppName, StreamName,
                                                            RandString,
                                                            stime, etime,
                                                            type, tmp,
                                                            ptype,
                                                            ctype, chunksize, ThreadPoolSize,
                                                            value, num_operations,
                                                            synctype, doCosts: true, address: address);
                                                        etime = StreamFactory.NowUtc();
                                                        Console.WriteLine("Etime: " + etime);
                                                        CallerInfo ci = new CallerInfo(null, AppName, AppName, 1);
                                                        string exp_directory = Path.GetFullPath((null != ci.workingDir) ? ci.workingDir : Directory.GetCurrentDirectory());
                                                        exp_directory = exp_directory + "/" + HomeName + "/" + AppName + "/" + StreamName;

                                                        File.Delete(exp_directory + "/log");

                                                        try
                                                        {
                                                            File.Delete(exp_directory + "/results");
                                                            File.Delete(exp_directory + "/exp");
                                                        }
                                                        catch
                                                        {
                                                        }

                                                        if (type == StreamType.Remote || type == StreamType.RemoteEnc)
                                                        {
                                                            Directory.Delete(exp_directory + "/0", true);
                                                            File.Delete(exp_directory + "/index_md.dat");
                                                        }
                                                    }

                                                    TimeSpan span = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
                                                    Console.WriteLine("Time: " + span.TotalSeconds);

                                                    if (op == StreamOperation.RandomKeyGetMultipleSegments || op == StreamOperation.RandomKeyGet)
                                                    {
                                                        e.Run(Caller, HomeName, AppName, StreamName, RandString, stime, etime, type, op, ptype, ctype, chunksize, ThreadPoolSize, value, num_multi_segment_operations, synctype, max_key: num_operations, doCosts: true, address: address);
                                                    }
                                                    else
                                                    {
                                                        e.Run(Caller, HomeName, AppName, StreamName, RandString, stime, etime, type, op, ptype, ctype, chunksize, ThreadPoolSize, value, num_operations, synctype, doCosts: true, address: address);
                                                    }

                                                    dir = e.exp_directory + "/../../../Results/";

                                                    Console.WriteLine("Completed: " + e.ToString());

                                                    span = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
                                                    Console.WriteLine("Time: " + span.TotalSeconds);

                                                    Console.WriteLine("====================================");

                                                    // Dump raw data from the experiment
                                                    e.Dump(Caller, HomeName, AppName, StreamName,
                                                        type, op, ptype,
                                                        value, num_operations, synctype);

                                                    // Get parsed data of the experiment
                                                    // if (i != 0)
                                                    //{
                                                        // Ignore the first iteration as warmup
                                                        summary.Add(e.exp_id);
                                                        List<string> ret = e.Analyze(type, value, num_operations);
                                                        summary.AddRange(ret);
                                                    //}
                                                    System.Threading.Thread.Sleep(2000);

                                                    e.Destroy();
                                                }
                                            }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            dir = dir + StreamFactory.PrettyNowUtc();
            if (!Directory.Exists(dir))
            {
                try
                {
                    Directory.CreateDirectory(dir);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            dir = dir + "/";
            File.WriteAllLines(dir + "Summary", summary);

            // Dump .dat files
            SummaryToDat(dir);

            // Thats it!
            Console.WriteLine("Done!");
            Console.ReadKey();
        }