コード例 #1
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Onewaychainlist_Test(int arysize, int appendtimes, int deletimes,
                                                int inserttimes, int findtimes)
        {
            long t1;
            var  testary = AryDeal.intBuild(0, arysize);

            t1 = TickCount.GetTickCount();
            CSolution.Create_List(testary, testary.Length);
            for (var i = 0; i < appendtimes; ++i)
            {
                CSolution.List_Append(i);
            }
            for (var i = 0; i < deletimes; ++i)
            {
                CSolution.List_Delete(i);
            }
            for (var i = 0; i < inserttimes; ++i)
            {
                CSolution.List_Insert(i, i);
            }
            for (var i = 0; i < findtimes; ++i)
            {
                CSolution.List_Search(i);
            }
            CSolution.List_Clean();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #2
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static void renderTest()
        {
            long t1 = TickCount.GetTickCount();

            CSolution.renderTest(2);
            t1 = TickCount.GetTickCount() - t1;
            ValueIn(t1);
        }
コード例 #3
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static void RGBInsert()
        {
            long t1 = TickCount.GetTickCount();

            CSolution.imageDeal(1, 1);
            CSolution.imageDeal(1, 1);
            t1 = TickCount.GetTickCount() - t1;
            ValueIn(t1);
        }
コード例 #4
0
        private void label22_Click(object sender, EventArgs e)
        {
            Form1.Turbo();
            long tt;
            int  a = int.Parse(textBox25.Text);

            int[] ary1 = AryDeal.intBuild(1, a);
            tt = TickCount.GetTickCount();
            CSolution.Insert_Sort(ary1, ary1.Length);
            tt           = TickCount.GetTickCount() - tt;
            label54.Text = tt.ToString();
        }
コード例 #5
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Stack_Test()
        {
            long t1;
            int  x;

            t1 = TickCount.GetTickCount();
            CSolution.Stack_Create(10000000);
            for (var i = 0; i < 10000000; ++i)
            {
                CSolution.Stack_Push(i);
                CSolution.Stack_Peek(out x);
                CSolution.Stack_Pop(out x);
            }
            CSolution.Stack_Close();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #6
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Queue_Test()
        {
            long t1;
            int  x;

            t1 = TickCount.GetTickCount();
            CSolution.Queue_Ini();
            CSolution.Queue_Push(1);
            for (var i = 0; i < 40000; ++i)
            {
                CSolution.Queue_Push(i);
                CSolution.Queue_Peek(out x);
                CSolution.Queue_Pop(out x);
            }
            CSolution.Queue_Clear();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #7
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Btree_Test()
        {
            long t1;
            var  testAry = AryDeal.intBuild(0, 30000);

            t1 = TickCount.GetTickCount();
            CSolution.Btree_Create(testAry, testAry.Length);
            for (var i = 0; i < 30000; ++i)
            {
                CSolution.Btree_Insert(10000 - i);
                CSolution.Btree_Find(i);
                CSolution.Btree_Delete(i);
            }
            var rltAry = new int[CSolution.Btree_Count()];

            CSolution.Btree_Print(rltAry);
            CSolution.Btree_Clean();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #8
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Onewaychainlist_Test()
        {
            long t1;
            var  testary = AryDeal.intBuild(0, 10000);

            t1 = TickCount.GetTickCount();
            CSolution.Create_List(testary, testary.Length);
            for (var i = 0; i < 10000; ++i)
            {
                CSolution.List_Append(i);
                CSolution.List_Search(i);
                CSolution.List_Delete(i);
                CSolution.List_Insert(i, i);
            }
            var rltary = new int[CSolution.List_Count()];

            CSolution.List_Print(rltary, rltary.Length);
            CSolution.List_Clean();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #9
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Stack_Test(int stackSize, int pushTimes, int peekTimes, int popTimes)
        {
            long ticks;
            int  x;

            ticks = TickCount.GetTickCount();
            CSolution.Stack_Create(stackSize);
            for (var i = 0; i < pushTimes; ++i)
            {
                CSolution.Stack_Push(i);
            }
            for (var i = 0; i < peekTimes; ++i)
            {
                CSolution.Stack_Peek(out x);
            }
            for (var i = 0; i < popTimes; ++i)
            {
                CSolution.Stack_Pop(out x);
            }
            CSolution.Stack_Close();
            return(TickCount.GetTickCount() - ticks);
        }
コード例 #10
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Queue_Test(int t1, int t2, int t3)
        {
            long ticks;
            int  x;

            ticks = TickCount.GetTickCount();
            CSolution.Queue_Ini();
            for (var i = 0; i < t1; ++i)
            {
                CSolution.Queue_Push(i);
            }
            for (var i = 0; i < t2; ++i)
            {
                CSolution.Queue_Pop(out x);
            }
            for (var i = 0; i < t3; ++i)
            {
                CSolution.Queue_Peek(out x);
            }
            CSolution.Queue_Clear();
            return(TickCount.GetTickCount() - ticks);
        }
コード例 #11
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Twowaychainlist_Test(int arySize, int headdeTimes, int headinTimes,
                                                int appendTimes, int taildeTimes, int findTimes, int inTimes, int deTimes)
        {
            long ticks;
            var  ary1 = AryDeal.intBuild(0, arySize);

            ticks = TickCount.GetTickCount();
            CSolution.TwowayList_Create(ary1, ary1.Length);
            for (var i = 0; i < headdeTimes; ++i)
            {
                CSolution.TwowayList_Headin(i);
            }
            for (var i = 0; i < headinTimes; ++i)
            {
                CSolution.TwowayList_Headde();
            }
            for (var i = 0; i < appendTimes; ++i)
            {
                CSolution.TwowayList_Append(i);
            }
            for (var i = 0; i < taildeTimes; ++i)
            {
                CSolution.TwowayList_Tailde();
            }
            for (var i = 0; i < findTimes; ++i)
            {
                CSolution.TwowayList_Search(i);
            }
            for (var i = 0; i < inTimes; ++i)
            {
                CSolution.TwowayList_Insert(i, i);
            }
            for (var i = 0; i < deTimes; ++i)
            {
                CSolution.TwowayList_Dele(i);
            }
            CSolution.TwowayList_Clean();
            return(TickCount.GetTickCount() - ticks);
        }
コード例 #12
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Twowaychainlist_Test()
        {
            long t1;
            var  ary1 = AryDeal.intBuild(0, 20000);

            t1 = TickCount.GetTickCount();
            CSolution.TwowayList_Create(ary1, ary1.Length);
            for (var i = 0; i < 20000; ++i)
            {
                CSolution.TwowayList_Headin(i);
                CSolution.TwowayList_Headde();
                CSolution.TwowayList_Append(i);
                CSolution.TwowayList_Tailde();
                CSolution.TwowayList_Search(i);
                CSolution.TwowayList_Dele(i);
            }
            var rltary = new int[CSolution.TwowayList_Count()];

            CSolution.TwowayList_Print(rltary);
            CSolution.TwowayList_Clean();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #13
0
ファイル: C_Test.cs プロジェクト: migeyusu/CPU-Test
        public static long Btree_Test(int arysize, int inserttimes, int findtimes, int deletimes)
        {
            long t1;
            var  testAry = AryDeal.intBuild(0, arysize);

            t1 = TickCount.GetTickCount();
            CSolution.Btree_Create(testAry, testAry.Length);
            for (var i = 0; i < inserttimes; ++i)
            {
                CSolution.Btree_Insert(inserttimes - i);
            }
            for (var i = 0; i < findtimes; ++i)
            {
                CSolution.Btree_Find(i);
            }
            for (var i = 0; i < deletimes; ++i)
            {
                CSolution.Btree_Delete(i);
            }
            CSolution.Btree_Clean();
            return(TickCount.GetTickCount() - t1);
        }
コード例 #14
0
/*------------------------测试----------------------- */

        public void Single_ThreadTest()//单线程主函数
        {
            testResult = new UIdelegete(SinThreadTestResultFlash);
            var freqRecord = new Queue <int>();

            ThreadControl.MyProcessHigh();
            long gg, t1;//时间记录
            int  x1;

            Form1.Turbo();//提高cpu频率
            //栈操作,38mb考验内存和前端总线
            gg = Ctest.Stack_Test();
            resultRecord.Enqueue(gg);
            //树操作,117kb
            gg = Ctest.Btree_Test();
            resultRecord.Enqueue(gg);
            //pi,39kb
            var ary = new int[10000];

            gg  = CSolution.SuperPi(ary, 10000);
            ary = null;
            resultRecord.Enqueue(gg);
            //随机整数
            CSolution.Int_Test(1, out x1);
            resultRecord.Enqueue(x1);
            freqRecord.Enqueue(crtFreq);
            //归并排序+二分查找,38mb
            var ary1 = AryDeal.intBuild(1, 10000000);

            t1 = TickCount.GetTickCount();
            CSolution.Merge_Sort(ary1, ary1.Length);
            for (var i = 0; i < 100000; ++i)
            {
                CSolution.Mid_Search(ary1, ary1.Length, i);
            }
            t1   = TickCount.GetTickCount() - t1;
            ary1 = null;
            resultRecord.Enqueue(t1);
            freqRecord.Enqueue(crtFreq);
            //泰勒多项式
            gg = CSolution.TalorSeries_Test(100);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //随机浮点
            CSolution.Float_Test(3, out x1);
            resultRecord.Enqueue(x1);
            freqRecord.Enqueue(crtFreq);
            //双向链表,78kb
            gg = Ctest.Twowaychainlist_Test();
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //单向链表,39kb
            gg = Ctest.Onewaychainlist_Test();
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //队列,156kb
            gg = 0;
            for (var i = 0; i < 101; ++i)
            {
                gg += Ctest.Queue_Test();
            }
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //光照渲染器,2-3mb左右
            gg = CSolution.renderTest(1);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //2d图像缩放,1kb
            gg = CSolution.imageDeal(1, 1);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //矩阵整数,1mb
            int m = 300, n = 300, p = 300;
            var ary2 = AryDeal.intBuild(0, m * n);
            var ary3 = AryDeal.intBuild(0, n * p);
            var ary4 = new int[m * p];

            gg = 0;
            for (var i = 0; i < 30; i++)
            {
                gg += CSolution.Int_MatrixMulti(ary2, m, n, ary3, p, ary4);
            }
            ary2 = null;
            ary3 = null;
            ary4 = null;
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //浮点矩阵
            var ary5 = AryDeal.floatBuild(0, m * n);
            var ary6 = AryDeal.floatBuild(0, n * p);
            var ary7 = new double[m * p];

            gg = 0;
            for (var i = 0; i < 30; i++)
            {
                gg += CSolution.Double_MatrixMulti(ary5, m, n, ary6, p, ary7);
            }
            resultRecord.Enqueue(gg);
            ary5 = null;
            ary6 = null;
            ary7 = null;
            freqRecord.Enqueue(crtFreq);
            gg = 0;
            t1 = freqRecord.Count;
            for (var i = 0; i < t1; ++i)
            {
                gg += freqRecord.Dequeue();
            }
            resultRecord.Enqueue(gg / t1);
            this.Invoke(testResult);
        }