private Boolean PP_min_handler(int nof_cycles) { DDS.SampleInfo[] infoList = null; int amount; Boolean result = false; DDS.ReturnCode dds_result; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); dds_result = PP_min_reader.Take(ref PP_min_dataList, ref infoList, DDS.SampleStateKind.Any, DDS.ViewStateKind.Any, DDS.InstanceStateKind.Any); //assert (dds_result == RETCODE_OK.value); stopWatch.Stop(); takeTicks = stopWatch.ElapsedTicks; amount = PP_min_dataList.Length; if (amount != 0) { if (amount > 1) { System.Console.WriteLine("PING: Ignore excess messages : " + amount + " msg received"); } PP_min_dataList[0].count++; if (PP_min_dataList[0].count < nof_cycles) { stopWatch = Stopwatch.StartNew(); dds_result = PP_min_writer.Write(PP_min_dataList[0], DDS.InstanceHandle.Nil); //assert (dds_result == RETCODE_OK.value); stopWatch.Stop(); writeTicks = stopWatch.ElapsedTicks; write_access.add_stats(writeTicks); } else { result = true; } read_access.add_stats(takeTicks); roundtrip.add_stats(roundTripTicks + takeTicks); roundTripTicks = writeTicks; dds_result = PP_min_reader.ReturnLoan(ref PP_min_dataList, ref infoList); //assert (dds_result == RETCODE_OK.value); } else { System.Console .WriteLine("PING: PING_min triggered, but no data available"); } return(result); }
private Boolean PP_min_handler(int nof_cycles) { DDS.SampleInfo[] infoList = null; int amount; Boolean result = false; DDS.ReturnCode dds_result; preTakeTime.timeGet(); dds_result = PP_min_reader.Take(ref PP_min_dataList, ref infoList, DDS.SampleStateKind.Any, DDS.ViewStateKind.Any, DDS.InstanceStateKind.Any); //assert (dds_result == RETCODE_OK.value); postTakeTime.timeGet(); amount = PP_min_dataList.Length; if (amount != 0) { if (amount > 1) { System.Console.WriteLine("PING: Ignore excess messages : " + amount + " msg received"); } PP_min_dataList[0].count++; if (PP_min_dataList[0].count < nof_cycles) { preWriteTime.timeGet(); dds_result = PP_min_writer.Write(PP_min_dataList[0], DDS.InstanceHandle.Nil); //assert (dds_result == RETCODE_OK.value); postWriteTime.timeGet(); write_access.add_stats(postWriteTime.sub(preWriteTime)); } else { result = true; } read_access.add_stats(postTakeTime.sub(preTakeTime)); roundtrip.add_stats(postTakeTime.sub(roundTripTime)); roundTripTime.set(preWriteTime.get()); dds_result = PP_min_reader.ReturnLoan(ref PP_min_dataList, ref infoList); //assert (dds_result == RETCODE_OK.value); } else { System.Console .WriteLine("PING: PING_min triggered, but no data available"); } return(result); }