Beispiel #1
0
 public static void Test()
 {
     try
     {
         const string UNIQUE_ID      = "B9";
         const int    N_TRANSACTIONS = 10240000;
         PerfTestUtil.WriteLine("Full speed send test {0} START. N_TRANSACTIONS[{1}] Sender queue size[{2}]", UNIQUE_ID, N_TRANSACTIONS, 1000);
         // Comment out rootTransaction. Because in real prod environment, truncating transaction rarely happens.
         ITransaction rootTransaction = Cat.NewTransaction("Root transaction of full speed send test " + UNIQUE_ID + " N_TRANSACTIONS [" + N_TRANSACTIONS + "]", "Root transaction of full speed send test");
         long         start           = MilliSecondTimer.UnixNowMilliSeconds();
         for (int i = 0; i < N_TRANSACTIONS; i++)
         {
             // ITransaction child = Cat.NewTransaction("Child transaction of full speed send test " + UNIQUE_ID + " N_TRANSACTIONS [" + N_TRANSACTIONS + "]", "");
             ITransaction child = Cat.NewTransaction("Child", "");
             child.Status = CatConstants.SUCCESS;
             child.Complete();
         }
         rootTransaction.Status = CatConstants.SUCCESS;
         rootTransaction.Complete();
         PerfTestUtil.WriteLine("Full speed send test {0} END. Latency[{1} ms]. {2}", UNIQUE_ID, (MilliSecondTimer.UnixNowMilliSeconds() - start), Cat.ToText());
     }
     catch (Exception ex)
     {
         PerfTestUtil.WriteLine("Exception occurred in full speed send test:\n " + ex);
         throw ex;
     }
 }
Beispiel #2
0
        public static void Test()
        {
            long start = MilliSecondTimer.UnixNowMilliSeconds();

            Console.WriteLine(Conf.AsString());
            PerfTestUtil.WriteLine("Test starts");
            IList <Thread> threads = new List <Thread>();

            for (int i = 0; i < Conf.N_THREADS; i++)
            {
                Thread thread = new Thread(TransactionTreeWorker.DoWork);
                threads.Add(thread);
            }

            foreach (Thread thread in threads)
            {
                thread.Start();
            }

            foreach (Thread thread in threads)
            {
                thread.Join();
            }
            PerfTestUtil.WriteLine("Test ends. latency: "
                                   + (MilliSecondTimer.UnixNowMilliSeconds() - start) + " ms.\n"
                                   + "Number of transactions created: " + TransactionTreeWorker.nTransactions + "\n");
        }
Beispiel #3
0
        public static void DoWork()
        {
            long start = MilliSecondTimer.UnixNowMilliSeconds();

            PerfTestUtil.WriteLine("Thread " + Thread.CurrentThread.ManagedThreadId + " starts");

            CreateSubtree(0);

            PerfTestUtil.WriteLine("Thread " + Thread.CurrentThread.ManagedThreadId + " ends. thread latency: "
                                   + (MilliSecondTimer.UnixNowMilliSeconds() - start) + " ms.");
        }
Beispiel #4
0
        public static void Test()
        {
            Process      currentProcess = Process.GetCurrentProcess();
            long         nException     = 0;
            int          i = 0;
            const int    SLEEP_PERIOD_MILLISECOND = 200;
            const string ID = "E";

            //ITransaction root = Cat.NewTransaction("Endless Test Root transaction " + ID, "Root transaction. Sleep period [" + SLEEP_PERIOD_MILLISECOND + " ms]");
            while (true)
            {
                ITransaction child = null;
                try
                {
                    child = Cat.NewTransaction("Endless Test Child transaction " + ID, "Child transaction " + i);
                }
                catch (Exception ex)
                {
                    PerfTestUtil.WriteLine("Exception occured in EndlessTest:\n" + ex);
                    nException++;
                }
                finally
                {
                    if (i % 1000 == 0)
                    {
                        string progress = "Endless Test progress (" + ID + "). Sleep period [" + SLEEP_PERIOD_MILLISECOND + " ms] Iteration [" + i + "] nException[" + nException + "] "
                                          + Cat.ToText() + " PrivateMemorySize64[" + currentProcess.PrivateMemorySize64 + "] WorkingSet64[" + currentProcess.WorkingSet64 + "] GC.GetTotalMemory[" + GC.GetTotalMemory(false) + "] "
                                          + "VirtualMemorySize64[" + currentProcess.VirtualMemorySize64 + "] PagedMemorySize64 [" + currentProcess.PagedMemorySize64 + "]";
                        Cat.LogEvent("Endless Test progress", progress);
                        PerfTestUtil.WriteLine(progress);
                    }

                    if (null != child)
                    {
                        child.Status = CatConstants.SUCCESS;
                        child.Complete();
                    }

                    i++;
                    Thread.Sleep(SLEEP_PERIOD_MILLISECOND);
                }
            }
            //root.Status = CatConstants.SUCCESS;
            //root.Complete();
            //Console.WriteLine("End of Endless test. Should never reach here.");
        }
Beispiel #5
0
        public static void Test()
        {
            try
            {
                const string UNIQUE_ID = "S";
                // Number of batches
                const int N_BATCH = 1024;
                // Number of transactions in each batch
                const int BATCH_SIZE = 1000;
                // Sleep SLEEP_PERIOD ms after sending one batch.
                const int SLEEP_PERIOD = 50;

                PerfTestUtil.WriteLine("Batch send test {0} START. N_BATCH[{1}], BATCH_SIZE[{2}] SLEEP_PERIOD[{3}] Sender queue size[{4}]",
                                       UNIQUE_ID, N_BATCH, BATCH_SIZE, SLEEP_PERIOD, 1000);
                ITransaction rootTransaction = Cat.NewTransaction(
                    "Root transaction of batch send test " + UNIQUE_ID + " N_BATCH [" + N_BATCH + "] BATCH_SIZE [" + BATCH_SIZE + "] SLEEP_PERIOD[" + SLEEP_PERIOD + " "
                    + " Sender queue size[" + 1000 + "]", "Root transaction of batch send test");
                long start = MilliSecondTimer.UnixNowMilliSeconds();
                for (int i = 0; i < N_BATCH; i++)
                {
                    for (int j = 0; j < BATCH_SIZE; j++)
                    {
                        ITransaction child = Cat.NewTransaction("Child transaction of batch send test " + UNIQUE_ID, "");
                        child.Status = CatConstants.SUCCESS;
                        child.Complete();
                    }
                    Thread.Sleep(SLEEP_PERIOD);
                }
                rootTransaction.Status = CatConstants.SUCCESS;
                rootTransaction.Complete();
                PerfTestUtil.WriteLine("Batch send test {0} END. Latency[{1} ms]. {2}", UNIQUE_ID, (MilliSecondTimer.UnixNowMilliSeconds() - start), Cat.ToText());
            }
            catch (Exception ex)
            {
                PerfTestUtil.WriteLine("Exception occurred in full speed send test:\n " + ex);
                throw ex;
            }
        }