public void SetUpBeforeClass() { vf = new MyValueFactory(); ps = new MyPacketSource(); mh = new MyMessageHandler(); Resources res = new Resources(); res.Add(TransportConsts.VALUE_FACTORY, vf); m = new Messagizer(ps, "foo:?Messagizer.format=binary", res); m.SetSession(mh); Console.WriteLine(); Console.Write("TestMessagizer"); }
public void Test_add_perf() { vf = new MyValueFactory(); XType add = vf.GetType("add"); Field x = new Field("x"); add.PutValidator(x, Validator_int.Get(0)); Field y = new Field("y"); add.PutValidator(y, Validator_int.Get(0)); Field _mf__messageId = DefaultValueFactory._mf__messageId; add.PutValidator(_mf__messageId, Validator_long.Get(0)); long msgid = 0x0123456789abcdefL; Message msg = new Message(add, vf); msg.Add(x, 123456789); msg.Add(y, 876543210); msg.Add(_mf__messageId, msgid); Resources res = new Resources(); res.Add(TransportConsts.VALUE_FACTORY, vf); MyPacketSource ps = new MyPacketSource(); Messagizer m = new Messagizer(ps, "foo:?Messagizer.format=binary", res); m.TransportMessage(null, msg); int n = 900973; for (int i = 0; i < 3; i++) { TestPerf("test_add_perf", i, m, msg, n); } }
public void Test_sum_perf() { XType sum = vf.GetType("sum"); Field values = new Field("values"); sum.PutValidator(values, Validator_int.Get(1)); Field _mf__messageId = DefaultValueFactory._mf__messageId; sum.PutValidator(_mf__messageId, Validator_long.Get(0)); long msgid = 0x0123456789abcdefL; int[] array = new int[2]; for (int i = 0; i < array.Length; i++) { array[i] = 123456789; } Message msg = new Message(sum, vf); msg.Add(values, array); msg.Add(_mf__messageId, msgid); Resources res = new Resources(); res.Add(TransportConsts.VALUE_FACTORY, vf); MyPacketSource ps = new MyPacketSource(); Messagizer m = new Messagizer(ps, "foo:?Messagizer.format=binary", res); m.TransportMessage(null, msg); int n = 509520; for (int i = 0; i < 1; i++) { TestPerf("test_sum_perf", i, m, msg, n); } }