public void Execute_ExecutionMetrics()

in Amazon.QLDB.Driver.IntegrationTests/StatementExecutionTests.cs [850:899]


        public void Execute_ExecutionMetrics()
        {
            qldbDriver.Execute(txn =>
            {
                var insertQuery = String.Format("INSERT INTO {0} << {{'col': 1}}, {{'col': 2}}, {{'col': 3}} >>",
                    Constants.TableName);
                txn.Execute(insertQuery);
            });

            // Given
            var selectQuery = String.Format("SELECT * FROM {0} as a, {0} as b, {0} as c, {0} as d, {0} as e, {0} as f",
                Constants.TableName);

            // When
            qldbDriver.Execute(txn =>
            {
                var result = txn.Execute(selectQuery);
                long readIOs = 0;
                long processingTime = 0;

                foreach (IIonValue row in result)
                {
                    var ioUsage = result.GetConsumedIOs();
                    if (ioUsage != null)
                        readIOs = ioUsage.Value.ReadIOs;
                    var timingInfo = result.GetTimingInformation();
                    if (timingInfo != null)
                        processingTime = timingInfo.Value.ProcessingTimeMilliseconds;
                }

                // The 1092 value is from selectQuery, that performs self joins on a table.
                Assert.AreEqual(1092, readIOs);
                Assert.IsTrue(processingTime > 0);
            });

            // When
            var result = qldbDriver.Execute(txn =>
            {
                return txn.Execute(selectQuery);
            });

            var ioUsage = result.GetConsumedIOs();
            var timingInfo = result.GetTimingInformation();

            Assert.IsNotNull(ioUsage);
            Assert.IsNotNull(timingInfo);
            // The 1092 value is from selectQuery, that performs self joins on a table.
            Assert.AreEqual(1092, ioUsage?.ReadIOs);
            Assert.IsTrue(timingInfo?.ProcessingTimeMilliseconds > 0);
        }