Page 1 of 1

OracleMonitor TraceEvent Event

Posted: Fri 28 Oct 2011 06:58
by PatrikAhlquist
Hi!

Can I get the duration of an event?

/Patrik

Posted: Mon 31 Oct 2011 11:56
by Shalex
Please use the MonitorEventArgs.Duration property:

Code: Select all

    static void OnEvent(object sender, MonitorEventArgs e) {
        if (e.TracePoint == MonitorTracePoint.AfterEvent) {
            Console.WriteLine("Description: " + e.Description);
            Console.WriteLine("Duration: " + e.Duration);
        }
    }
    [MTAThread]
    static void Main(string[] args) {
        OracleConnection myConn = new OracleConnection("User Id=Scott;Password=tiger;Data Source=orcl1120");
        OracleMonitor myMonitor = new OracleMonitor();
        myMonitor.TraceEvent += new MonitorEventHandler(OnEvent);
        myMonitor.IsActive = true;
        OracleCommand myCommand = new OracleCommand("select count(*) from dept", myConn);
        myConn.Open();
        Console.WriteLine(myCommand.ExecuteScalar());
        myConn.Close();
        myMonitor.TraceEvent -= new MonitorEventHandler(OnEvent);
        Console.ReadLine();
    }

Posted: Tue 01 Nov 2011 07:47
by PatrikAhlquist
I can't find Duration, am I using an older version?

Code: Select all

#region Assembly Devart.Data.dll, v2.0.50727
// C:\Program Files\Devart\dotConnect\Oracle\Devart.Data.dll
#endregion

using System;

namespace Devart.Common
{
    // Summary:
    //     Provides data for the Devart.Common.DbMonitor.TraceEvent event of the Devart.Common.DbMonitor
    //     class.
    public class MonitorEventArgs : EventArgs
    {
        // Summary:
        //     Gets the call stack of the monitor event.
        public string[] CallStack { get; }
        //
        // Summary:
        //     Gets the description of a Devart.Common.DbMonitor event.
        public string Description { get; }
        //
        // Summary:
        //     Gets Devart.Common.DbMonitor event type.
        public MonitorEventType EventType { get; }
        //
        // Summary:
        //     Gets the additional information for a Devart.Common.DbMonitor event.
        public string ExtraInfo { get; }
        //
        // Summary:
        //     Determines whether Devart.Common.DbMonitor.TraceEvent event occurs before
        //     or after the operation takes place.
        public MonitorTracePoint TracePoint { get; }
    }
}

Posted: Tue 01 Nov 2011 08:30
by Shalex
This property is available in dotConnect for Oracle v 6.50.237. Tell us your current versions of:
1) dotConnect for Oracle (the Tools > Oracle > About menu of Visual Studio);
2) dbMonitor (the Help > About menu of dbMonitor).

Posted: Tue 01 Nov 2011 13:34
by PatrikAhlquist
Thanks, that did it. I had the previous version!

/Patrik