Click here to Skip to main content
11,433,902 members (55,353 online)
Click here to Skip to main content
Articles » Database » Database » General » Downloads
Add your own
alternative version

Identifying NHibernate-Related Bottlenecks through Performance Monitoring

, 10 Jun 2007 CPOL
A distilled methodology for detecting and isolating NHibernate-related performance and scalability issues
using System;
using System.Collections;
using Sample.Mocks;
using Sample.Tests;

namespace Sample
	class Sample
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main()
                Console.Write("Number of threads? ");
                int threadCount = int.Parse(Console.ReadLine());
                Console.Write("Number of commands to execute? ");
                int passes = int.Parse(Console.ReadLine());
                ThreadContext context = new ThreadContext();
                GeneralTest tests = new GeneralTest(context,passes);
                ArrayList commands = tests.BasicGeneralCommandTest();
                DateTime start = DateTime.Now;
                SimpleThreadPool pool = new SimpleThreadPool(commands, threadCount);
                DateTime end = DateTime.Now;
                double totalSeconds = 0;
                foreach (CommandResult result in context.CommandResults)
                    totalSeconds += result.TimeProcessing.TotalSeconds;
                Console.WriteLine("Aggregate Time: " + end.Subtract(start).TotalSeconds);
                Console.WriteLine("Individual Time: " + totalSeconds);
            catch (Exception ex)
		private static void Initialize() {
			Mock mock = new Mock();
		private static void TearDown() {

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Peter Weissbrod
Web Developer
United States United States
Independent contract developer for .NET data-oriented systems.

not much to say about myself but feel free to contact me for any inquiries and comments!

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150428.2 | Last Updated 10 Jun 2007
Article Copyright 2007 by Peter Weissbrod
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid