Пример #1
0
        static void Main(string[] args)
        {
            // Here we assume that the performance counters were already installed.
            string databaseFile = Path.GetTempFileName();

            using (var db = Db4oEmbedded.OpenFile(databaseFile))
            {
                db.Store(new Item("foo"));
                db.Store(new Item("bar"));
            }

            using (var db = Db4oEmbedded.OpenFile(NewConfiguration(), databaseFile))
            {
                PerformanceCounter bytesReadPerSec = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.QueriesPerSec, db);

                PrintCounter(bytesReadPerSec);
                RunQuery(db);
                RunQuery(db);
                RunQuery(db);
                Thread.Sleep(1000);                 // Wait one second...
                PrintCounter(bytesReadPerSec);
            }

            File.Delete(databaseFile);
        }
Пример #2
0
        public static void Run(ProgramOptions options)
        {
            foreach (string fileName in options.StatisticsFileNames)
            {
                new Statistics().Run(fileName);
            }

            if (options.InstallPerformanceCounters)
            {
                Db4oPerformanceCounters.ReInstall();
            }

            if (options.CheckDatabase)
            {
                Console.Write("\r\nChecking '{0}' : ", options.Target);
                ConsistencyChecker.Main(new string[] { options.Target });
            }

            if (options.ShowFileUsageStats)
            {
                FileUsageStatsCollector.Main(new string[] { options.Target, "true" });
            }

            if (NoInstrumentationStep(options))
            {
                return;
            }

            using (new CurrentDirectoryAssemblyResolver())
            {
                RunPipeline(options);
            }
        }
Пример #3
0
        internal PerformanceCounter MessagesSent()
        {
            if (null == _messagesSent)
            {
                _messagesSent = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.NetMessagesSentPerSec, false);
            }

            return(_messagesSent);
        }
Пример #4
0
        internal PerformanceCounter BytesReceived()
        {
            if (null == _bytesReceived)
            {
                _bytesReceived = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.NetBytesReceivedPerSec, false);
            }

            return(_bytesReceived);
        }
Пример #5
0
        internal PerformanceCounter BytesSent()
        {
            if (null == _bytesSent)
            {
                _bytesSent = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.NetBytesSentPerSec, false);
            }

            return(_bytesSent);
        }
Пример #6
0
        public static void ReInstall()
        {
            if (_installed)
            {
                return;
            }

            if (IsCurrentUserAnAdministrator())
            {
                Db4oPerformanceCounters.ReInstall();
                _installed = true;
            }
        }
Пример #7
0
 public static void Main(string[] args)
 {
     // #example: Install the performance counters
     Db4oPerformanceCounters.Install();
     // #end example
 }