OracleMonitor TraceEvent Event

OracleMonitor TraceEvent Event

Postby PatrikAhlquist » Fri 28 Oct 2011 06:58

Hi!

Can I get the duration of an event?

/Patrik
PatrikAhlquist
 
Posts: 21
Joined: Thu 11 Feb 2010 08:40

Postby Shalex » Mon 31 Oct 2011 11:56

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();
    }
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Postby PatrikAhlquist » Tue 01 Nov 2011 07:47

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; }
    }
}
PatrikAhlquist
 
Posts: 21
Joined: Thu 11 Feb 2010 08:40

Postby Shalex » Tue 01 Nov 2011 08:30

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).
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Postby PatrikAhlquist » Tue 01 Nov 2011 13:34

Thanks, that did it. I had the previous version!

/Patrik
PatrikAhlquist
 
Posts: 21
Joined: Thu 11 Feb 2010 08:40


Return to dotConnect for Oracle