/** * testCreationOfString */ public static long testSetterGetterClassWith10int() { ClassWith10intGetterSetter classWith10int = new ClassWith10intGetterSetter(); int count = 0; DateTime start = DateTime.Now; for (int i = NB_SETTER_GETTER_INT_TESTS; i-- != 0;) { // Write to force jre not to optimize the code if (i % 2 == 0) { classWith10int.Int1 = i; classWith10int.Int2 = i; classWith10int.Int3 = i; classWith10int.Int4 = i; classWith10int.Int5 = i; classWith10int.Int6 = i; classWith10int.Int7 = i; classWith10int.Int8 = i; classWith10int.Int9 = i; classWith10int.Int10 = i; } else { int j = i - 1; classWith10int.Int1 = j; classWith10int.Int2 = j; classWith10int.Int3 = j; classWith10int.Int4 = j; classWith10int.Int5 = j; classWith10int.Int6 = j; classWith10int.Int7 = j; classWith10int.Int8 = j; classWith10int.Int9 = j; classWith10int.Int10 = j; } count += classWith10int.Int1 + classWith10int.Int2 + classWith10int.Int3 + classWith10int.Int4 + classWith10int.Int5 + classWith10int.Int6 + classWith10int.Int7 + classWith10int.Int8 + classWith10int.Int9 + classWith10int.Int10; } DateTime end = DateTime.Now; TimeSpan executionTime = end - start; Console.WriteLine("[GetterSetterTest], Setter Getter of ClassWith10int() test=" + NB_SETTER_GETTER_INT_TESTS + ", classWith10int.Int1=" + classWith10int.Int1 + ", snapshot time," + executionTime.TotalMilliseconds); return((long)executionTime.TotalMilliseconds); }
/** * testCreationOfString */ public static long testSetterGetterClassWith10int() { ClassWith10intGetterSetter classWith10int = new ClassWith10intGetterSetter(); int count = 0; DateTime start = DateTime.Now; for (int i = NB_SETTER_GETTER_INT_TESTS; i-- != 0; ) { // Write to force jre not to optimize the code if (i % 2 == 0) { classWith10int.Int1 = i; classWith10int.Int2 = i; classWith10int.Int3 = i; classWith10int.Int4 = i; classWith10int.Int5 = i; classWith10int.Int6 = i; classWith10int.Int7 = i; classWith10int.Int8 = i; classWith10int.Int9 = i; classWith10int.Int10 = i; } else { int j = i - 1; classWith10int.Int1 = j; classWith10int.Int2 = j; classWith10int.Int3 = j; classWith10int.Int4 = j; classWith10int.Int5 = j; classWith10int.Int6 = j; classWith10int.Int7 = j; classWith10int.Int8 = j; classWith10int.Int9 = j; classWith10int.Int10 = j; } count += classWith10int.Int1 + classWith10int.Int2 + classWith10int.Int3 + classWith10int.Int4 + classWith10int.Int5 + classWith10int.Int6 + classWith10int.Int7 + classWith10int.Int8 + classWith10int.Int9 + classWith10int.Int10; } DateTime end = DateTime.Now; TimeSpan executionTime = end - start; Console.WriteLine("[GetterSetterTest], Setter Getter of ClassWith10int() test=" + NB_SETTER_GETTER_INT_TESTS + ", classWith10int.Int1=" + classWith10int.Int1 + ", snapshot time," + executionTime.TotalMilliseconds); return (long)executionTime.TotalMilliseconds; }
/** * testCreationOfString */ public static long testGetterClassWith10int() { ClassWith10intGetterSetter classWith10int = new ClassWith10intGetterSetter(); int count = 0; DateTime start = DateTime.Now; for (int i = NB_SETTER_GETTER_INT_TESTS; i-- != 0; ) { // Write to force cpp not to optimize the code, never executed bool testAlwaysFalse = (i % 2 == 2); if (testAlwaysFalse) { classWith10int.Int1 = i; } count += classWith10int.Int1; if (testAlwaysFalse) { classWith10int.Int2 = i; } count += classWith10int.Int2; if (testAlwaysFalse) { classWith10int.Int3 = i; } count += classWith10int.Int3; if (testAlwaysFalse) { classWith10int.Int4 = i; } count += classWith10int.Int4; if (testAlwaysFalse) { classWith10int.Int5 = i; } count += classWith10int.Int5; if (testAlwaysFalse) { classWith10int.Int6 = i; } count += classWith10int.Int6; if (testAlwaysFalse) { classWith10int.Int7 = i; } count += classWith10int.Int7; if (testAlwaysFalse) { classWith10int.Int8 = i; } count += classWith10int.Int8; if (testAlwaysFalse) { classWith10int.Int9 = i; } count += classWith10int.Int9; if (testAlwaysFalse) { classWith10int.Int10 = i; } count += classWith10int.Int10; } DateTime end = DateTime.Now; TimeSpan executionTime = end - start; Console.WriteLine("[GetterSetterTest], Getter of ClassWith10int() test=" + NB_SETTER_GETTER_INT_TESTS + ", count=" + count + " classWith10int.Int1=" + classWith10int.Int1 + ", snapshot time," + executionTime.TotalMilliseconds); return (long) executionTime.TotalMilliseconds; }
/** * testCreationOfString */ public static long testGetterClassWith10int() { ClassWith10intGetterSetter classWith10int = new ClassWith10intGetterSetter(); int count = 0; DateTime start = DateTime.Now; for (int i = NB_SETTER_GETTER_INT_TESTS; i-- != 0;) { // Write to force cpp not to optimize the code, never executed bool testAlwaysFalse = (i % 2 == 2); if (testAlwaysFalse) { classWith10int.Int1 = i; } count += classWith10int.Int1; if (testAlwaysFalse) { classWith10int.Int2 = i; } count += classWith10int.Int2; if (testAlwaysFalse) { classWith10int.Int3 = i; } count += classWith10int.Int3; if (testAlwaysFalse) { classWith10int.Int4 = i; } count += classWith10int.Int4; if (testAlwaysFalse) { classWith10int.Int5 = i; } count += classWith10int.Int5; if (testAlwaysFalse) { classWith10int.Int6 = i; } count += classWith10int.Int6; if (testAlwaysFalse) { classWith10int.Int7 = i; } count += classWith10int.Int7; if (testAlwaysFalse) { classWith10int.Int8 = i; } count += classWith10int.Int8; if (testAlwaysFalse) { classWith10int.Int9 = i; } count += classWith10int.Int9; if (testAlwaysFalse) { classWith10int.Int10 = i; } count += classWith10int.Int10; } DateTime end = DateTime.Now; TimeSpan executionTime = end - start; Console.WriteLine("[GetterSetterTest], Getter of ClassWith10int() test=" + NB_SETTER_GETTER_INT_TESTS + ", count=" + count + " classWith10int.Int1=" + classWith10int.Int1 + ", snapshot time," + executionTime.TotalMilliseconds); return((long)executionTime.TotalMilliseconds); }