public virtual object Instantiate(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi) { NeoDatis.Odb.Test.Performance.SimpleObject so = new NeoDatis.Odb.Test.Performance.SimpleObject (); return(so); }
private NeoDatis.Odb.Test.Performance.SimpleObject GetSimpleObjectInstance(int i) { NeoDatis.Odb.Test.Performance.SimpleObject so = new NeoDatis.Odb.Test.Performance.SimpleObject (); so.SetDate(new System.DateTime()); so.SetDuration(i); so.SetName("Bonjour, comment allez vous?" + i); return so; }
private NeoDatis.Odb.Test.Performance.SimpleObject GetSimpleObjectInstance(int i) { NeoDatis.Odb.Test.Performance.SimpleObject so = new NeoDatis.Odb.Test.Performance.SimpleObject (); so.SetDate(new System.DateTime()); so.SetDuration(i); so.SetName("Bonjour, comment allez vous?" + i); return(so); }
/// <exception cref="System.Exception"></exception> public virtual void BuildBase() { bool inMemory = true; // Deletes the database file NeoDatis.Tool.IOUtil.DeleteFile(OdbFileName); long t1 = 0; long t2 = 0; long t3 = 0; long t4 = 0; long t5 = 0; long t6 = 0; long t7 = 0; long t77 = 0; long t8 = 0; NeoDatis.Odb.ODB odb = null; NeoDatis.Odb.Test.Performance.SimpleObject so = null; // Insert TEST_SIZE objects System.Console.Out.WriteLine("Inserting " + TestSize + " objects"); t1 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); odb = NeoDatis.Odb.ODBFactory.Open(OdbFileName); for (int i = 0; i < TestSize; i++) { object o = GetSimpleObjectInstance(i); odb.Store(o); if (i % 10000 == 0) { // System.out.println("i="+i); NeoDatis.Odb.Impl.Tool.MemoryMonitor.DisplayCurrentMemory(string.Empty + i, true); } } // System.out.println("Cache="+Dummy.getEngine(odb).getSession().getCache().toString()); t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); // Closes the database odb.Close(); }
public virtual object Instantiate(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi) { NeoDatis.Odb.Test.Performance.SimpleObject so = new NeoDatis.Odb.Test.Performance.SimpleObject (); return so; }
public virtual void TestInsertSimpleObjectODB(bool force) { if (!force && !runAll) { return; } bool reconnectStatus = NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession(); //OdbConfiguration.setReconnectObjectsToSession(false); // Thread.sleep(20000); bool doUpdate = true; bool doDelete = true; // Configuration.setDatabaseCharacterEncoding(null); // LogUtil.logOn(FileSystemInterface.LOG_ID,true); // LogUtil.logOn(ObjectReader.LOG_ID,true); // Configuration.setUseLazyCache(true); bool inMemory = true; // Configuration.monitorMemory(true); // Configuration.setUseModifiedClass(true); // Deletes the database file DeleteBase(OdbFileName); long t1 = 0; long t2 = 0; long t3 = 0; long t4 = 0; long t5 = 0; long t6 = 0; long t7 = 0; long t77 = 0; long t8 = 0; NeoDatis.Odb.ODB odb = null; NeoDatis.Odb.Objects <SimpleObject> l = null; NeoDatis.Odb.Test.Performance.SimpleObject so = null; // Insert TEST_SIZE objects Println("Inserting " + TestSize + " objects"); t1 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); odb = Open(OdbFileName); int i = 0; // odb.getClassRepresentation(SimpleObject.class).addFullInstantiationHelper(new // SimpleObjectFullInstantiationHelper()); for (i = 0; i < TestSize; i++) { object o = GetSimpleObjectInstance(i); odb.Store(o); if (i % 10000 == 0) { } } // println("i="+i); // Monitor.displayCurrentMemory(""+i,true); // println("Cache="+Dummy.getEngine(odb).getSession().getCache().toString()); t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); // Closes the database odb.Close(); // if(true)return; t3 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); Println("Retrieving " + TestSize + " objects"); // Reopen the database odb = Open(OdbFileName); // Gets the TEST_SIZE objects l = odb.GetObjects <SimpleObject>(inMemory); t4 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); i = 0; while (l.HasNext()) { object o = l.Next(); if (i % 10000 == 0) { } // Monitor.displayCurrentMemory("select "+i,true); i++; } t5 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); if (doUpdate) { Println("Updating " + TestSize + " objects"); i = 0; so = null; l.Reset(); while (l.HasNext()) { so = (NeoDatis.Odb.Test.Performance.SimpleObject)l.Next(); so.SetName(so.GetName() + " updated"); odb.Store(so); if (i % 10000 == 0) { } // Monitor.displayCurrentMemory(""+i); i++; } } t6 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); odb.Close(); t7 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); if (doDelete) { Println("Deleting " + TestSize + " objects"); odb = Open(OdbFileName); l = odb.GetObjects <SimpleObject>(inMemory); t77 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); // println("After getting objects - before delete"); i = 0; while (l.HasNext()) { so = (NeoDatis.Odb.Test.Performance.SimpleObject)l.Next(); if (!so.GetName().EndsWith("updated")) { throw new System.Exception("Update not ok for " + so.GetName()); } odb.Delete(so); if (i % 10000 == 0) { } // println("s="+i); i++; } odb.Close(); } Thread.Sleep(500); t8 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.OdbConfiguration.SetReconnectObjectsToSession(reconnectStatus); DisplayResult("ODB " + TestSize + " SimpleObject objects ", t1, t2, t3, t4, t5, t6 , t7, t77, t8); }