473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get calltime property of component (Com+ 1.5) ?

Hi,
I am trying to get the calltime property of a component in Com+ 1.5.
I read in some other newsgroups about an interface
(IComTrackingInfoEvents...)
which helps getting this property in 1.5 version.
However, i can't find any sample code implementing this interface... and i
wasn't
able to understand how to implement this.
Let me know of any good links which can introduce me to this subject\ sample
codes....

Thanks in advance.
Nov 22 '05 #1
1 3594
After searching all over the web...
I finally found one great answer (10x God!!!) written by Egil Hogholt.

http://www.egilh.com/blog/archive/2005/02/25/557.aspx

I have copied the C# version of the code which was written in one of
the comments (Thanks to Mark).

Take a look at the code:

using System;
using System.Runtime.InteropServices;

namespace ptdpc
{
/// <summary>
/// Summary description for ComMonitor.
/// </summary>
public class ComMonitor
{
static public void GetData()
{
// Get an instance of the internal com+ tracker objet
Type comPlusTrackerType = Type.GetTypeFromCLSID(new
System.Guid("{ecabafb9-7f19-11d2-978e-0000f8757e2a}"));
COMSVCSLib.IGetAppData getAppData =
(COMSVCSLib.IGetAppData)Activator.CreateInstance(c omPlusTrackerType);

// Step through the list of running application
uint appCount;
IntPtr appDataPtr = new IntPtr();
unsafe
{
getAppData.GetApps(out appCount, new
IntPtr(&appDataPtr));
}
int appDataSize =
Marshal.SizeOf(typeof(COMSVCSLib.appData));
for (int appIndex = 0; appIndex < appCount; appIndex++)
{
COMSVCSLib.appData appData = (COMSVCSLib.appData)
Marshal.PtrToStructure(new IntPtr(appDataPtr.ToInt32()
+ (appIndex * appDataSize)), typeof(COMSVCSLib.appData));

Console.WriteLine("AppID={0}",
GetString(appData.m_szAppGuid));
// Application information
Console.Write("ID={0}", appData.m_idApp);
Console.Write(", PID={0}", appData.m_dwAppProcessId);
Console.WriteLine();
Console.Write("Calls/Sec={0}",
appData.m_AppStatistics.m_cCallsPerSecond);
Console.Write(", Total Calls={0}",
appData.m_AppStatistics.m_cTotalCalls);
Console.Write(", Class Count={0}",
appData.m_AppStatistics.m_cTotalClasses);
Console.Write(", Instnc Count={0}",
appData.m_AppStatistics.m_cTotalInstances);
Console.WriteLine();

uint nClsIDCount;
IntPtr clsIDDataPtr;
unsafe
{
getAppData.GetAppData(appData.m_idApp, out
nClsIDCount, new IntPtr(&clsIDDataPtr));
}
int clsIDDataSize =
Marshal.SizeOf(typeof(COMSVCSLib.CLSIDDATA));
for (int clsIDIndex = 0; clsIDIndex < nClsIDCount;
clsIDIndex++)
{
COMSVCSLib.CLSIDDATA clsIDData =
(COMSVCSLib.CLSIDDATA)
Marshal.PtrToStructure(new
IntPtr(clsIDDataPtr.ToInt32() + (clsIDIndex * clsIDDataSize)),
typeof(COMSVCSLib.CLSIDDATA));

Console.WriteLine("\tCLSID={0}",
clsIDData.m_clsid.ToString());

// Performance information
Console.Write("\tBound={0}", clsIDData.m_cBound);
Console.Write(", References={0}",
clsIDData.m_cReferences);
Console.Write(", Pooled={0}", clsIDData.m_cPooled);
Console.WriteLine();
Console.Write("\tCallsCompleted={0}",
clsIDData.m_cCallsCompleted);
Console.Write(", CallsFailed={0}",
clsIDData.m_cCallsFailed);
Console.Write(", InCall={0}", clsIDData.m_cInCall);
Console.Write(", RespTime={0}",
clsIDData.m_dwRespTime);
Console.WriteLine();
Console.WriteLine();
}
Marshal.FreeCoTaskMem(clsIDDataPtr);
}
Marshal.FreeCoTaskMem(appDataPtr);
Marshal.ReleaseComObject(getAppData);
}

static string GetString(ushort[] arr)
{
byte[] buf = new byte[arr.Length * 2];
for (int i = 0; i < arr.Length; i++)
{
buf[i * 2] = (byte)(arr[i] & 0xFF);
buf[i * 2 + 1] = (byte)(arr[i] >> 8);
}
string s =
System.Text.UnicodeEncoding.Unicode.GetString(buf) ;
return s;
}
}
}

This code uses an undocumented object which i guess is microsoft's way
to show the stats inside DCOMCNFG console...

I can only ask "WHY!!!" this object is not documented ?
Iddo

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Laszlo Zsolt Nagy | last post by:
My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. I had the same problems in Delphi before and the solution...
0
by: Iddo | last post by:
Hi, I am trying to get the calltime property of a component in Com+ 1.5. I read in some other newsgroups about an interface (IComTrackingInfoEvents...) which helps getting this property in 1.5...
0
by: Jason | last post by:
What interface do I need to implement in order to get a component with a public property to show up in the data binding drop down boxes at design time in VS.net? I've tried to look just about...
2
by: Edward Diener | last post by:
How does one specify in a component that a property is a pointer to another component ? How is this different from a property that is actually an embedded component ? Finally how is one notified in...
0
by: MBO | last post by:
Hello NG, I've created a custom component inherited from "System.Web.UI.Webcontrold.Button" and added a new String Property .... Private _waitMessage As String <Bindable(True),...
3
by: Nice Chap | last post by:
Is it possible to have custom property pages for a Component and if so how I can write one please ? Also, is it possible to reuse the drop down box that we get for Data Source and Data Member...
0
by: Jordan Bowness | last post by:
I make a similar post in another newsgroup, but this example is simplified somewhat. I have a component (cmpMyComponent) with 2 properties. The 1st property is a string value (Description) and...
0
by: Roman | last post by:
hello I got some component derived from System.ComponentModel.Component, which has some properties of type DataView. When I drag my component on a form i want that this data view properties of...
5
by: Kimmo Laine | last post by:
Hi is there a way to change propertys attribute from the code? Letīs say that i have the following property in my class: public int Count } Is there a way to change the displayname, from...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.