/// <summary>
        /// 显示信息
        /// </summary>
        private void Show()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("[{0}]", _watcherTag);

            if (_points.Count > 0)
            {
                builder.Append("\n检查点:\n");
                foreach (CheckPoint point in _points)
                {
                    builder.AppendFormat("{0}\n", point);
                }
            }

            builder.AppendFormat("总时间:{0} ms", _stopwatch.ElapsedMilliseconds);

            //

            SuperLog.Log(builder.ToString());

            //
        }
Beispiel #2
0
        private static void Init()
        {
            SuperLog.Log("TypeManager 初始化");

            _types = new HashSet <Type>();

            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            foreach (var assembly in assemblies)
            {
                var assemblyTypes = assembly.GetTypes();

                foreach (var type in assemblyTypes)
                {
                    if (!typeof(IByteBufferData).IsAssignableFrom(type) || !UnsafeUtility.IsUnmanaged(type))
                    {
                        continue;
                    }

                    _types.Add(type);
                }
            }

            _id2Type = new Dictionary <int, Type>(_types.Count);
            _type2id = new Dictionary <Type, int>(_types.Count);
            _id2size = new Dictionary <int, int>(_types.Count);

            foreach (var type in _types)
            {
                int id = Hash128.Compute(type.FullName).GetHashCode();
                Checker.Assert(id != 0);
                _id2Type.Add(id, type);
                _type2id.Add(type, id);
                _id2size.Add(id, UnsafeUtility.SizeOf(type));
            }
        }
 public void Push(T obj)
 {
     SuperLog.Assert(obj != null);
     _pool.Push(obj);
     _onPush?.Invoke(obj);
 }