Esempio n. 1
0
        private Boolean PP_seq_handler(int nof_cycles)
        {
            DDS.SampleInfo[] infoList = null;
            int     amount;
            Boolean result = false;

            DDS.ReturnCode dds_result;

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

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            dds_result = PP_seq_reader.Take(ref PP_seq_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_seq_dataList.Length;
            if (amount != 0)
            {
                if (amount > 1)
                {
                    System.Console.WriteLine("PING: Ignore excess messages : " + amount
                                             + " msg received");
                }
                PP_seq_dataList[0].count++;
                if (PP_seq_dataList[0].count < nof_cycles)
                {
                    stopWatch  = Stopwatch.StartNew();
                    dds_result = PP_seq_writer.Write(PP_seq_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_seq_reader.ReturnLoan(ref PP_seq_dataList, ref infoList);
                //assert (dds_result == RETCODE_OK.value);
            }
            else
            {
                System.Console.WriteLine("PING: PING_seq triggered, but no data available");
            }

            return(result);
        }
Esempio n. 2
0
        private Boolean PP_seq_handler(int nof_cycles)
        {
            DDS.SampleInfo[] infoList = null;
            int     amount;
            Boolean result = false;

            DDS.ReturnCode dds_result;

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

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

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

            return(result);
        }