示例#1
0
        private Boolean PP_array_handler(int nof_cycles)
        {
            DDS.SampleInfo[] infoList = null;
            int     amount;
            Boolean result = false;

            DDS.ReturnCode dds_result;

            /* System.out.println "PING: PING_array arrived"); */

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            dds_result = PP_array_reader.Take(ref PP_array_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_array_dataList.Length;
            if (amount != 0)
            {
                if (amount > 1)
                {
                    System.Console.WriteLine("PING: Ignore excess messages : " + amount
                                             + " msg received");
                }
                PP_array_dataList[0].count++;
                if (PP_array_dataList[0].count < nof_cycles)
                {
                    stopWatch  = Stopwatch.StartNew();
                    dds_result = PP_array_writer.Write(PP_array_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_array_reader.ReturnLoan(ref PP_array_dataList, ref infoList);
                //assert (dds_result == RETCODE_OK.value);
            }
            else
            {
                System.Console.WriteLine("PING: PING_array triggered, but no data available");
            }
            return(result);
        }
示例#2
0
        private Boolean PP_array_handler(int nof_cycles)
        {
            DDS.SampleInfo[] infoList = null;
            int     amount;
            Boolean result = false;

            DDS.ReturnCode dds_result;

            /* System.out.println "PING: PING_array arrived"); */

            preTakeTime.timeGet();
            dds_result = PP_array_reader.Take(ref PP_array_dataList, ref infoList,
                                              DDS.SampleStateKind.Any,
                                              DDS.ViewStateKind.Any, DDS.InstanceStateKind.Any);
            //assert (dds_result == RETCODE_OK.value);
            postTakeTime.timeGet();

            amount = PP_array_dataList.Length;
            if (amount != 0)
            {
                if (amount > 1)
                {
                    System.Console.WriteLine("PING: Ignore excess messages : " + amount
                                             + " msg received");
                }
                PP_array_dataList[0].count++;
                if (PP_array_dataList[0].count < nof_cycles)
                {
                    preWriteTime.timeGet();
                    dds_result = PP_array_writer.Write(PP_array_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_array_reader.ReturnLoan(ref PP_array_dataList, ref infoList);
                //assert (dds_result == RETCODE_OK.value);
            }
            else
            {
                System.Console.WriteLine("PING: PING_array triggered, but no data available");
            }
            return(result);
        }