示例#1
0
 static Config()
 {
     DefaultSettings = new Settings()
     {
         StopwatchType = typeof (DefaultStopwatch),
         TargetType = typeof (ConsoleTarget)
     };
 }
示例#2
0
        public MicroProfiler(string name = null, IStopwatch stopwatch = null, ITarget target = null, Settings settings = null)
        {
            Name = name;
            if (settings == null)
                settings = Config.DefaultSettings;

            _stopwatch = stopwatch ?? settings.StopwatchInstance ?? Activator.CreateInstance(settings.StopwatchType) as IStopwatch;
            _target = target ?? settings.TargetInstance ?? Activator.CreateInstance(settings.TargetType) as ITarget;

            Start();
        }