예제 #1
0
        public void PrintSummaryInfo(bool detail = true)
        {
            int totalCount = InfoCollection.Sum(x => x.KeyLength + x.ValueLength);

            Logger.WriteInfo($"Total keys count:{InfoCollection.Count.ToString()}, Bytes total length:{totalCount.ToString()}");
            Logger.WriteInfo("All keys type info:");
            foreach (var key in HashList.Keys)
            {
                //Keys Percent info
                int    itemCount = HashList[key].Sum(x => x.KeyLength + x.ValueLength);
                double percent   = (double)(itemCount * 100) / (double)totalCount;
                Logger.WriteInfo($"Key item: {key}, Count: {HashList[key].Count.ToString()}, Percent:{percent:0.00}%");
            }

            Logger.WriteInfo("All hash keys type info:");
            ConvertHashType();
            foreach (var key in ProtoHashList.Keys)
            {
                Logger.WriteInfo($"Key item: {key}, Count: {ProtoHashList[key].Count.ToString()}");
            }

            if (!detail)
            {
                return;
            }

            //打印Basic信息
            var sortList = InfoCollection.OrderBy(o => o.BasicString).ThenBy(o => o.HashString).ToList();

            foreach (var item in sortList)
            {
                Logger.WriteInfo($"BasicCategory={item.BasicString}, HashCategory={item.HashString}, Length=[{item.KeyLength},{item.ValueLength}], RedisKey={item.RedisKey}");
            }
            //打印Object信息
            foreach (var item in HashList.Keys)
            {
                Logger.WriteInfo("------------------------------------------------------------------------------------");
                Logger.WriteInfo($"Data Type: {item}");
                foreach (var keyinfo in HashList[item])
                {
                    Logger.WriteInfo(keyinfo.ValueInfo.ToString());
                }
                Logger.WriteInfo("------------------------------------------------------------------------------------");
            }
        }