Beispiel #1
0
        public void TestLogExcute(string logFromPath,
                                  string logToPath,
                                  Action <FileInfo, List <Tlog>, string> transfaseDataTable)
        {
            double move = 0, read = 0, zip = 0, del = 0;
            var    fileCount = 0;

            var total = CodeTimer.TimeLong("总共时间",
                                           1,
                                           () =>
            {
                string zipFileName  = DateTime.Now.ToString("yyyyMMddHHmm");
                string logToAbsPath = logToPath + "\\" + zipFileName;

                try
                {
                    // ReSharper disable once AccessToModifiedClosure
                    move = CodeTimer.TimeLong("移动数据", 1, () => FileUtil.MoveFolder(logFromPath, logToAbsPath, ref fileCount));

                    DirectoryInfo myFolder = new DirectoryInfo(logToAbsPath);
                    List <Tlog> tlogs      = new List <Tlog>();
                    read = CodeTimer.TimeLong("解析数据", 1, () =>
                    {
                        TraverseFolder2(myFolder, transfaseDataTable, tlogs, zipFileName);
                        TlogRepository.BulkInsertAll(tlogs);
                    }
                                              );

                    zip = CodeTimer.TimeLong("压缩数据",
                                             1,
                                             () =>
                    {
                        if (FileUtil.Zip(logToAbsPath, logToAbsPath + ".zip", ""))
                        {
                            del = CodeTimer.TimeLong("删除数据", 1, () => FileUtil.DeleteDir(logToAbsPath));
                        }
                    });
                    zip = zip - del;
                }
                catch (Exception e)
                {
                    string log = "解析数据出错,原因:[" + e + "、消息:" + e.Message + "]";
                    Console.WriteLine(@"	Err:	"+ e.Message);
                    WriteSysLog(log);
                }
            });

            OperationLogRepository.Insert(new OperationLog()
            {
                Num           = fileCount,
                MoveTimes     = move,
                ReadTimes     = read,
                ZipTimes      = zip,
                DeleteTimes   = del,
                TotalTimes    = total,
                OperationType = "TestLog"
            });
        }
Beispiel #2
0
        private static void CpkCount()
        {
            List <double> list = new List <double>();

            for (int i = 0; i < 1000000; i++)
            {
                list.Add(21.00001);
            }

            #region

            List <double> list2 = new List <double>
            {
                31.90799,
                29.79160,
                29.50238,
                31.92334,
                29.11130,
                29.14536,
                29.87259,
                29.07852,
                29.03458,
                29.29665,
                29.85486,
                29.29509,
                29.60806,
                29.71625,
                29.67749,
                29.51538,
                29.87296,
                29.11569,
                29.46088,
                29.70709,
                29.76892,
                29.60690,
                29.19720,
                29.90610,
                29.00107,
                29.78519,
                29.63794,
                29.43466,
                29.61835,
                29.19067,
                32.42059,
                29.82275,
                30.35547,
                29.87469,
                29.77762,
                29.96130,
                29.64117,
                31.76547,
                29.97348,
                29.23676,
                29.76099,
                29.36694,
                29.25879,
                29.93500,
                29.86017,
                29.83698,
                29.92703,
                29.58566,
                29.70892,
                29.53970,
                29.22122,
                29.57635,
                28.48273,
                29.06714,
                29.57147,
                29.11792,
                29.49380,
                29.02368,
                29.62039,
                29.25122,
                29.97784,
                29.56339,
                29.17917,
                28.71713,
                29.12911,
                29.37393,
                29.01364,
                28.29290,
                29.21085,
                29.08041,
                29.82611,
                29.76154,
                29.54047,
                29.01254,
                29.32906,
                29.93896,
                29.99291,
                29.53745,
                28.42700,
                29.93921,
                29.80240,
                29.13794,
                29.47354,
                29.35989,
                29.62259,
                29.22905,
                29.66107,
                29.75870,
                29.52295,
                29.29819,
                29.01550,
                29.51068,
                29.04459,
                29.80273,
                29.32929,
                29.98413,
                29.29372,
                29.54599,
                29.76578,
                34.89600,
                29.42926,
                29.46680,
                29.88257,
                33.94669,
                29.48645,
                29.61154,
                29.01624,
                29.93839,
                33.64954,
                29.07120,
                32.37460,
                29.62926,
                34.82108,
                29.12027,
                29.89410,
                29.93588,
                29.08691,
                29.85284,
                29.45514,
                29.87183,
                29.22958,
                29.80743,
                29.97229,
                29.71283,
                29.04205,
                29.39407,
                29.07495,
                34.07278,
                29.84467,
                29.12914,
                29.44449,
                29.10437,
                29.01788,
                29.70575,
                29.88977,
                29.38641,
                32.42972,
                34.67401,
                29.08356,
                29.79517,
                29.48511,
                29.49359,
                29.44803,
                34.87811,
                23.66922,
                29.39581,
                29.26065,
                29.19528,
                34.46124,
                29.26578,
                34.48819,
                29.98370,
                33.99762,
                29.68927,
                29.26477,
                30.71078,
                29.70987,
                29.85504,
                31.22095,
                31.77148,
                33.47037,
                29.29059,
                29.45456,
                31.80475,
                29.52518,
                29.72549,
                29.66348,
                31.71445,
                29.09833,
                29.28030,
                30.67929,
                33.63608
            };
            List <double> list3 = new List <double>
            {
                31.90799,
                31.79160,
                31.50238,
                31.92334,
                31.11130,
                31.14536,
                31.87259,
                31.07852,
                31.03458,
                31.31665,
                31.85486,
                31.31509,
                31.60806,
                31.71625,
                31.67749,
                31.51538,
                31.87316,
                31.11569,
                31.46088,
                31.70709,
                31.76892,
                31.60690,
                31.19720,
                31.90610,
                31.00107,
                31.78519,
                31.63794,
                31.43466,
                31.61835,
                31.19067,
                31.42059,
                31.82275,
                31.35547,
                31.87469,
                31.77762,
                31.96130,
                31.64117,
                31.76547,
                31.97348,
                31.23676,
                31.76099,
                31.36694,
                31.25879,
                31.93500,
                31.86017,
                31.83698,
                31.92703,
                31.58566,
                31.70892,
                31.53970,
                31.22122,
                31.57635,
                31.48273,
                31.06714,
                31.57147,
                31.11792,
                31.49380,
                31.02368,
                31.62039,
                31.25122,
                31.97784,
                31.56339,
                31.17917,
                31.71713,
                31.13111,
                31.37393,
                31.01364,
                31.31310,
                31.21085,
                31.08041,
                31.82611,
                31.76154,
                31.54047,
                31.01254,
                31.33106,
                31.93896,
                31.99311,
                31.53745,
                31.42700,
                31.93921,
                31.80240,
                31.13794,
                31.47354,
                31.35989,
                31.62259,
                31.23105,
                31.66107,
                31.75870,
                31.52315,
                31.31819,
                31.01550,
                31.51068,
                31.04459,
                31.80273,
                31.33131,
                31.98413,
                31.31372,
                31.54599,
                31.76578,
                31.89600,
                31.43126,
                31.46680,
                31.88257,
                31.94669,
                31.48645,
                31.61154,
                31.01624,
                31.93839,
                31.64954,
                31.07120,
                31.37460,
                31.63126,
                31.82108,
                31.12027,
                31.89410,
                31.93588,
                31.08691,
                31.85284,
                31.45514,
                31.87183,
                31.23158,
                31.80743,
                31.97231,
                31.71283,
                31.04205,
                31.39407,
                31.07495,
                31.07278,
                31.84467,
                31.13114,
                31.44449,
                31.10437,
                31.01788,
                31.70575,
                31.88977,
                31.38641,
                31.43172,
                31.67401,
                31.08356,
                31.79517,
                31.48511,
                31.49359,
                31.44803,
                31.87811,
                31.66922,
                31.39581,
                31.26065,
                31.19528,
                31.46124,
                31.26578,
                31.48819,
                31.98370,
                31.99762,
                31.68927,
                31.26477,
                31.71078,
                31.70987,
                31.85504,
                31.22095,
                31.77148,
                31.47037,
                31.31059,
                31.45456,
                31.80475,
                31.52518,
                31.72549,
                31.66348,
                31.71445,
                31.09833,
                31.28030,
                31.67931,
                31.63608,
            };

            #endregion

            CodeTimer.TimeLong("平均值",
                               1,
                               () =>
            {
                Console.WriteLine(Average(list));
            });
            CodeTimer.TimeLong("标准差",
                               1,
                               () =>
            {
                Console.WriteLine(StandardDeviation(list3, 35, 29));
            });
        }