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

            DDS.ReturnCode dds_result;

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

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            dds_result = PP_fixed_reader.Take(ref PP_fixed_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_fixed_dataList.Length;
            if (amount != 0)
            {
                if (amount > 1)
                {
                    System.Console.WriteLine("PING: Ignore excess messages : " + amount
                                             + " msg received");
                }
                PP_fixed_dataList[0].count++;
                if (PP_fixed_dataList[0].count < nof_cycles)
                {
                    stopWatch  = Stopwatch.StartNew();
                    dds_result = PP_fixed_writer.Write(PP_fixed_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_fixed_reader.ReturnLoan(ref PP_fixed_dataList, ref infoList);
                //assert (dds_result == RETCODE_OK.value);
            }
            else
            {
                System.Console.WriteLine("PING: PING_fixed triggered, but no data available");
            }
            return(result);
        }
Beispiel #2
0
        private Boolean PP_fixed_handler(int nof_cycles)
        {
            DDS.SampleInfo[] infoList = null;
            int     amount;
            Boolean result = false;

            DDS.ReturnCode dds_result;

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

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

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