Skip to content

Commit 03becf5

Browse files
committed
RawBencher related files and tests
1 parent d372ee3 commit 03becf5

File tree

146 files changed

+10607
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+10607
-1
lines changed

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
<ItemGroup>
6666
<ProjectReference Include="..\NHibernate.DomainModel\NHibernate.DomainModel.csproj" />
6767
<ProjectReference Include="..\NHibernate\NHibernate.csproj" />
68+
<ProjectReference Include="..\RawBencher\Model\NH.Bencher.Model.csproj" />
69+
<ProjectReference Include="..\RawBencher\Persistence\NH.Bencher.Persistence.csproj" />
6870
</ItemGroup>
6971
<ItemGroup>
7072
<Reference Include="System.Configuration" />
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
//#define UPSTREAM
2+
using System;
3+
using System.IO;
4+
using NHibernate.Util;
5+
using NUnit.Framework;
6+
7+
8+
namespace NHibernate.Test
9+
{
10+
[TestFixture]
11+
public class RawBenchSessionManagerPerfomance
12+
{
13+
#if UPSTREAM
14+
[Test]
15+
public void InternLevel_Upstream()
16+
{
17+
//Just to force initialize static ctor and do not calculate memory consumed by Environoment
18+
Cfg.Environment.VerifyProperties(CollectionHelper.EmptyDictionary<string, string>());
19+
20+
RunTest();
21+
}
22+
23+
#else
24+
25+
[Test]
26+
public void InternLevel_Minimal()
27+
{
28+
Cfg.Environment.InternLevel = InternLevel.Minimal;
29+
RunTest();
30+
}
31+
32+
[Test]
33+
public void InternLevel_Default()
34+
{
35+
Cfg.Environment.InternLevel = InternLevel.Default;
36+
RunTest();
37+
}
38+
39+
[Test]
40+
public void InternLevel_SessionFactories()
41+
{
42+
Cfg.Environment.InternLevel = InternLevel.SessionFactories;
43+
RunTest();
44+
}
45+
46+
[Test]
47+
public void InternLevel_AppDomains()
48+
{
49+
Cfg.Environment.InternLevel = InternLevel.AppDomains;
50+
RunTest();
51+
}
52+
53+
54+
#endif
55+
56+
private static void RunTest()
57+
{
58+
var factory = NH.Bencher.SessionManager.SessionFactory;
59+
60+
var setup = new AppDomainSetup();
61+
var si = AppDomain.CurrentDomain.SetupInformation;
62+
setup.ApplicationBase = si.ApplicationBase;
63+
setup.ConfigurationFile = si.ConfigurationFile;
64+
65+
AppDomain newDomain = AppDomain.CreateDomain("New Domain", null, si);
66+
67+
#if !UPSTREAM
68+
newDomain.SetData("internLevel", Cfg.Environment.InternLevel);
69+
#endif
70+
try
71+
{
72+
newDomain.DoCallBack(
73+
() =>
74+
{
75+
StringWriter s = new StringWriter();
76+
Console.SetOut(s);
77+
Console.WriteLine();
78+
Console.WriteLine();
79+
Console.WriteLine("From new App Domain...");
80+
#if !UPSTREAM
81+
Cfg.Environment.InternLevel = (InternLevel) AppDomain.CurrentDomain.GetData("internLevel");
82+
#endif
83+
try
84+
{
85+
86+
var factory2 = NH.Bencher.SessionManager.SessionFactory;
87+
}
88+
finally
89+
{
90+
AppDomain.CurrentDomain.SetData("log", s.ToString());
91+
AppDomain.CurrentDomain.SetData("memory", NH.Bencher.SessionManager.LastTotalMemoryUsage);
92+
}
93+
});
94+
}
95+
finally
96+
{
97+
Console.WriteLine(newDomain.GetData("log"));
98+
Console.WriteLine("Total Memory Usage in 2 App Domains: " + ToKbSize((long) newDomain.GetData("memory") + NH.Bencher.SessionManager.LastTotalMemoryUsage));
99+
100+
AppDomain.Unload(newDomain);
101+
}
102+
}
103+
104+
private static string ToKbSize(long bytes)
105+
{
106+
return (bytes / 1024.0).ToString("0,0.00") + " Kb";
107+
}
108+
}
109+
110+
}

src/NHibernate.sln

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion = 15.0.26730.12
3+
VisualStudioVersion = 15.0.27130.2003
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{593DCEA7-C933-46F3-939F-D8172399AB05}"
66
ProjectSection(SolutionItems) = preProject
@@ -21,6 +21,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.TestDatabaseSetu
2121
EndProject
2222
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "NHibernate.Test.VisualBasic", "NHibernate.Test.VisualBasic\NHibernate.Test.VisualBasic.vbproj", "{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}"
2323
EndProject
24+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NH.Bencher.Model", "RawBencher\Model\NH.Bencher.Model.csproj", "{45DAEB56-B84D-4D7A-BF22-293F1CE07DBB}"
25+
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NH.Bencher.Persistence", "RawBencher\Persistence\NH.Bencher.Persistence.csproj", "{3E9CA88C-03EC-445A-960A-242511B6EF55}"
27+
EndProject
2428
Global
2529
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2630
Debug|Any CPU = Debug|Any CPU
@@ -47,6 +51,14 @@ Global
4751
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Any CPU.Build.0 = Debug|Any CPU
4852
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.ActiveCfg = Release|Any CPU
4953
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.Build.0 = Release|Any CPU
54+
{45DAEB56-B84D-4D7A-BF22-293F1CE07DBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55+
{45DAEB56-B84D-4D7A-BF22-293F1CE07DBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
56+
{45DAEB56-B84D-4D7A-BF22-293F1CE07DBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
57+
{45DAEB56-B84D-4D7A-BF22-293F1CE07DBB}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{3E9CA88C-03EC-445A-960A-242511B6EF55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{3E9CA88C-03EC-445A-960A-242511B6EF55}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{3E9CA88C-03EC-445A-960A-242511B6EF55}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{3E9CA88C-03EC-445A-960A-242511B6EF55}.Release|Any CPU.Build.0 = Release|Any CPU
5062
EndGlobalSection
5163
GlobalSection(SolutionProperties) = preSolution
5264
HideSolutionNode = FALSE
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>This code was generated by LLBLGen Pro v4.2.</auto-generated>
3+
//------------------------------------------------------------------------------
4+
using System;
5+
using System.ComponentModel;
6+
using System.Collections.Generic;
7+
8+
namespace NH.Bencher.EntityClasses
9+
{
10+
/// <summary>Class which represents the entity 'Address'</summary>
11+
public partial class Address
12+
{
13+
#region Class Member Declarations
14+
private ISet<BusinessEntityAddress> _businessEntityAddresses;
15+
private ISet<SalesOrderHeader> _salesOrderHeaders;
16+
private ISet<SalesOrderHeader> _salesOrderHeaders1;
17+
private StateProvince _stateProvince;
18+
private System.Int32 _addressId;
19+
private System.String _addressLine1;
20+
private System.String _addressLine2;
21+
private System.String _city;
22+
private System.DateTime _modifiedDate;
23+
private System.String _postalCode;
24+
private System.Guid _rowguid;
25+
private Microsoft.SqlServer.Types.SqlGeography _spatialLocation;
26+
#endregion
27+
28+
/// <summary>Initializes a new instance of the <see cref="Address"/> class.</summary>
29+
public Address() : base()
30+
{
31+
_businessEntityAddresses = new HashSet<BusinessEntityAddress>();
32+
_salesOrderHeaders = new HashSet<SalesOrderHeader>();
33+
_salesOrderHeaders1 = new HashSet<SalesOrderHeader>();
34+
_addressId = default(System.Int32);
35+
OnCreated();
36+
}
37+
38+
/// <summary>Method called from the constructor</summary>
39+
partial void OnCreated();
40+
41+
/// <summary>Returns a hash code for this instance.</summary>
42+
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. </returns>
43+
public override int GetHashCode()
44+
{
45+
int toReturn = base.GetHashCode();
46+
toReturn ^= this.AddressId.GetHashCode();
47+
return toReturn;
48+
}
49+
50+
/// <summary>Determines whether the specified object is equal to this instance.</summary>
51+
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
52+
/// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.</returns>
53+
public override bool Equals(object obj)
54+
{
55+
if(obj == null)
56+
{
57+
return false;
58+
}
59+
Address toCompareWith = obj as Address;
60+
return toCompareWith == null ? false : ((this.AddressId == toCompareWith.AddressId));
61+
}
62+
63+
64+
#region Class Property Declarations
65+
/// <summary>Gets the AddressId field. </summary>
66+
public virtual System.Int32 AddressId
67+
{
68+
get { return _addressId; }
69+
}
70+
71+
/// <summary>Gets or sets the AddressLine1 field. </summary>
72+
public virtual System.String AddressLine1
73+
{
74+
get { return _addressLine1; }
75+
set { _addressLine1 = value; }
76+
}
77+
78+
/// <summary>Gets or sets the AddressLine2 field. </summary>
79+
public virtual System.String AddressLine2
80+
{
81+
get { return _addressLine2; }
82+
set { _addressLine2 = value; }
83+
}
84+
85+
/// <summary>Gets or sets the City field. </summary>
86+
public virtual System.String City
87+
{
88+
get { return _city; }
89+
set { _city = value; }
90+
}
91+
92+
/// <summary>Gets or sets the ModifiedDate field. </summary>
93+
public virtual System.DateTime ModifiedDate
94+
{
95+
get { return _modifiedDate; }
96+
set { _modifiedDate = value; }
97+
}
98+
99+
/// <summary>Gets or sets the PostalCode field. </summary>
100+
public virtual System.String PostalCode
101+
{
102+
get { return _postalCode; }
103+
set { _postalCode = value; }
104+
}
105+
106+
/// <summary>Gets or sets the Rowguid field. </summary>
107+
public virtual System.Guid Rowguid
108+
{
109+
get { return _rowguid; }
110+
set { _rowguid = value; }
111+
}
112+
113+
/// <summary>Gets or sets the SpatialLocation field. </summary>
114+
public virtual Microsoft.SqlServer.Types.SqlGeography SpatialLocation
115+
{
116+
get { return _spatialLocation; }
117+
set { _spatialLocation = value; }
118+
}
119+
120+
/// <summary>Represents the navigator which is mapped onto the association 'BusinessEntityAddress.Address - Address.BusinessEntityAddresses (m:1)'</summary>
121+
public virtual ISet<BusinessEntityAddress> BusinessEntityAddresses
122+
{
123+
get { return _businessEntityAddresses; }
124+
set { _businessEntityAddresses = value; }
125+
}
126+
127+
/// <summary>Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address - Address.SalesOrderHeaders (m:1)'</summary>
128+
public virtual ISet<SalesOrderHeader> SalesOrderHeaders
129+
{
130+
get { return _salesOrderHeaders; }
131+
set { _salesOrderHeaders = value; }
132+
}
133+
134+
/// <summary>Represents the navigator which is mapped onto the association 'SalesOrderHeader.Address1 - Address.SalesOrderHeaders1 (m:1)'</summary>
135+
public virtual ISet<SalesOrderHeader> SalesOrderHeaders1
136+
{
137+
get { return _salesOrderHeaders1; }
138+
set { _salesOrderHeaders1 = value; }
139+
}
140+
141+
/// <summary>Represents the navigator which is mapped onto the association 'Address.StateProvince - StateProvince.Addresses (m:1)'</summary>
142+
public virtual StateProvince StateProvince
143+
{
144+
get { return _stateProvince; }
145+
set { _stateProvince = value; }
146+
}
147+
148+
#endregion
149+
}
150+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>This code was generated by LLBLGen Pro v4.2.</auto-generated>
3+
//------------------------------------------------------------------------------
4+
using System;
5+
using System.ComponentModel;
6+
using System.Collections.Generic;
7+
8+
namespace NH.Bencher.EntityClasses
9+
{
10+
/// <summary>Class which represents the entity 'AddressType'</summary>
11+
public partial class AddressType
12+
{
13+
#region Class Member Declarations
14+
private ISet<BusinessEntityAddress> _businessEntityAddresses;
15+
private System.Int32 _addressTypeId;
16+
private System.DateTime _modifiedDate;
17+
private System.String _name;
18+
private System.Guid _rowguid;
19+
#endregion
20+
21+
/// <summary>Initializes a new instance of the <see cref="AddressType"/> class.</summary>
22+
public AddressType() : base()
23+
{
24+
_businessEntityAddresses = new HashSet<BusinessEntityAddress>();
25+
_addressTypeId = default(System.Int32);
26+
OnCreated();
27+
}
28+
29+
/// <summary>Method called from the constructor</summary>
30+
partial void OnCreated();
31+
32+
/// <summary>Returns a hash code for this instance.</summary>
33+
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. </returns>
34+
public override int GetHashCode()
35+
{
36+
int toReturn = base.GetHashCode();
37+
toReturn ^= this.AddressTypeId.GetHashCode();
38+
return toReturn;
39+
}
40+
41+
/// <summary>Determines whether the specified object is equal to this instance.</summary>
42+
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
43+
/// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.</returns>
44+
public override bool Equals(object obj)
45+
{
46+
if(obj == null)
47+
{
48+
return false;
49+
}
50+
AddressType toCompareWith = obj as AddressType;
51+
return toCompareWith == null ? false : ((this.AddressTypeId == toCompareWith.AddressTypeId));
52+
}
53+
54+
55+
#region Class Property Declarations
56+
/// <summary>Gets the AddressTypeId field. </summary>
57+
public virtual System.Int32 AddressTypeId
58+
{
59+
get { return _addressTypeId; }
60+
}
61+
62+
/// <summary>Gets or sets the ModifiedDate field. </summary>
63+
public virtual System.DateTime ModifiedDate
64+
{
65+
get { return _modifiedDate; }
66+
set { _modifiedDate = value; }
67+
}
68+
69+
/// <summary>Gets or sets the Name field. </summary>
70+
public virtual System.String Name
71+
{
72+
get { return _name; }
73+
set { _name = value; }
74+
}
75+
76+
/// <summary>Gets or sets the Rowguid field. </summary>
77+
public virtual System.Guid Rowguid
78+
{
79+
get { return _rowguid; }
80+
set { _rowguid = value; }
81+
}
82+
83+
/// <summary>Represents the navigator which is mapped onto the association 'BusinessEntityAddress.AddressType - AddressType.BusinessEntityAddresses (m:1)'</summary>
84+
public virtual ISet<BusinessEntityAddress> BusinessEntityAddresses
85+
{
86+
get { return _businessEntityAddresses; }
87+
set { _businessEntityAddresses = value; }
88+
}
89+
90+
#endregion
91+
}
92+
}

0 commit comments

Comments
 (0)